[llvm-branch-commits] [mlir] 4c372a3 - [mlir] Make GpuAsyncRegion pass depend on async dialect.
Christian Sigg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 11 05:48:40 PST 2021
Author: Christian Sigg
Date: 2021-01-11T14:43:07+01:00
New Revision: 4c372a35cd892c0847da45540057447633a31d99
URL: https://github.com/llvm/llvm-project/commit/4c372a35cd892c0847da45540057447633a31d99
DIFF: https://github.com/llvm/llvm-project/commit/4c372a35cd892c0847da45540057447633a31d99.diff
LOG: [mlir] Make GpuAsyncRegion pass depend on async dialect.
Do not cache gpu.async.token type so that the pass can be created before the GPU dialect is registered.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D94397
Added:
Modified:
mlir/include/mlir/Dialect/GPU/Passes.td
mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
mlir/lib/Dialect/GPU/Transforms/PassDetail.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/GPU/Passes.td b/mlir/include/mlir/Dialect/GPU/Passes.td
index b9a83f7ef534..da1899c325fc 100644
--- a/mlir/include/mlir/Dialect/GPU/Passes.td
+++ b/mlir/include/mlir/Dialect/GPU/Passes.td
@@ -19,6 +19,7 @@ def GpuKernelOutlining : Pass<"gpu-kernel-outlining", "ModuleOp"> {
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
index 4f0eefb05931..37e0b9373d42 100644
--- a/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
@@ -78,6 +78,8 @@ struct GpuAsyncRegionPass::ThreadTokenCallback {
if (op->getNumRegions() > 0)
return op->emitOpError("regions are not supported");
+ auto tokenType = builder.getType<gpu::AsyncTokenType>();
+
// If there is no current token, insert a `gpu.wait async` without
// dependencies to create one.
if (!currentToken)
@@ -108,7 +110,7 @@ struct GpuAsyncRegionPass::ThreadTokenCallback {
}
OpBuilder builder;
- const Type tokenType = builder.getType<gpu::AsyncTokenType>();
+
// 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
diff --git a/mlir/lib/Dialect/GPU/Transforms/PassDetail.h b/mlir/lib/Dialect/GPU/Transforms/PassDetail.h
index 2e6fb9217189..c83ac3035a40 100644
--- a/mlir/lib/Dialect/GPU/Transforms/PassDetail.h
+++ b/mlir/lib/Dialect/GPU/Transforms/PassDetail.h
@@ -9,6 +9,7 @@
#ifndef DIALECT_GPU_TRANSFORMS_PASSDETAIL_H_
#define DIALECT_GPU_TRANSFORMS_PASSDETAIL_H_
+#include "mlir/Dialect/Async/IR/Async.h"
#include "mlir/Pass/Pass.h"
namespace mlir {
More information about the llvm-branch-commits
mailing list