[Mlir-commits] [mlir] Fix what seems to be a silly bug in gpu.set_default_device rewriting. Smoke test included. (PR #75756)
Paul C Fuqua
llvmlistbot at llvm.org
Tue Dec 19 11:01:42 PST 2023
https://github.com/pcf000 updated https://github.com/llvm/llvm-project/pull/75756
>From 08045e6b415b2c5b3a13e0a46bc56418966b2a54 Mon Sep 17 00:00:00 2001
From: Paul Fuqua <pf at acm.org>
Date: Sun, 17 Dec 2023 17:10:17 -0600
Subject: [PATCH 1/2] Fix what seems to be a silly bug in
gpu.set_default_device rewriting. Smoke test included.
---
mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
index b68baffb5a8565..94df3765a67e74 100644
--- a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
+++ b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
@@ -1334,8 +1334,9 @@ LogicalResult ConvertSetDefaultDeviceOpToGpuRuntimeCallPattern::matchAndRewrite(
gpu::SetDefaultDeviceOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const {
Location loc = op.getLoc();
- setDefaultDeviceCallBuilder.create(loc, rewriter, {adaptor.getDevIndex()});
- rewriter.replaceOp(op, {});
+ auto call = setDefaultDeviceCallBuilder.create(loc, rewriter,
+ {adaptor.getDevIndex()});
+ rewriter.replaceOp(op, call);
return success();
}
>From 47645c1950a6b783395e20de9e4a251c979f1ff2 Mon Sep 17 00:00:00 2001
From: Paul Fuqua <pf at acm.org>
Date: Mon, 18 Dec 2023 16:14:25 -0600
Subject: [PATCH 2/2] amend! Fix gpu.set_default_device rewriting.
Fix gpu.set_default_device rewriting to properly use the new call.
Smoke test included.
---
mlir/test/Conversion/GPUCommon/set-default-device.mlir | 10 ++++++++++
1 file changed, 10 insertions(+)
create mode 100644 mlir/test/Conversion/GPUCommon/set-default-device.mlir
diff --git a/mlir/test/Conversion/GPUCommon/set-default-device.mlir b/mlir/test/Conversion/GPUCommon/set-default-device.mlir
new file mode 100644
index 00000000000000..c23d8a33d98803
--- /dev/null
+++ b/mlir/test/Conversion/GPUCommon/set-default-device.mlir
@@ -0,0 +1,10 @@
+// RUN: mlir-opt %s --gpu-to-llvm | FileCheck %s
+
+module attributes {gpu.container_module} {
+ // CHECK-LABEL: func @set_default_device
+ func.func @set_default_device(%arg0: i32) {
+ // CHECK: mgpuSetDefaultDevice
+ gpu.set_default_device %arg0
+ return
+ }
+}
More information about the Mlir-commits
mailing list