Skip to content

Commit a9eef59

Browse files
newlinghhkit
authored andcommitted
[Codegen] Rewrite test so LLVMGPUWarpReduction is not used (iree-org#21770)
There is some logic (introduced in iree-org#20310) that relies on finding a ` iree_tensor_ext.dispatch.tensor.store` op to trigger the LLVMGPUVectorDistribute configuration to kick in. If no such 'beacon' op is found, we currently fall through to LLVMGPUWarpReduction. This PR just rejiggles the test so that the IR is the expected state (the state which it will be in when the full pipeline is run) so that that we're on the right pass to use LLVMGPUVectorDistribute. I can follow this PR up with a refactoring of the logic to make it more robust Signed-off-by: James Newling <[email protected]> Signed-off-by: Ivan Ho <[email protected]>
1 parent 3df1247 commit a9eef59

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

compiler/src/iree/compiler/Codegen/LLVMGPU/test/ROCDL/config_tile_and_fuse.mlir

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,27 +216,21 @@ module {
216216

217217
// -----
218218

219-
module {
220-
func.func @matmul_dynamic_dim(%11: tensor<?x256xf16>, %12: tensor<256x256xf16>) -> tensor<?x256xf32> {
221-
%c0 = arith.constant 0 : index
222-
%cst = arith.constant 0.000000e+00 : f32
223-
%8 = tensor.dim %11, %c0 : tensor<?x256xf16>
224-
%13 = tensor.empty(%8) : tensor<?x256xf32>
225-
%14 = linalg.fill ins(%cst : f32) outs(%13 : tensor<?x256xf32>) -> tensor<?x256xf32>
226-
%15 = linalg.matmul ins(%11, %12 : tensor<?x256xf16>, tensor<256x256xf16>) outs(%14 : tensor<?x256xf32>) -> tensor<?x256xf32>
227-
return %15 : tensor<?x256xf32>
228-
}
219+
func.func @matmul_dynamic_M(%arg0: tensor<?x256xf32>, %arg1: tensor<256x256xf32>, %arg2: tensor<?x256xf32>, %arg3: !iree_tensor_ext.dispatch.tensor<readwrite:tensor<?x256xf32>>, %arg4 : index) {
220+
%0 = linalg.matmul ins(%arg0, %arg1 : tensor<?x256xf32>, tensor<256x256xf32>) outs(%arg2 : tensor<?x256xf32>) -> tensor<?x256xf32>
221+
iree_tensor_ext.dispatch.tensor.store %0, %arg3, offsets = [0, 0], sizes = [%arg4, 256], strides = [1, 1] : tensor<?x256xf32> -> !iree_tensor_ext.dispatch.tensor<readwrite:tensor<?x256xf32>>{%arg4}
222+
return
229223
}
230224

231-
// CHECK-LABEL: func.func @matmul_dynamic_dim
225+
// CHECK-LABEL: func.func @matmul_dynamic_M
232226
// CHECK-SAME: #iree_codegen.translation_info<pipeline = LLVMGPUTileAndFuse workgroup_size = [64, 1, 1] subgroup_size = 64>
233227
// CHECK: linalg.matmul {{.*}}lowering_config = #iree_gpu.lowering_config
234228
// CHECK-SAME: promote_operands = [0, 1]
235229
// CHECK-SAME: reduction = [0, 0, 4]
236230
// CHECK-SAME: thread = [1, 4, 0]
237231
// CHECK-SAME: workgroup = [1, 256, 0]
238232

239-
// LATE: LLVMGPUWarpReduction
233+
// LATE: LLVMGPUVectorDistribute
240234

241235
// -----
242236

0 commit comments

Comments
 (0)