diff --git a/compiler/src/iree/compiler/Codegen/WGSL/BUILD.bazel b/compiler/src/iree/compiler/Codegen/WGSL/BUILD.bazel index df9743e1a33a..0fb252877fa3 100644 --- a/compiler/src/iree/compiler/Codegen/WGSL/BUILD.bazel +++ b/compiler/src/iree/compiler/Codegen/WGSL/BUILD.bazel @@ -28,7 +28,6 @@ iree_gentbl_cc_library( iree_compiler_cc_library( name = "PassHeaders", hdrs = [ - "PassDetail.h", "Passes.h", "Passes.h.inc", ], diff --git a/compiler/src/iree/compiler/Codegen/WGSL/CMakeLists.txt b/compiler/src/iree/compiler/Codegen/WGSL/CMakeLists.txt index 6fbca2535e93..5b3c46fd3a2f 100644 --- a/compiler/src/iree/compiler/Codegen/WGSL/CMakeLists.txt +++ b/compiler/src/iree/compiler/Codegen/WGSL/CMakeLists.txt @@ -23,7 +23,6 @@ iree_cc_library( NAME PassHeaders HDRS - "PassDetail.h" "Passes.h" "Passes.h.inc" DEPS diff --git a/compiler/src/iree/compiler/Codegen/WGSL/PassDetail.h b/compiler/src/iree/compiler/Codegen/WGSL/PassDetail.h deleted file mode 100644 index 911453d27cb9..000000000000 --- a/compiler/src/iree/compiler/Codegen/WGSL/PassDetail.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2023 The IREE Authors -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef IREE_COMPILER_CODEGEN_WGSL_PASS_DETAIL_H_ -#define IREE_COMPILER_CODEGEN_WGSL_PASS_DETAIL_H_ - -#include "iree/compiler/Dialect/HAL/IR/HALOps.h" -#include "mlir/Dialect/Affine/IR/AffineOps.h" -#include "mlir/Dialect/MemRef/IR/MemRef.h" -#include "mlir/Interfaces/FunctionInterfaces.h" -#include "mlir/Pass/Pass.h" - -namespace mlir::iree_compiler { - -#define GEN_PASS_CLASSES -#include "iree/compiler/Codegen/WGSL/Passes.h.inc" - -} // namespace mlir::iree_compiler - -#endif // IREE_COMPILER_CODEGEN_WGSL_PASS_DETAIL_H_ diff --git a/compiler/src/iree/compiler/Codegen/WGSL/Passes.cpp b/compiler/src/iree/compiler/Codegen/WGSL/Passes.cpp index 124aedbb0b85..f2dc2da59814 100644 --- a/compiler/src/iree/compiler/Codegen/WGSL/Passes.cpp +++ b/compiler/src/iree/compiler/Codegen/WGSL/Passes.cpp @@ -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" diff --git a/compiler/src/iree/compiler/Codegen/WGSL/Passes.h b/compiler/src/iree/compiler/Codegen/WGSL/Passes.h index 63230a5915a1..b377d1dfe450 100644 --- a/compiler/src/iree/compiler/Codegen/WGSL/Passes.h +++ b/compiler/src/iree/compiler/Codegen/WGSL/Passes.h @@ -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> -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 diff --git a/compiler/src/iree/compiler/Codegen/WGSL/Passes.td b/compiler/src/iree/compiler/Codegen/WGSL/Passes.td index 04ef1f55bc47..8a672dd3c736 100644 --- a/compiler/src/iree/compiler/Codegen/WGSL/Passes.td +++ b/compiler/src/iree/compiler/Codegen/WGSL/Passes.td @@ -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 diff --git a/compiler/src/iree/compiler/Codegen/WGSL/WGSLReplacePushConstants.cpp b/compiler/src/iree/compiler/Codegen/WGSL/WGSLReplacePushConstants.cpp index 9b418c321746..378a560054b9 100644 --- a/compiler/src/iree/compiler/Codegen/WGSL/WGSLReplacePushConstants.cpp +++ b/compiler/src/iree/compiler/Codegen/WGSL/WGSLReplacePushConstants.cpp @@ -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" @@ -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. @@ -106,8 +108,9 @@ addSet3IfNeeded(IREE::HAL::PipelineLayoutAttr originalAttr) { setLayoutAttrs); } -class WGSLReplacePushConstantsPass - : public WGSLReplacePushConstantsBase { +class WGSLReplacePushConstantsPass final + : public impl::WGSLReplacePushConstantsPassBase< + WGSLReplacePushConstantsPass> { void getDependentDialects(DialectRegistry ®istry) const override { registry.insert> -createWGSLReplacePushConstantsPass() { - return std::make_unique(); -} - } // namespace mlir::iree_compiler