Skip to content

Commit a96ec1e

Browse files
authored
[SYCL-MLIR] Refactor SYCL passes (#8092)
Follow conventions used in other upstream MLIR dialects and avoid using deprecated pass definition mechanisms. This also allows us to pass per-pass options to our current passes if we define them beforehand. Signed-off-by: Victor Perez <[email protected]>
1 parent b130c74 commit a96ec1e

File tree

5 files changed

+21
-59
lines changed

5 files changed

+21
-59
lines changed

mlir-sycl/include/mlir/Conversion/SYCLToLLVM/SYCLToLLVMPass.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ namespace mlir {
2020
class ModuleOp;
2121
template <typename T> class OperationPass;
2222

23+
#define GEN_PASS_DECL_CONVERTSYCLTOLLVM
24+
#include "mlir/Conversion/SYCLPasses.h.inc"
25+
#undef GEN_PASS_DECL_CONVERTSYCLTOLLVM
26+
2327
namespace sycl {
2428

2529
/// Creates a pass to convert SYCL operations to the LLVMIR dialect.

mlir-sycl/lib/Conversion/PassDetail.h

Lines changed: 0 additions & 31 deletions
This file was deleted.

mlir-sycl/lib/Conversion/SYCLToLLVM/SYCLToLLVMPass.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "mlir/Conversion/SYCLToLLVM/SYCLToLLVMPass.h"
14-
#include "../PassDetail.h"
14+
1515
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
1616
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
1717
#include "mlir/Conversion/SYCLToLLVM/SYCLToLLVM.h"
@@ -20,10 +20,16 @@
2020

2121
using namespace mlir;
2222

23+
namespace mlir {
24+
#define GEN_PASS_DEF_CONVERTSYCLTOLLVM
25+
#include "mlir/Conversion/SYCLPasses.h.inc"
26+
#undef GEN_PASS_DEF_CONVERTSYCLTOLLVM
27+
} // namespace mlir
28+
2329
namespace {
2430
/// A pass converting MLIR SYCL operations into LLVM dialect.
2531
class ConvertSYCLToLLVMPass
26-
: public ConvertSYCLToLLVMBase<ConvertSYCLToLLVMPass> {
32+
: public impl::ConvertSYCLToLLVMBase<ConvertSYCLToLLVMPass> {
2733
void runOnOperation() override;
2834
};
2935
} // namespace

mlir-sycl/lib/Transforms/PassDetail.h

Lines changed: 0 additions & 24 deletions
This file was deleted.

mlir-sycl/lib/Transforms/SYCLMethodToSYCLCall.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,23 @@
1919
#include "mlir/Dialect/SYCL/MethodUtils.h"
2020
#include "mlir/Dialect/SYCL/Transforms/Passes.h"
2121

22-
#include "PassDetail.h"
2322
#include "mlir/Dialect/SYCL/IR/SYCLOps.h"
2423
#include "mlir/IR/FunctionInterfaces.h"
2524
#include "mlir/IR/PatternMatch.h"
2625
#include "mlir/Rewrite/FrozenRewritePatternSet.h"
2726
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
2827

2928
#include "polygeist/Ops.h"
29+
#include "llvm/Support/Debug.h"
3030

3131
#define DEBUG_TYPE "sycl-method-to-sycl-call"
3232

33+
namespace mlir {
34+
#define GEN_PASS_DEF_SYCLMETHODTOSYCLCALL
35+
#include "mlir/Dialect/SYCL/Transforms/Passes.h.inc"
36+
#undef GEN_PASS_DEF_SYCLMETHODTOSYCLCALL
37+
} // namespace mlir
38+
3339
using namespace mlir;
3440
using namespace sycl;
3541

@@ -207,7 +213,8 @@ static void addSYCLMethodPatterns(RewritePatternSet &patterns) {
207213
>(patterns);
208214
}
209215

210-
struct SYCLMethodToSYCLCall : SYCLMethodToSYCLCallBase<SYCLMethodToSYCLCall> {
216+
struct SYCLMethodToSYCLCall
217+
: impl::SYCLMethodToSYCLCallBase<SYCLMethodToSYCLCall> {
211218
LogicalResult initialize(MLIRContext *context) final {
212219
RewritePatternSet owningPatterns(context);
213220
addSYCLMethodPatterns(owningPatterns);

0 commit comments

Comments
 (0)