[Mlir-commits] [mlir] 4f1e244 - Add missing dependent dialects to "convert-gpu-to-rocdl"
Mehdi Amini
llvmlistbot at llvm.org
Sat Jan 21 18:29:22 PST 2023
Author: Mehdi Amini
Date: 2023-01-22T03:28:49+01:00
New Revision: 4f1e244eb5b53e3ccced518048d8311e88e510d0
URL: https://github.com/llvm/llvm-project/commit/4f1e244eb5b53e3ccced518048d8311e88e510d0
DIFF: https://github.com/llvm/llvm-project/commit/4f1e244eb5b53e3ccced518048d8311e88e510d0.diff
LOG: Add missing dependent dialects to "convert-gpu-to-rocdl"
Fixes #60198
Added:
mlir/test/Conversion/GPUToROCDL/invalid.mlir
Modified:
mlir/include/mlir/Conversion/Passes.td
mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
index d067cbd60b62c..fc03d0037f1ce 100644
--- a/mlir/include/mlir/Conversion/Passes.td
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -375,7 +375,11 @@ def ConvertGpuOpsToNVVMOps : Pass<"convert-gpu-to-nvvm", "gpu::GPUModuleOp"> {
def ConvertGpuOpsToROCDLOps : Pass<"convert-gpu-to-rocdl", "gpu::GPUModuleOp"> {
let summary = "Generate ROCDL operations for gpu operations";
let constructor = "mlir::createLowerGpuOpsToROCDLOpsPass()";
- let dependentDialects = ["ROCDL::ROCDLDialect"];
+ let dependentDialects = [
+ "ROCDL::ROCDLDialect",
+ "cf::ControlFlowDialect",
+ "memref::MemRefDialect",
+ ];
let options = [
Option<"chipset", "chipset", "std::string",
/*default=*/"\"gfx000\"",
diff --git a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
index 034188f4fadef..daf6583ef6e67 100644
--- a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
+++ b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
@@ -23,6 +23,8 @@
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
+#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
+#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/GPU/Transforms/Passes.h"
diff --git a/mlir/test/Conversion/GPUToROCDL/invalid.mlir b/mlir/test/Conversion/GPUToROCDL/invalid.mlir
new file mode 100644
index 0000000000000..a4b59c5d218e1
--- /dev/null
+++ b/mlir/test/Conversion/GPUToROCDL/invalid.mlir
@@ -0,0 +1,17 @@
+// RUN: mlir-opt %s -convert-gpu-to-rocdl -split-input-file --verify-diagnostics
+
+
+// Demonstrate the need to register the cf and memref dialect as dependent.
+// CHECK-LABEL: @dependentDialect
+gpu.module @module {
+ gpu.func @dependentDialect() {
+ %arg0 = arith.constant 1 : i32
+ // expected-error at +1 {{failed to legalize operation 'gpu.shuffle' that was explicitly marked illega}}
+ %result = gpu.all_reduce %arg0 uniform {
+ ^bb(%lhs : i32, %rhs : i32):
+ %xor = arith.xori %lhs, %rhs : i32
+ "gpu.yield"(%xor) : (i32) -> ()
+ } : (i32) -> (i32)
+ gpu.return
+ }
+}
More information about the Mlir-commits
mailing list