[Mlir-commits] [mlir] [mlir] Add optimization attrs for gpu-to-llvmspv function declarations (PR #99301)

Victor Perez llvmlistbot at llvm.org
Thu Jul 18 01:18:15 PDT 2024


================
@@ -4,16 +4,66 @@
 // RUN: | FileCheck --check-prefixes=CHECK-32,CHECK %s
 
 gpu.module @builtins {
-  // CHECK-64:    llvm.func spir_funccc @_Z14get_num_groupsj(i32) -> i64
-  // CHECK-64:    llvm.func spir_funccc @_Z12get_local_idj(i32) -> i64
-  // CHECK-64:    llvm.func spir_funccc @_Z14get_local_sizej(i32) -> i64
-  // CHECK-64:    llvm.func spir_funccc @_Z13get_global_idj(i32) -> i64
-  // CHECK-64:    llvm.func spir_funccc @_Z12get_group_idj(i32) -> i64
-  // CHECK-32:    llvm.func spir_funccc @_Z14get_num_groupsj(i32) -> i32
-  // CHECK-32:    llvm.func spir_funccc @_Z12get_local_idj(i32) -> i32
-  // CHECK-32:    llvm.func spir_funccc @_Z14get_local_sizej(i32) -> i32
-  // CHECK-32:    llvm.func spir_funccc @_Z13get_global_idj(i32) -> i32
-  // CHECK-32:    llvm.func spir_funccc @_Z12get_group_idj(i32) -> i32
+  // CHECK-64:        llvm.func spir_funccc @_Z14get_num_groupsj(i32) -> i64 attributes {
+  // CHECK-64-SAME-DAG:  memory = #llvm.memory_effects<other = none, argMem = none, inaccessibleMem = none>
+  // CHECK-64-SAME-DAG:  no_unwind
+  // CHECK-64-SAME-DAG:  will_return
+  // CHECK-64-NOT:       convergent
+  // CHECK-64-SAME:      }
----------------
victor-eds wrote:

```suggestion
  // CHECK-64:      llvm.func spir_funccc @_Z14get_num_groupsj(i32) -> i64
  // CHECK-32:      llvm.func spir_funccc @_Z14get_num_groupsj(i32) -> i32
  // CHECK:           attributes {
  // CHECK-SAME-DAG:  memory = #llvm.memory_effects<other = none, argMem = none, inaccessibleMem = none>
  // CHECK-SAME-DAG:  no_unwind
  // CHECK-SAME-DAG:  will_return
  // CHECK-NOT:       convergent
  // CHECK-SAME:      }
```
Little trick to merge both cases. Apply to all. `CHECK` does not require different lines.

https://github.com/llvm/llvm-project/pull/99301


More information about the Mlir-commits mailing list