[mlir][GPU] Allow bare pointer memrefs when calling GPU kernels
authorKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Mon, 11 Jul 2022 18:29:01 +0000 (18:29 +0000)
committerKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Tue, 2 Aug 2022 20:58:34 +0000 (20:58 +0000)
commitc2fc8d9b95bd98acb52a3174ed677c2a85aafe4d
treeee89b5f1dbde73e8cb5472cabc2634bdbec3575f
parent95a92995d45fc6fada43ecd91eba3e7aea90487a
[mlir][GPU] Allow bare pointer memrefs when calling GPU kernels

In the ROCm runtime (and probably CUDA as well), all kernel arguments
are aligned. Therefore, enable using bare pointers for memref
arguments to kernels when these memrefs have static shape and a
trivial layout.

This is a substantial optimization to launching kernels that use
memrefs with known, static sizes, since it causes the kernel launch
packet to no longer include information already known to the kernel,
which can enable packing the kernel launch arguments into launch
packets instead of having to allocate an entire separate structure to
hold unneeded memref information.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D130716
mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h
mlir/include/mlir/Conversion/LLVMCommon/TypeConverter.h
mlir/include/mlir/Conversion/Passes.td
mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
mlir/test/Conversion/GPUToROCDL/memref.mlir [new file with mode: 0644]
mlir/test/Integration/GPU/ROCM/vecadd.mlir