[PATCH] D156558: [mlir][ArmSME] Remove "pure" side-effect from 'get_tile_id' op to prevent CSE
Cullen Rhodes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 28 09:47:02 PDT 2023
c-rhodes created this revision.
c-rhodes added reviewers: awarzynski, benmxwl-arm.
c-rhodes added a project: MLIR.
Herald added subscribers: bviyer, Moerafaat, zero9178, bzcheeseman, sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, kristof.beyls.
Herald added a project: All.
c-rhodes requested review of this revision.
Herald added a reviewer: nicolasvasilache.
Herald added subscribers: stephenneuendorffer, nicolasvasilache.
The 'get_tile_id' op is currently marked as pure so CSE thinks these ops
are equivalent and replaces with them a single one. This patch removes
pure to prevent this.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D156558
Files:
mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.td
mlir/test/Dialect/ArmSME/cse.mlir
Index: mlir/test/Dialect/ArmSME/cse.mlir
===================================================================
--- /dev/null
+++ mlir/test/Dialect/ArmSME/cse.mlir
@@ -0,0 +1,16 @@
+// RUN: mlir-opt -allow-unregistered-dialect %s -pass-pipeline='builtin.module(func.func(cse))' | FileCheck %s
+
+// This test is checking that CSE does not remove 'arm_sme.get_tile_id' ops as
+// duplicates.
+// CHECK-LABEL: @get_tile_id
+// CHECK: %[[TILE_ID_0:.*]] = arm_sme.get_tile_id : i32
+// CHECK: %[[TILE_ID_1:.*]] = arm_sme.get_tile_id : i32
+// CHECK: "prevent.dce"(%[[TILE_ID_0]]) : (i32) -> ()
+// CHECK: "prevent.dce"(%[[TILE_ID_1]]) : (i32) -> ()
+func.func @get_tile_id() {
+ %tile_id_1 = arm_sme.get_tile_id : i32
+ %tile_id_2 = arm_sme.get_tile_id : i32
+ "prevent.dce"(%tile_id_1) : (i32) -> ()
+ "prevent.dce"(%tile_id_2) : (i32) -> ()
+ return
+}
Index: mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.td
===================================================================
--- mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.td
+++ mlir/include/mlir/Dialect/ArmSME/IR/ArmSME.td
@@ -162,7 +162,7 @@
let hasCanonicalizeMethod = 1;
}
-def GetTileID : ArmSME_Op<"get_tile_id", [Pure]> {
+def GetTileID : ArmSME_Op<"get_tile_id"> {
let summary = "Returns an SME \"virtual tile\" id";
let description = [{
A `get_tile_id` operation returns a scalar integer representing an SME
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156558.545205.patch
Type: text/x-patch
Size: 1384 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230728/41fe439b/attachment.bin>
More information about the llvm-commits
mailing list