[all-commits] [llvm/llvm-project] 2fd640: [mlir][gpu] Introduce mlir-rocm-runner.

Wen-Heng (Jack) Chung via All-commits all-commits at lists.llvm.org
Fri Jun 5 07:47:07 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2fd6403a6d7a81c3c9d2676643bfeda042359d3c
      https://github.com/llvm/llvm-project/commit/2fd6403a6d7a81c3c9d2676643bfeda042359d3c
  Author: Wen-Heng (Jack) Chung <whchung at gmail.com>
  Date:   2020-06-05 (Fri, 05 Jun 2020)

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

  Log Message:
  -----------
  [mlir][gpu] Introduce mlir-rocm-runner.

Summary:
`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.

Reviewers: herhut

Subscribers: mgorny, tpr, dexonsmith, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits

Tags: #mlir, #llvm

Differential Revision: https://reviews.llvm.org/D80676




More information about the All-commits mailing list