[PATCH] D80676: [mlir][gpu] Introduce mlir-rocm-runner.

Wen-Heng (Jack) Chung via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 27 16:56:23 PDT 2020


whchung created this revision.
whchung added a project: MLIR.
Herald added subscribers: llvm-commits, jurahul, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, csigg, nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini, dexonsmith, tpr, mgorny.
Herald added a reviewer: herhut.
Herald added a project: LLVM.
whchung added a comment.
Herald added a subscriber: ormris.

This patch depends on D80142 <https://reviews.llvm.org/D80142>.


`mlir-rocm-runner` is introduced in this commit to execute GPU modules on ROCm
platform. A small wrapper to encapsulate ROCm's HIP runtime API is also inside
the commit.

Due to behavior of ROCm, raw pointers inside memrefs passed to `gpu.launch`
must be modified on the host side to properly capture the pointer values
addressable on the GPU.

LLVM MC is used to assemble AMD GCN ISA coming out from
`ConvertGPUKernelToBlobPass` to binary form, and LLD is used to produce a shared
ELF object which could be loaded by ROCm HIP runtime.

gfx900 is the default target be used right now, although it could be altered via
an option in `mlir-rocm-runner`. Future revisions may consider using ROCm Agent
Enumerator to detect the right target on the system.

Notice AMDGPU Code Object V2 is used in this revision. Future enhancements may
upgrade to AMDGPU Code Object V3.

Bitcode libraries in ROCm-Device-Libs, which implements math routines exposed in
`rocdl` dialect are not yet linked, and is left as a TODO in the logic.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80676

Files:
  mlir/CMakeLists.txt
  mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
  mlir/lib/Conversion/GPUCommon/ConvertLaunchFuncToRuntimeCalls.cpp
  mlir/test/CMakeLists.txt
  mlir/test/lit.cfg.py
  mlir/test/lit.site.cfg.py.in
  mlir/test/mlir-rocm-runner/gpu-to-hsaco.mlir
  mlir/test/mlir-rocm-runner/lit.local.cfg
  mlir/test/mlir-rocm-runner/two-modules.mlir
  mlir/test/mlir-rocm-runner/vecadd.mlir
  mlir/tools/CMakeLists.txt
  mlir/tools/mlir-rocm-runner/CMakeLists.txt
  mlir/tools/mlir-rocm-runner/mlir-rocm-runner.cpp
  mlir/tools/mlir-rocm-runner/rocm-runtime-wrappers.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80676.266698.patch
Type: text/x-patch
Size: 29244 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200527/7b33acc7/attachment.bin>


More information about the llvm-commits mailing list