-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Transform] Add transform.iree.pack_shared_memory_alloc (#14503)
This patch adds the `transform.iree.pack_shared_memory_alloc` op. This op simply takes in a funcOp and applies LLVMGPUPackSharedMemoryAlloc pass on it.
- Loading branch information
Showing
11 changed files
with
167 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...er/src/iree/compiler/Codegen/LLVMGPU/test/transform_dialect_pack_shared_memory_alloc.mlir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// RUN: iree-opt %s --iree-transform-dialect-interpreter -transform-dialect-drop-schedule --split-input-file | FileCheck %s | ||
|
||
// CHECK-LABEL: shared_memory_disjoint | ||
// CHECK-NOT: gpu.barrier | ||
// CHECK-DAG: %[[PACKED:.+]] = memref.alloc() : memref<1024xi8, #gpu.address_space<workgroup>> | ||
// CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index | ||
// CHECK: memref.view %[[PACKED]][%[[C0]]][] : memref<1024xi8, #gpu.address_space<workgroup>> to memref<128xf32, #gpu.address_space<workgroup>> | ||
// CHECK: %[[C512:.+]] = arith.constant 512 : index | ||
// CHECK: memref.view %[[PACKED]][%[[C512]]][] : memref<1024xi8, #gpu.address_space<workgroup>> to memref<128xf32, #gpu.address_space<workgroup>> | ||
// CHECK: nvgpu.device_async_create_group | ||
// CHECK: nvgpu.device_async_wait %0 {numGroups = 0 : i32} | ||
// CHECK: gpu.barrier | ||
// CHECK: memref.view %[[PACKED]][%[[C0]]][] : memref<1024xi8, #gpu.address_space<workgroup>> to memref<32xf32, #gpu.address_space<workgroup>> | ||
func.func @shared_memory_disjoint() { | ||
%c0 = arith.constant 0 : index | ||
%cst_f32 = arith.constant 0.000000e+00 : f32 | ||
%cst_i8 = arith.constant 0 : i8 | ||
%0 = memref.alloc() : memref<128xf32, #gpu.address_space<workgroup>> | ||
%1 = memref.alloc() : memref<128xf32, #gpu.address_space<workgroup>> | ||
%2 = memref.alloc() : memref<32xf32, #gpu.address_space<workgroup>> | ||
memref.store %cst_f32, %0[%c0] : memref<128xf32, #gpu.address_space<workgroup>> | ||
memref.store %cst_f32, %1[%c0] : memref<128xf32, #gpu.address_space<workgroup>> | ||
memref.store %cst_f32, %0[%c0] : memref<128xf32, #gpu.address_space<workgroup>> | ||
memref.store %cst_f32, %2[%c0] : memref<32xf32, #gpu.address_space<workgroup>> | ||
return | ||
} | ||
|
||
transform.sequence failures(propagate) { | ||
^bb1(%arg1: !transform.any_op): | ||
%0 = transform.structured.match ops{["func.func"]} in %arg1 : (!transform.any_op) -> !transform.any_op | ||
transform.iree.pack_shared_memory_alloc %0 : (!transform.any_op) -> () | ||
transform.iree.apply_cse %0 : !transform.any_op | ||
} |