Skip to content

Commit 12e2e4a

Browse files
update test and update op define,.
1 parent 989e3d6 commit 12e2e4a

File tree

2 files changed

+8
-37
lines changed

2 files changed

+8
-37
lines changed

mlir/include/mlir/Dialect/GPU/IR/GPUOps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,9 @@ def GPU_LaunchFuncOp :GPU_Op<"launch_func", [
794794
}
795795

796796
def GPU_LaunchOp : GPU_Op<"launch", [
797-
AutomaticAllocationScope, AttrSizedOperandSegments, GPU_AsyncOpInterface,
797+
AffineScope, AutomaticAllocationScope, AttrSizedOperandSegments,
798798
DeclareOpInterfaceMethods<InferIntRangeInterface, ["inferResultRanges"]>,
799-
RecursiveMemoryEffects, AffineScope]>,
799+
GPU_AsyncOpInterface, RecursiveMemoryEffects]>,
800800
Arguments<(ins Variadic<GPU_AsyncToken>:$asyncDependencies,
801801
Index:$gridSizeX, Index:$gridSizeY, Index:$gridSizeZ,
802802
Index:$blockSizeX, Index:$blockSizeY, Index:$blockSizeZ,

mlir/test/Dialect/Affine/ops.mlir

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -301,34 +301,11 @@ func.func @linearize_mixed(%index0: index, %index1: index, %index2: index, %basi
301301

302302
// -----
303303

304-
#map = affine_map<()[s0] -> (s0)>
305-
306-
// CHECK-LABEL: @gpu_affine_for
307-
308-
module attributes {gpu.container_module} {
309-
gpu.module @gpu {
310-
gpu.func @gpu_affine_for(%arg0: memref<?x?xf32>) kernel {
311-
%c3 = arith.constant 1 : index
312-
%dim = memref.dim %arg0, %c3 : memref<?x?xf32>
313-
%c0 = arith.constant 0 : index
314-
affine.for %arg3 = %c0 to #map()[%dim] step 32 {
315-
}
316-
gpu.return
317-
}
318-
}
319-
}
320-
// CHECK-SAME: (%[[VAL_0:.*]]: memref<?x?xf32>) kernel {
321-
// CHECK: %[[VAL_1:.*]] = arith.constant 1 : index
322-
// CHECK: %[[VAL_2:.*]] = memref.dim %[[VAL_0]], %[[VAL_1]] : memref<?x?xf32>
323-
// CHECK: %[[VAL_3:.*]] = arith.constant 0 : index
324-
// CHECK: affine.for %{{.*}} = %[[VAL_3]] to %[[VAL_2]] step 32 {
325-
// CHECK: }
326-
// CHECK: gpu.return
327-
328-
// -----
329-
330304
// CHECK-LABEL: @gpu_launch_affine
331305

306+
// Test `thread_id` in AffineScope, the `thread_id` is in AffineScope's toplevel,
307+
// it is a valid symbol.
308+
332309
module {
333310
func.func @gpu_launch_affine() {
334311
%c1 = arith.constant 1 : index
@@ -344,15 +321,9 @@ module {
344321
}
345322
}
346323

347-
// CHECK-NEXT: %[[VAL_0:.*]] = arith.constant 1 : index
348-
// CHECK-NEXT: gpu.launch blocks(%[[VAL_1:.*]], %[[VAL_2:.*]], %[[VAL_3:.*]]) in (%[[VAL_4:.*]] = %[[VAL_0]], %[[VAL_5:.*]] = %[[VAL_0]], %[[VAL_6:.*]] = %[[VAL_0]]) threads(%[[VAL_7:.*]], %[[VAL_8:.*]], %[[VAL_9:.*]]) in (%[[VAL_10:.*]] = %[[VAL_0]], %[[VAL_11:.*]] = %[[VAL_0]], %[[VAL_12:.*]] = %[[VAL_0]]) {
349-
// CHECK-NEXT: %[[VAL_13:.*]] = gpu.thread_id x
350-
// CHECK-NEXT: %[[VAL_14:.*]] = arith.constant 128 : index
351-
// CHECK-NEXT: affine.for %{{.*}} = %[[VAL_13]] to %[[VAL_14]] step 8 {
352-
// CHECK-NEXT: }
353-
// CHECK-NEXT: gpu.terminator
354-
// CHECK-NEXT: }
355-
// CHECK-NEXT: return
324+
// CHECK: %[[THREAD_ID:.*]] = gpu.thread_id x
325+
// CHECK: %[[VAL:.*]] = arith.constant 128 : index
326+
// CHECK: affine.for %{{.*}} = %[[THREAD_ID]] to %[[VAL]] step 8 {
356327

357328
// -----
358329

0 commit comments

Comments
 (0)