[Mlir-commits] [mlir] [mlir][gpu]add AffineScope to gpu.func op. (PR #118010)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Fri Nov 29 00:09:26 PST 2024
================
@@ -298,3 +298,29 @@ func.func @linearize_mixed(%index0: index, %index1: index, %index2: index, %basi
%1 = affine.linearize_index disjoint [%index0, %index1, %index2] by (2, %basis1, 3) : index
return %1 : index
}
+
+// -----
+
+#map = affine_map<()[s0] -> (s0)>
+
+// CHECK-LABEL: @gpu_affine_for
+
+module attributes {gpu.container_module} {
+ gpu.module @gpu {
+ gpu.func @gpu_affine_for(%arg0: memref<?x?xf32>) kernel {
+ %c3 = arith.constant 1 : index
+ %dim = memref.dim %arg0, %c3 : memref<?x?xf32>
+ %c0 = arith.constant 0 : index
+ affine.for %arg3 = %c0 to #map()[%dim] step 32 {
+ }
+ gpu.return
+ }
+ }
+}
+// CHECK-SAME: (%[[VAL_0:.*]]: memref<?x?xf32>) kernel {
+// CHECK: %[[VAL_1:.*]] = arith.constant 1 : index
+// CHECK: %[[VAL_2:.*]] = memref.dim %[[VAL_0]], %[[VAL_1]] : memref<?x?xf32>
+// CHECK: %[[VAL_3:.*]] = arith.constant 0 : index
+// CHECK: affine.for %[[VAL_4:.*]] = %[[VAL_3]] to %[[VAL_2]] step 32 {
+// CHECK: }
+// CHECK: gpu.return
----------------
ftynse wrote:
Please configure your editor to keep the trailing newline.
https://github.com/llvm/llvm-project/pull/118010
More information about the Mlir-commits
mailing list