Skip to content

Commit

Permalink
[WGSL][NFC] Switch to new pass generation tablegen definitions. (#18215)
Browse files Browse the repository at this point in the history
Signed-off-by: hanhanW <[email protected]>
  • Loading branch information
hanhanW authored Aug 14, 2024
1 parent 7cac1b2 commit c71fe1a
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 42 deletions.
1 change: 0 additions & 1 deletion compiler/src/iree/compiler/Codegen/WGSL/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ iree_gentbl_cc_library(
iree_compiler_cc_library(
name = "PassHeaders",
hdrs = [
"PassDetail.h",
"Passes.h",
"Passes.h.inc",
],
Expand Down
1 change: 0 additions & 1 deletion compiler/src/iree/compiler/Codegen/WGSL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ iree_cc_library(
NAME
PassHeaders
HDRS
"PassDetail.h"
"Passes.h"
"Passes.h.inc"
DEPS
Expand Down
23 changes: 0 additions & 23 deletions compiler/src/iree/compiler/Codegen/WGSL/PassDetail.h

This file was deleted.

1 change: 0 additions & 1 deletion compiler/src/iree/compiler/Codegen/WGSL/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "mlir/Transforms/Passes.h"

#include "iree/compiler/Codegen/WGSL/PassDetail.h"
#include "iree/compiler/Codegen/WGSL/Passes.h"
#include "mlir/Pass/PassManager.h"

Expand Down
8 changes: 3 additions & 5 deletions compiler/src/iree/compiler/Codegen/WGSL/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

namespace mlir::iree_compiler {

// Removes push constants by replacing hal.interface.constant.loads with
// hal.interface.binding.subspan + flow.dispatch.tensor.load.
std::unique_ptr<InterfacePass<mlir::FunctionOpInterface>>
createWGSLReplacePushConstantsPass();

//----------------------------------------------------------------------------//
// Register WGSL Passes
//----------------------------------------------------------------------------//

#define GEN_PASS_DECL
#include "iree/compiler/Codegen/WGSL/Passes.h.inc" // IWYU pragma: keep

void registerCodegenWGSLPasses();

} // namespace mlir::iree_compiler
Expand Down
3 changes: 1 addition & 2 deletions compiler/src/iree/compiler/Codegen/WGSL/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ include "mlir/Pass/PassBase.td"
// WGSL passes (keep alphabetical)
//===---------------------------------------------------------------------===//

def WGSLReplacePushConstants :
def WGSLReplacePushConstantsPass :
InterfacePass<"iree-wgsl-replace-push-constants", "mlir::FunctionOpInterface"> {
let summary =
"Replaces push constant loads with binding loads for when using "
"WGSL without push constant support";
let constructor = "mlir::iree_compiler::createWGSLReplacePushConstantsPass()";
}

#endif // IREE_CODEGEN_WGSL_PASSES
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "iree/compiler/Codegen/WGSL/PassDetail.h"
#include "iree/compiler/Codegen/WGSL/Passes.h"
#include "iree/compiler/Dialect/Flow/IR/FlowOps.h"
#include "iree/compiler/Dialect/HAL/IR/HALDialect.h"
Expand All @@ -18,6 +17,9 @@

namespace mlir::iree_compiler {

#define GEN_PASS_DEF_WGSLREPLACEPUSHCONSTANTSPASS
#include "iree/compiler/Codegen/WGSL/Passes.h.inc"

namespace {

// These must match what the runtime uses.
Expand Down Expand Up @@ -106,8 +108,9 @@ addSet3IfNeeded(IREE::HAL::PipelineLayoutAttr originalAttr) {
setLayoutAttrs);
}

class WGSLReplacePushConstantsPass
: public WGSLReplacePushConstantsBase<WGSLReplacePushConstantsPass> {
class WGSLReplacePushConstantsPass final
: public impl::WGSLReplacePushConstantsPassBase<
WGSLReplacePushConstantsPass> {
void getDependentDialects(DialectRegistry &registry) const override {
registry.insert<mlir::arith::ArithDialect, mlir::tensor::TensorDialect,
mlir::vector::VectorDialect, IREE::Flow::FlowDialect,
Expand Down Expand Up @@ -194,10 +197,4 @@ class WGSLReplacePushConstantsPass
};

} // namespace

std::unique_ptr<InterfacePass<mlir::FunctionOpInterface>>
createWGSLReplacePushConstantsPass() {
return std::make_unique<WGSLReplacePushConstantsPass>();
}

} // namespace mlir::iree_compiler

0 comments on commit c71fe1a

Please sign in to comment.