Skip to content

Commit 9110630

Browse files
committed
add test
1 parent 8b5827f commit 9110630

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

mlir/test/Dialect/GPU/outlining.mlir

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,3 +508,24 @@ func.func @launch_cluster() {
508508
// CHECK-NEXT: "some_op"(%[[CID]], %[[BID]], %[[BDIM]]) : (index, index, index) -> ()
509509
// CHECK-NEXT: = memref.load %[[KERNEL_ARG1]][%[[TID]]] : memref<?xf32, 1>
510510

511+
// -----
512+
// This test tests the two optional attributes kernelModule and kernelFunc for gpu.launch
513+
// CHECK-LABEL: func.func @testKernelAttributes()
514+
// CHECK: gpu.launch_func @test_module::@test_kernel_func blocks in (%[[GRID_X:.*]], %[[GRID_Y:.*]], %[[GRID_Z:.*]]) threads in (%[[BLOCK_X:.*]], %[[BLOCK_Y:.*]], %[[BLOCK_Z:.*]])
515+
// CHECK: gpu.module @test_module
516+
// CHECK: gpu.func @test_kernel_func()
517+
func.func @testKernelAttributes() {
518+
%gDimX = arith.constant 8 : index
519+
%gDimY = arith.constant 12 : index
520+
%gDimZ = arith.constant 16 : index
521+
%bDimX = arith.constant 32 : index
522+
%bDimY = arith.constant 16 : index
523+
%bDimZ = arith.constant 8 : index
524+
525+
gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %gDimX, %grid_y = %gDimY, %grid_z = %gDimZ)
526+
threads(%tx, %ty, %tz) in (%block_x = %bDimX, %block_y = %bDimY, %block_z = %bDimZ) {
527+
"some_op"(%bx, %tx) : (index, index) -> ()
528+
gpu.terminator
529+
} {kernelModule = @test_module, kernelFunc = @test_kernel_func}
530+
return
531+
}

0 commit comments

Comments
 (0)