[Mlir-commits] [mlir] [mlir][transform] LISH: Add transform op (PR #70630)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Mon Oct 30 02:58:48 PDT 2023
================
@@ -2109,3 +2109,48 @@ transform.sequence failures(propagate) {
transform.yield
}
}
+
+// -----
+
+// CHECK-LABEL: func @test_loop_invariant_subset_hoisting(
+// CHECK-SAME: %[[arg:.*]]: tensor<?xf32>
+func.func @test_loop_invariant_subset_hoisting(%arg: tensor<?xf32>) -> tensor<?xf32> {
+ %lb = "test.foo"() : () -> (index)
+ %ub = "test.foo"() : () -> (index)
+ %step = "test.foo"() : () -> (index)
+ // CHECK: %[[extract:.*]] = tensor.extract_slice %[[arg]]
+ // CHECK: %[[for:.*]]:2 = scf.for {{.*}} iter_args(%[[t:.*]] = %[[arg]], %[[hoisted:.*]] = %[[extract]])
+ // expected-remark @below{{new loop op}}
+ %0 = scf.for %iv = %lb to %ub step %step iter_args(%t = %arg) -> (tensor<?xf32>) {
+ %1 = tensor.extract_slice %t[0][5][1] : tensor<?xf32> to tensor<5xf32>
+ // CHECK: %[[foo:.*]] = "test.foo"(%[[hoisted]])
+ %2 = "test.foo"(%1) : (tensor<5xf32>) -> (tensor<5xf32>)
+ // Obfuscate the IR by inserting at offset %sub instead of 0; both of them
+ // have the same value.
+ %3 = tensor.insert_slice %2 into %t[0][5][1] : tensor<5xf32> into tensor<?xf32>
+ // CHECK: scf.yield %[[t]], %[[foo]]
+ scf.yield %3 : tensor<?xf32>
+ }
+ // CHECK: %[[insert:.*]] = tensor.insert_slice %[[for]]#1 into %[[for]]#0
+ // CHECK: return %[[insert]]
+ return %0 : tensor<?xf32>
+}
+
+transform.sequence failures(propagate) {
+^bb1(%arg1: !transform.any_op):
----------------
ftynse wrote:
Please use the named sequence-based entry point instead. The "top-level op" approach is soft-deprecated: I haven't yet updated all tests so cannot issue a formal deprecation notice, but it will come soon.
https://github.com/llvm/llvm-project/pull/70630
More information about the Mlir-commits
mailing list