[Mlir-commits] [mlir] [MLIR][Vector] Add warp distribution for `vector.step` op (PR #155425)
Artem Kroviakov
llvmlistbot at llvm.org
Thu Aug 28 02:04:44 PDT 2025
================
@@ -1824,3 +1824,34 @@ func.func @warp_propagate_duplicated_operands_in_yield(%laneid: index) {
// CHECK-PROP : }
// CHECK-PROP : %[T1:.*] = math.exp %[[W]] : vector<1xf32>
// CHECK-PROP : "some_use"(%[[T1]]) : (vector<1xf32>) -> ()
+
+// -----
+
+func.func @warp_step_distribute(%laneid: index, %buffer: memref<128xindex>) {
+ %r = gpu.warp_execute_on_lane_0(%laneid)[32] -> (vector<1xindex>) {
+ %seq = vector.step : vector<32xindex>
+ gpu.yield %seq : vector<32xindex>
+ }
+ vector.transfer_write %r, %buffer[%laneid] : vector<1xindex>, memref<128xindex>
+ return
+}
+
+// CHECK-PROP-LABEL: func.func @warp_step_distribute
+// CHECK-PROP: %[[DISTRIBUTED_STEP:.*]] = vector.step : vector<1xindex>
+// CHECK-PROP: %[[LANE_ID_VEC:.*]] = vector.broadcast %arg0 : index to vector<1xindex>
+// CHECK-PROP: %[[LANE_STEP:.*]] = arith.addi %[[DISTRIBUTED_STEP]], %[[LANE_ID_VEC]] : vector<1xindex>
+// CHECK-PROP: vector.transfer_write %[[LANE_STEP]], %{{.*}} : vector<1xindex>, memref<128xindex>
+
+// -----
+
+func.func @negative_warp_step_distribute(%laneid: index, %buffer: memref<128xindex>) {
----------------
akroviakov wrote:
In the comments above, Adam suggests
> Maybe they don't use **the new @negative_... naming scheme.**
Renamed to `negative_warp_step_more_than_warp_size`
https://github.com/llvm/llvm-project/pull/155425
More information about the Mlir-commits
mailing list