Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix filecheck #668

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions test/Conversion/GPUToGPUX/gpux-alloc-dealloc.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ func.func @main() attributes {llvm.emit_c_interface} {
%c8 = arith.constant 8 : index
%c1 = arith.constant 1 : index
// CHECK: %[[STREAM:.*]] = "gpux.create_stream"() : () -> !gpux.StreamType
// CHECK: %[[ALLOC_0:.*]] = "gpux.alloc"(%[[STREAM:.*]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
// CHECK: %[[ALLOC_0:.*]] = "gpux.alloc"(%[[STREAM]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
%memref = gpu.alloc () : memref<8xf32>
// CHECK: %[[ALLOC_1:.*]] = "gpux.alloc"(%[[STREAM:.*]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
// CHECK: %[[ALLOC_1:.*]] = "gpux.alloc"(%[[STREAM]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
%memref_1 = gpu.alloc () : memref<8xf32>
// CHECK: %[[ALLOC_2:.*]] = "gpux.alloc"(%[[STREAM:.*]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
// CHECK: %[[ALLOC_2:.*]] = "gpux.alloc"(%[[STREAM]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
%memref_2 = gpu.alloc () : memref<8xf32>
// CHECK: "gpux.dealloc"(%[[STREAM:.*]], %[[ALLOC_0:.*]]) : (!gpux.StreamType, memref<8xf32>) -> ()
// CHECK: "gpux.dealloc"(%[[STREAM]], %[[ALLOC_0]]) : (!gpux.StreamType, memref<8xf32>) -> ()
gpu.dealloc %memref : memref<8xf32>
// CHECK: "gpux.dealloc"(%[[STREAM:.*]], %[[ALLOC_1:.*]]) : (!gpux.StreamType, memref<8xf32>) -> ()
// CHECK: "gpux.dealloc"(%[[STREAM]], %[[ALLOC_1]]) : (!gpux.StreamType, memref<8xf32>) -> ()
gpu.dealloc %memref_1 : memref<8xf32>
// CHECK: "gpux.dealloc"(%[[STREAM:.*]], %[[ALLOC_2:.*]]) : (!gpux.StreamType, memref<8xf32>) -> ()
// CHECK: "gpux.dealloc"(%[[STREAM]], %[[ALLOC_2]]) : (!gpux.StreamType, memref<8xf32>) -> ()
gpu.dealloc %memref_2 : memref<8xf32>
// CHECK: "gpux.destroy_stream"(%[[STREAM:.*]]) : (!gpux.StreamType) -> ()
// CHECK: "gpux.destroy_stream"(%[[STREAM]]) : (!gpux.StreamType) -> ()
return
}
10 changes: 5 additions & 5 deletions test/Conversion/GPUToGPUX/gpux-launch-func.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ func.func @main() attributes {llvm.emit_c_interface} {
// CHECK: %[[C1:.*]] = arith.constant 1 : index
// CHECK: %[[C8:.*]] = arith.constant 8 : index
// CHECK: %[[STREAM:.*]] = "gpux.create_stream"() : () -> !gpux.StreamType
// CHECK: %[[ALLOC_0:.*]] = "gpux.alloc"(%[[STREAM:.*]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
// CHECK: %[[ALLOC_0:.*]] = "gpux.alloc"(%[[STREAM]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
%memref = gpu.alloc () : memref<8xf32>
// CHECK: %[[ALLOC_1:.*]] = "gpux.alloc"(%[[STREAM:.*]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
// CHECK: %[[ALLOC_1:.*]] = "gpux.alloc"(%[[STREAM]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
%memref_1 = gpu.alloc () : memref<8xf32>
// CHECK: %[[ALLOC_2:.*]] = "gpux.alloc"(%[[STREAM:.*]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
// CHECK: %[[ALLOC_2:.*]] = "gpux.alloc"(%[[STREAM]]) <{operandSegmentSizes = array<i32: 0, 1, 0, 0>}> : (!gpux.StreamType) -> memref<8xf32>
%memref_2 = gpu.alloc () : memref<8xf32>
// CHECK: "gpux.launch_func"(%[[STREAM:.*]], %[[C8:.*]], %[[C1:.*]], %[[C1:.*]], %[[C1:.*]], %[[C1:.*]], %[[C1:.*]], %[[ALLOC_0:.*]], %[[ALLOC_1:.*]], %[[ALLOC_2:.*]]) <{kernel = @Kernels::@kernel_1, operandSegmentSizes = array<i32: 0, 1, 1, 1, 1, 1, 1, 1, 0, 3>}> : (!gpux.StreamType, index, index, index, index, index, index, memref<8xf32>, memref<8xf32>, memref<8xf32>) -> ()
// CHECK: "gpux.launch_func"(%[[STREAM]], %[[C8]], %[[C1]], %[[C1]], %[[C1]], %[[C1]], %[[C1]], %[[ALLOC_0]], %[[ALLOC_1]], %[[ALLOC_2]]) <{kernel = @Kernels::@kernel_1, operandSegmentSizes = array<i32: 0, 1, 1, 1, 1, 1, 1, 1, 0, 3>}> : (!gpux.StreamType, index, index, index, index, index, index, memref<8xf32>, memref<8xf32>, memref<8xf32>) -> ()
gpu.launch_func @Kernels::@kernel_1 blocks in (%c8, %c1, %c1) threads in (%c1, %c1, %c1) args(%memref : memref<8xf32>, %memref_1 : memref<8xf32>, %memref_2 : memref<8xf32>)
gpu.dealloc %memref : memref<8xf32>
gpu.dealloc %memref_1 : memref<8xf32>
gpu.dealloc %memref_2 : memref<8xf32>
// CHECK: "gpux.destroy_stream"(%[[STREAM:.*]]) : (!gpux.StreamType) -> ()
// CHECK: "gpux.destroy_stream"(%[[STREAM]]) : (!gpux.StreamType) -> ()
return
}

Expand Down
2 changes: 1 addition & 1 deletion test/Conversion/GPUToGPUX/gpux-memcpy.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
func.func @memcpy(%dst : memref<3x7xf32>, %src : memref<3x7xf32, 1>) {
// CHECK-LABEL: func @memcpy
// CHECK: %[[STREAM:.*]] = "gpux.create_stream"() : () -> !gpux.StreamType
// CHECK: "gpux.memcpy"(%[[STREAM:.*]], {{.*}}, {{.*}}) : (!gpux.StreamType, memref<3x7xf32>, memref<3x7xf32, 1>) -> ()
// CHECK: "gpux.memcpy"(%[[STREAM]], {{.*}}, {{.*}}) : (!gpux.StreamType, memref<3x7xf32>, memref<3x7xf32, 1>) -> ()
gpu.memcpy %dst, %src : memref<3x7xf32>, memref<3x7xf32, 1>
// CHECK: "gpux.destroy_stream"(%0) : (!gpux.StreamType) -> ()
return
Expand Down
2 changes: 1 addition & 1 deletion test/Conversion/GPUToGPUX/gpux-memset.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
func.func @memset(%dst : memref<3x7xf32>, %value : f32) {
// CHECK-LABEL: func @memset
// CHECK: %[[STREAM:.*]] = "gpux.create_stream"() : () -> !gpux.StreamType
// CHECK: "gpux.memset"(%[[STREAM:.*]], {{.*}}, {{.*}}) : (!gpux.StreamType, memref<3x7xf32>, f32) -> ()
// CHECK: "gpux.memset"(%[[STREAM]], {{.*}}, {{.*}}) : (!gpux.StreamType, memref<3x7xf32>, f32) -> ()
gpu.memset %dst, %value : memref<3x7xf32>, f32
// CHECK: "gpux.destroy_stream"(%0) : (!gpux.StreamType) -> ()
return
Expand Down
6 changes: 3 additions & 3 deletions test/Conversion/GPUXToLLVM/alloc-dealloc-to-gpu-runtime.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ module attributes {gpu.container_module}{
func.func @main() attributes {llvm.emit_c_interface} {
// CHECK: %[[DEVICE:.*]] = llvm.mlir.zero : !llvm.ptr<i8>
// CHECK: %[[CONTEXT:.*]] = llvm.mlir.zero : !llvm.ptr<i8>
// CHECK: %[[STREAM:.*]] = llvm.call @gpuCreateStream(%[[DEVICE:.*]], %[[CONTEXT:.*]]) : (!llvm.ptr<i8>, !llvm.ptr<i8>) -> !llvm.ptr<i8>
// CHECK: %[[STREAM:.*]] = llvm.call @gpuCreateStream(%[[DEVICE]], %[[CONTEXT]]) : (!llvm.ptr<i8>, !llvm.ptr<i8>) -> !llvm.ptr<i8>
%0 = "gpux.create_stream"() : () -> !gpux.StreamType
// CHECK: llvm.call @gpuMemAlloc(%[[stream:.*]], %{{.*}}, %{{.*}}, %{{.*}}) : (!llvm.ptr<i8>, i64, i64, i32) -> !llvm.ptr<i8>
// CHECK: llvm.call @gpuMemAlloc(%[[STREAM]], %{{.*}}, %{{.*}}, %{{.*}}) : (!llvm.ptr<i8>, i64, i64, i32) -> !llvm.ptr<i8>
%memref = "gpux.alloc"(%0) {operandSegmentSizes = array<i32: 0, 1, 0, 0>} : (!gpux.StreamType) -> memref<8xf32>
// CHECK: llvm.call @gpuMemFree(%[[stream:.*]], %{{.*}}) : (!llvm.ptr<i8>, !llvm.ptr<i8>) -> ()
// CHECK: llvm.call @gpuMemFree(%[[STREAM]], %{{.*}}) : (!llvm.ptr<i8>, !llvm.ptr<i8>) -> ()
"gpux.dealloc"(%0, %memref) : (!gpux.StreamType, memref<8xf32>) -> ()
"gpux.destroy_stream"(%0) : (!gpux.StreamType) -> ()
return
Expand Down
4 changes: 2 additions & 2 deletions test/Conversion/GPUXToLLVM/create-destroy-stream.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module attributes {gpu.container_module}{
func.func @main() attributes {llvm.emit_c_interface} {
// CHECK: %[[DEVICE:.*]] = llvm.mlir.zero : !llvm.ptr<i8>
// CHECK: %[[CONTEXT:.*]] = llvm.mlir.zero : !llvm.ptr<i8>
// CHECK: %[[STREAM:.*]] = llvm.call @gpuCreateStream(%[[DEVICE:.*]], %[[CONTEXT:.*]]) : (!llvm.ptr<i8>, !llvm.ptr<i8>) -> !llvm.ptr<i8>
// CHECK: %[[STREAM:.*]] = llvm.call @gpuCreateStream(%[[DEVICE]], %[[CONTEXT]]) : (!llvm.ptr<i8>, !llvm.ptr<i8>) -> !llvm.ptr<i8>
%0 = "gpux.create_stream"() : () -> !gpux.StreamType
// CHECK: llvm.call @gpuStreamDestroy(%[[STREAM:.*]]) : (!llvm.ptr<i8>) -> ()
// CHECK: llvm.call @gpuStreamDestroy(%[[STREAM]]) : (!llvm.ptr<i8>) -> ()
"gpux.destroy_stream"(%0) : (!gpux.StreamType) -> ()
return
}
Expand Down
8 changes: 4 additions & 4 deletions test/Conversion/GPUXToLLVM/launch-func-to-gpu-runtime.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ module attributes {gpu.container_module, spirv.target_env = #spirv.target_env<#s
%c8 = arith.constant 8 : index
// CHECK: %[[DEVICE:.*]] = llvm.mlir.zero : !llvm.ptr<i8>
// CHECK: %[[CONTEXT:.*]] = llvm.mlir.zero : !llvm.ptr<i8>
// CHECK: %[[STREAM:.*]] = llvm.call @gpuCreateStream(%[[DEVICE:.*]], %[[CONTEXT:.*]]) : (!llvm.ptr<i8>, !llvm.ptr<i8>) -> !llvm.ptr<i8>
// CHECK: %[[STREAM:.*]] = llvm.call @gpuCreateStream(%[[DEVICE]], %[[CONTEXT]]) : (!llvm.ptr<i8>, !llvm.ptr<i8>) -> !llvm.ptr<i8>
%0 = "gpux.create_stream"() : () -> !gpux.StreamType
%memref = "gpux.alloc"(%0) {operandSegmentSizes = array<i32: 0, 1, 0, 0>} : (!gpux.StreamType) -> memref<8xf32>
%memref_0 = "gpux.alloc"(%0) {operandSegmentSizes = array<i32: 0, 1, 0, 0>} : (!gpux.StreamType) -> memref<8xf32>
%memref_1 = "gpux.alloc"(%0) {operandSegmentSizes = array<i32: 0, 1, 0, 0>} : (!gpux.StreamType) -> memref<8xf32>

// CHECK: llvm.mlir.addressof @Kernels_spirv_binary : !llvm.ptr<array<552 x i8>>
// CHECK: %[[MODULE:.*]] = llvm.call @gpuModuleLoad(%[[STREAM:.*]], %{{.*}}, %{{.*}}) : (!llvm.ptr<i8>, !llvm.ptr<i8>, i64) -> !llvm.ptr<i8>
// CHECK: %[[MODULE:.*]] = llvm.call @gpuModuleLoad(%[[STREAM]], %{{.*}}, %{{.*}}) : (!llvm.ptr<i8>, !llvm.ptr<i8>, i64) -> !llvm.ptr<i8>
// CHECK: llvm.mlir.addressof @Kernels_kernel_1_kernel_name : !llvm.ptr<array<9 x i8>>
// CHECK: %[[KERNEL:.*]] = llvm.call @gpuKernelGet(%[[STREAM:.*]], %[[MODULE:.*]], %{{.*}}) : (!llvm.ptr<i8>, !llvm.ptr<i8>, !llvm.ptr<i8>) -> !llvm.ptr<i8>
// CHECK: llvm.call @gpuLaunchKernel(%[[STREAM:.*]], %[[KERNEL:.*]], %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!llvm.ptr<i8>, !llvm.ptr<i8>, i64, i64, i64, i64, i64, i64, i32, !llvm.ptr<struct<(ptr<i8>, i64)>>) -> ()
// CHECK: %[[KERNEL:.*]] = llvm.call @gpuKernelGet(%[[STREAM]], %[[MODULE]], %{{.*}}) : (!llvm.ptr<i8>, !llvm.ptr<i8>, !llvm.ptr<i8>) -> !llvm.ptr<i8>
// CHECK: llvm.call @gpuLaunchKernel(%[[STREAM]], %[[KERNEL]], %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!llvm.ptr<i8>, !llvm.ptr<i8>, i64, i64, i64, i64, i64, i64, i32, !llvm.ptr<struct<(ptr<i8>, i64)>>) -> ()
"gpux.launch_func"(%0, %c8, %c1, %c1, %c1, %c1, %c1, %memref, %memref_0, %memref_1) {kernel = @Kernels::@kernel_1, operandSegmentSizes = array<i32: 0, 1, 1, 1, 1, 1, 1, 1, 0, 3>} : (!gpux.StreamType, index, index, index, index, index, index, memref<8xf32>, memref<8xf32>, memref<8xf32>) -> ()
"gpux.dealloc"(%0, %memref) : (!gpux.StreamType, memref<8xf32>) -> ()
"gpux.dealloc"(%0, %memref_0) : (!gpux.StreamType, memref<8xf32>) -> ()
Expand Down
22 changes: 11 additions & 11 deletions test/Transforms/BF16ToGPU/BroadcastNonNumpy.bf16.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ module @broadcast_non_numpy attributes {gpu.container_module} {
%c1 = arith.constant 1 : index
// CHECK: %[[MEMREF:.*]] = gpu.alloc host_shared () : memref<6xi8>
// CHECK: %[[VIEW:.*]] = memref.view %memref[%[[CONST0:.*]]][] : memref<6xi8> to memref<3xbf16>
// CHECK: %[[VIEW0:.*]] = memref.view %memref[%[[CONST0:.*]]][] : memref<6xi8> to memref<3xi16>
// CHECK: memref.copy %arg0, %[[VIEW:.*]] : memref<3xbf16> to memref<3xbf16>
// CHECK: %[[VIEW0:.*]] = memref.view %memref[%[[CONST0]]][] : memref<6xi8> to memref<3xi16>
// CHECK: memref.copy %arg0, %[[VIEW]] : memref<3xbf16> to memref<3xbf16>
%memref = gpu.alloc host_shared () : memref<3xbf16>
memref.copy %arg0, %memref : memref<3xbf16> to memref<3xbf16>
// CHECK: %[[MEMREF1:.*]] = gpu.alloc () : memref<24xi8>
// CHECK: %[[VIEW2:.*]] = memref.view %[[MEMREF1:.*]][%[[CONST0:.*]]][] : memref<24xi8> to memref<3x4xi16>
// CHECK: %[[VIEW2:.*]] = memref.view %[[MEMREF1]][%[[CONST0]]][] : memref<24xi8> to memref<3x4xi16>
%memref_0 = gpu.alloc () : memref<3x4xbf16>
// CHECK: gpu.launch_func @test_kernel::@test_kernel blocks in (%[[CONST3:.*]], %[[CONST4:.*]], %[[CONST1:.*]]) threads in (%[[CONST1:.*]], %[[CONST1:.*]], %[[CONST1:.*]]) args(%[[CONST0_I16:.*]] : i16, %[[VIEW2:.*]] : memref<3x4xi16>)
// CHECK: gpu.launch_func @test_kernel::@test_kernel blocks in (%[[CONST3:.*]], %[[CONST4:.*]], %[[CONST1:.*]]) threads in (%[[CONST1]], %[[CONST1]], %[[CONST1]]) args(%[[CONST0_I16:.*]] : i16, %[[VIEW2]] : memref<3x4xi16>)
gpu.launch_func @test_kernel::@test_kernel blocks in (%c3, %c4, %c1) threads in (%c1, %c1, %c1) args(%cst : bf16, %memref_0 : memref<3x4xbf16>)
// CHECK: %[[MEMREF3:.*]] = gpu.alloc host_shared () : memref<24xi8>
// CHECK: %[[VIEW4:.*]] = memref.view %[[MEMREF3:.*]][%[[CONST0:.*]]][] : memref<24xi8> to memref<3x4xbf16>
// CHECK: %[[VIEW5:.*]] = memref.view %[[MEMREF3:.*]][%[[CONST0:.*]]][] : memref<24xi8> to memref<3x4xi16>
// CHECK: %[[VIEW4:.*]] = memref.view %[[MEMREF3]][%[[CONST0]]][] : memref<24xi8> to memref<3x4xbf16>
// CHECK: %[[VIEW5:.*]] = memref.view %[[MEMREF3]][%[[CONST0]]][] : memref<24xi8> to memref<3x4xi16>
%memref_1 = gpu.alloc host_shared () : memref<3x4xbf16>
// CHECK: gpu.launch_func @test_kernel_0::@test_kernel blocks in (%[[CONST3:.*]], %[[CONST4:.*]], %[[CONST1:.*]]) threads in (%[[CONST1:.*]], %[[CONST1:.*]], %[[CONST1:.*]]) args(%[[VIEW0:.*]] : memref<3xi16>, %[[VIEW5:.*]] : memref<3x4xi16>)
// CHECK: gpu.launch_func @test_kernel_0::@test_kernel blocks in (%[[CONST3]], %[[CONST4]], %[[CONST1]]) threads in (%[[CONST1]], %[[CONST1]], %[[CONST1]]) args(%[[VIEW0]] : memref<3xi16>, %[[VIEW5]] : memref<3x4xi16>)
gpu.launch_func @test_kernel_0::@test_kernel blocks in (%c3, %c4, %c1) threads in (%c1, %c1, %c1) args(%memref : memref<3xbf16>, %memref_1 : memref<3x4xbf16>)
// CHECK: gpu.dealloc %[[MEMREF1:.*]] : memref<24xi8>
// CHECK: gpu.dealloc %[[MEMREF1]] : memref<24xi8>
gpu.dealloc %memref_0 : memref<3x4xbf16>
// CHECK: gpu.dealloc %[[MEMREF:.*]] : memref<6xi8>
// CHECK: gpu.dealloc %[[MEMREF]] : memref<6xi8>
gpu.dealloc %memref : memref<3xbf16>
// CHECK: return %[[VIEW4:.*]] : memref<3x4xbf16>
// CHECK: return %[[VIEW4]] : memref<3x4xbf16>
return %memref_1 : memref<3x4xbf16>
}
gpu.module @test_kernel attributes {spirv.target_env = #spirv.target_env<#spirv.vce<v1.0, [Addresses, Float16Buffer, Int64, Int16, Int8, Kernel, Linkage, Vector16, GenericPointer, Groups, Float16, Float64, AtomicFloat32AddEXT, ExpectAssumeKHR], [SPV_EXT_shader_atomic_float_add, SPV_KHR_expect_assume]>, api=OpenCL, #spirv.resource_limits<>>} {
Expand All @@ -48,7 +48,7 @@ module @broadcast_non_numpy attributes {gpu.container_module} {
%0 = gpu.block_id x
%1 = gpu.block_id y
// CHECK: %[[VAR2_2:.*]] = memref.load %arg0[%[[VAR0_2:.*]]] : memref<3xi16>
// CHECK: memref.store %[[VAR2_2:.*]], %arg1[%[[VAR0_2:.*]], %[[VAR1_2:.*]]] : memref<3x4xi16>
// CHECK: memref.store %[[VAR2_2]], %arg1[%[[VAR0_2]], %[[VAR1_2:.*]]] : memref<3x4xi16>
%2 = memref.load %arg0[%0] : memref<3xbf16>
memref.store %2, %arg1[%0, %1] : memref<3x4xbf16>
gpu.return
Expand Down
42 changes: 21 additions & 21 deletions test/Transforms/BF16ToGPU/EltwiseAdd.bf16.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ module @eltwise_add attributes {gpu.container_module} {
%c10 = arith.constant 10 : index
%c1 = arith.constant 1 : index
// CHECK: %[[MEMREF:.*]] = gpu.alloc host_shared () : memref<400xi8>
// CHECK: %[[VIEW:.*]] = memref.view %[[MEMREF:.*]][%[[CONST0:.*]]][] : memref<400xi8> to memref<10x20xbf16>
// CHECK: %[[VIEW_0:.*]] = memref.view %[[MEMREF:.*]][%[[CONST0:.*]]][] : memref<400xi8> to memref<10x20xi16>
// CHECK: memref.copy %arg1, %[[VIEW:.*]] : memref<10x20xbf16> to memref<10x20xbf16>
// CHECK: %[[VIEW:.*]] = memref.view %[[MEMREF]][%[[CONST0:.*]]][] : memref<400xi8> to memref<10x20xbf16>
// CHECK: %[[VIEW_0:.*]] = memref.view %[[MEMREF]][%[[CONST0]]][] : memref<400xi8> to memref<10x20xi16>
// CHECK: memref.copy %arg1, %[[VIEW]] : memref<10x20xbf16> to memref<10x20xbf16>
%memref = gpu.alloc host_shared () : memref<10x20xbf16>
memref.copy %arg1, %memref : memref<10x20xbf16> to memref<10x20xbf16>
// CHECK: %[[MEMREF_1:.*]] = gpu.alloc host_shared () : memref<400xi8>
// CHECK: %[[VIEW_2:.*]] = memref.view %[[MEMREF_1:.*]][%[[CONST0:.*]]][] : memref<400xi8> to memref<10x20xbf16>
// CHECK: %[[VIEW_3:.*]] = memref.view %[[MEMREF_1:.*]][%[[CONST0:.*]]][] : memref<400xi8> to memref<10x20xi16>
// CHECK: memref.copy %arg0, %[[VIEW_2:.*]] : memref<10x20xbf16> to memref<10x20xbf16>
// CHECK: %[[VIEW_2:.*]] = memref.view %[[MEMREF_1]][%[[CONST0]]][] : memref<400xi8> to memref<10x20xbf16>
// CHECK: %[[VIEW_3:.*]] = memref.view %[[MEMREF_1]][%[[CONST0]]][] : memref<400xi8> to memref<10x20xi16>
// CHECK: memref.copy %arg0, %[[VIEW_2]] : memref<10x20xbf16> to memref<10x20xbf16>
%memref_0 = gpu.alloc host_shared () : memref<10x20xbf16>
memref.copy %arg0, %memref_0 : memref<10x20xbf16> to memref<10x20xbf16>
// CHECK: %[[MEMREF_4:.*]] = gpu.alloc host_shared () : memref<400xi8>
// CHECK: %[[VIEW_5:.*]] = memref.view %[[MEMREF_4:.*]][%[[CONST0:.*]]][] : memref<400xi8> to memref<10x20xbf16>
// CHECK: %[[VIEW_6:.*]] = memref.view %[[MEMREF_4:.*]][%[[CONST0:.*]]][] : memref<400xi8> to memref<10x20xi16>
// CHECK: %[[VIEW_5:.*]] = memref.view %[[MEMREF_4]][%[[CONST0]]][] : memref<400xi8> to memref<10x20xbf16>
// CHECK: %[[VIEW_6:.*]] = memref.view %[[MEMREF_4]][%[[CONST0]]][] : memref<400xi8> to memref<10x20xi16>
%memref_1 = gpu.alloc host_shared () : memref<10x20xbf16>
// CHECK: args(%[[VIEW_3:.*]] : memref<10x20xi16>, %[[VIEW_0:.*]] : memref<10x20xi16>, %[[VIEW_6:.*]] : memref<10x20xi16>)
// CHECK: args(%[[VIEW_3]] : memref<10x20xi16>, %[[VIEW_0]] : memref<10x20xi16>, %[[VIEW_6]] : memref<10x20xi16>)
gpu.launch_func @test_kernel::@test_kernel blocks in (%c10, %c20, %c1) threads in (%c1, %c1, %c1) args(%memref_0 : memref<10x20xbf16>, %memref : memref<10x20xbf16>, %memref_1 : memref<10x20xbf16>)
// CHECK: gpu.dealloc %[[MEMREF_1:.*]] : memref<400xi8>
// CHECK: gpu.dealloc %[[MEMREF:.*]] : memref<400xi8>
// CHECK: return %[[VIEW_5:.*]] : memref<10x20xbf16>
// CHECK: gpu.dealloc %[[MEMREF_1]] : memref<400xi8>
// CHECK: gpu.dealloc %[[MEMREF]] : memref<400xi8>
// CHECK: return %[[VIEW_5]] : memref<10x20xbf16>
gpu.dealloc %memref_0 : memref<10x20xbf16>
gpu.dealloc %memref : memref<10x20xbf16>
return %memref_1 : memref<10x20xbf16>
Expand All @@ -40,17 +40,17 @@ module @eltwise_add attributes {gpu.container_module} {
%1 = gpu.block_id y
// CHECK: %[[VAR2:.*]] = memref.load %arg0[%[[VAR0:.*]], %[[VAR1:.*]]] : memref<10x20xi16>
%2 = memref.load %arg0[%0, %1] : memref<10x20xbf16>
// CHECK: %[[VAR3:.*]] = memref.load %arg1[%[[VAR0:.*]], %[[VAR1:.*]]] : memref<10x20xi16>
// CHECK: %[[VAR3:.*]] = memref.load %arg1[%[[VAR0]], %[[VAR1]]] : memref<10x20xi16>
%3 = memref.load %arg1[%0, %1] : memref<10x20xbf16>
// CHECK: %[[VAR4:.*]] = arith.bitcast %[[VAR2:.*]] : i16 to bf16
// CHECK: %[[VAR5:.*]] = arith.extf %[[VAR4:.*]] : bf16 to f32
// CHECK: %[[VAR6:.*]] = arith.bitcast %[[VAR3:.*]] : i16 to bf16
// CHECK: %[[VAR7:.*]] = arith.extf %[[VAR6:.*]] : bf16 to f32
// CHECK: %[[VAR8:.*]] = arith.addf %[[VAR5:.*]], %[[VAR7:.*]] : f32
// CHECK: %[[VAR9:.*]] = arith.truncf %[[VAR8:.*]] : f32 to bf16
// CHECK: %[[VAR10:.*]] = arith.bitcast %[[VAR9:.*]] : bf16 to i16
// CHECK: %[[VAR4:.*]] = arith.bitcast %[[VAR2]] : i16 to bf16
// CHECK: %[[VAR5:.*]] = arith.extf %[[VAR4]] : bf16 to f32
// CHECK: %[[VAR6:.*]] = arith.bitcast %[[VAR3]] : i16 to bf16
// CHECK: %[[VAR7:.*]] = arith.extf %[[VAR6]] : bf16 to f32
// CHECK: %[[VAR8:.*]] = arith.addf %[[VAR5]], %[[VAR7]] : f32
// CHECK: %[[VAR9:.*]] = arith.truncf %[[VAR8]] : f32 to bf16
// CHECK: %[[VAR10:.*]] = arith.bitcast %[[VAR9]] : bf16 to i16
%4 = arith.addf %2, %3 : bf16
// CHECK: memref.store %[[VAR10:.*]], %arg2[%[[VAR0:.*]], %[[VAR1:.*]]] : memref<10x20xi16>
// CHECK: memref.store %[[VAR10]], %arg2[%[[VAR0]], %[[VAR1]]] : memref<10x20xi16>
memref.store %4, %arg2[%0, %1] : memref<10x20xbf16>
gpu.return
}
Expand Down
Loading
Loading