diff --git a/mlir/include/mlir/Dialect/GPU/Passes.td b/mlir/include/mlir/Dialect/GPU/Passes.td --- a/mlir/include/mlir/Dialect/GPU/Passes.td +++ b/mlir/include/mlir/Dialect/GPU/Passes.td @@ -19,6 +19,7 @@ def GpuAsyncRegionPass : FunctionPass<"gpu-async-region"> { let summary = "Make GPU ops async"; let constructor = "mlir::createGpuAsyncRegionPass()"; + let dependentDialects = ["async::AsyncDialect"]; } #endif // MLIR_DIALECT_GPU_PASSES diff --git a/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp b/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp --- a/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp @@ -78,6 +78,8 @@ if (op->getNumRegions() > 0) return op->emitOpError("regions are not supported"); + auto tokenType = builder.getType(); + // If there is no current token, insert a `gpu.wait async` without // dependencies to create one. if (!currentToken) @@ -108,7 +110,7 @@ } OpBuilder builder; - const Type tokenType = builder.getType(); + // The token that represents the current asynchronous dependency. It's valid // range starts with a `gpu.wait async` op, and ends with a `gpu.wait` op. // In between, each gpu::AsyncOpInterface depends on the current token and