[mlir][gpu] NFC: Change gpu.launch_func ops to custom format.
authorChristian Sigg <csigg@google.com>
Thu, 29 Oct 2020 18:16:19 +0000 (19:16 +0100)
committerChristian Sigg <csigg@google.com>
Thu, 29 Oct 2020 20:21:30 +0000 (21:21 +0100)
This should fix the reason for the failures after ec7780ebdab480139596c3cb08ee77d7035457b3. I will roll forward in a separate change.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D90410

mlir/test/Conversion/SPIRVToLLVM/lower-host-to-llvm-calls.mlir
mlir/test/mlir-spirv-cpu-runner/double.mlir
mlir/test/mlir-spirv-cpu-runner/simple_add.mlir

index 176d860..dd557d1 100644 (file)
@@ -40,9 +40,8 @@ module attributes {gpu.container_module, spv.target_env = #spv.target_env<#spv.v
   func @main() {
     %buffer = alloc() : memref<6xi32>
     %one = constant 1 : index
-    "gpu.launch_func"(%one, %one, %one,
-                      %one, %one, %one,
-                      %buffer) {kernel = @foo::@bar} : (index, index, index, index, index, index, memref<6xi32>) -> ()
+    gpu.launch_func @foo::@bar blocks in (%one, %one, %one)
+        threads in (%one, %one, %one) args(%buffer : memref<6xi32>)
     return
   }
 }
index 8251375..77a07b4 100644 (file)
@@ -54,10 +54,9 @@ module attributes {
     call @fillI32Buffer(%output_casted, %zero) : (memref<?xi32>, i32) -> ()
 
     %one = constant 1 : index
-    "gpu.launch_func"(%one, %one, %one,
-                      %one, %one, %one,
-                      %input, %output) { kernel = @kernels::@double }
-        : (index, index, index, index, index, index, memref<6xi32>, memref<6xi32>) -> ()
+    gpu.launch_func @kernels::@double
+        blocks in (%one, %one, %one) threads in (%one, %one, %one)
+        args(%input : memref<6xi32>, %output : memref<6xi32>)
     %result = memref_cast %output : memref<6xi32> to memref<*xi32>
     call @print_memref_i32(%result) : (memref<*xi32>) -> ()
     return
index 476c459..18b6390 100644 (file)
@@ -47,10 +47,9 @@ module attributes {
     call @fillF32Buffer3D(%output_casted, %0) : (memref<?x?x?xf32>, f32) -> ()
 
     %one = constant 1 : index
-    "gpu.launch_func"(%one, %one, %one,
-                      %one, %one, %one,
-                      %input1, %input2, %output) { kernel = @kernels::@sum }
-        : (index, index, index, index, index, index, memref<3xf32>, memref<3x3xf32>, memref<3x3x3xf32>) -> ()
+    gpu.launch_func @kernels::@sum
+        blocks in (%one, %one, %one) threads in (%one, %one, %one)
+        args(%input1 : memref<3xf32>, %input2 : memref<3x3xf32>, %output : memref<3x3x3xf32>)
     %result = memref_cast %output : memref<3x3x3xf32> to memref<*xf32>
     call @print_memref_f32(%result) : (memref<*xf32>) -> ()
     return