[Openmp-commits] [PATCH] D85742: [libomptarget] Implement host plugin for amdgpu

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Aug 11 08:50:34 PDT 2020


JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, grokos, ABataev, ronl, saiislam, ye-luo.
Herald added subscribers: openmp-commits, aaron.ballman, kerbowa, jfb, t-tye, tpr, dstuttard, yaxunl, mgorny, nhaehnle, jvesely, kzhuravl.
Herald added a project: OpenMP.
JonChesterfield requested review of this revision.
Herald added subscribers: sstefan1, wdng.

[libomptarget] Implement host plugin for amdgpu

Replacement for D71384 <https://reviews.llvm.org/D71384>. Primary difference is inlining the dependency on atmi
followed by extensive simplification and bugfixes. This is the latest version
from https://github.com/ROCm-Developer-Tools/amd-llvm-project/tree/aomp12 with
minor patches and a rename from hsa to amdgpu, on the basis that this can't be
used by other implementations of hsa without additional work.

This will not build unless the ROCM_DIR variable is passed so won't break other
builds. That variable is used to locate two amdgpu specific libraries that ship
as part of rocm:
libhsakmt at https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface
libhsa-runtime64 at https://github.com/RadeonOpenCompute/ROCR-Runtime
These libraries build from source. The build scripts in those repos are for
shared libraries, but can be adapted to statically link both into this plugin.

There are caveats.

- This works well enough to run various tests and benchmarks, and will be used to support the current clang bring up
- It is adequately thread safe for the above but there will be races remaining
- It is not stylistically correct for llvm, though has had clang-format run
- It has suboptimal memory management and locking strategies
- The debug printing / error handling is inconsistent

I would like to contribute this pretty much as-is and then improve it in-tree.
This would be advantagous because the aomp12 branch that was in use for fixing
this codebase has just been joined with the amd internal rocm dev process.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85742

Files:
  openmp/libomptarget/plugins/CMakeLists.txt
  openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
  openmp/libomptarget/plugins/amdgpu/impl/atmi.cpp
  openmp/libomptarget/plugins/amdgpu/impl/atmi.h
  openmp/libomptarget/plugins/amdgpu/impl/atmi_interop_hsa.cpp
  openmp/libomptarget/plugins/amdgpu/impl/atmi_interop_hsa.h
  openmp/libomptarget/plugins/amdgpu/impl/atmi_kl.h
  openmp/libomptarget/plugins/amdgpu/impl/atmi_runtime.h
  openmp/libomptarget/plugins/amdgpu/impl/data.cpp
  openmp/libomptarget/plugins/amdgpu/impl/data.h
  openmp/libomptarget/plugins/amdgpu/impl/internal.h
  openmp/libomptarget/plugins/amdgpu/impl/machine.cpp
  openmp/libomptarget/plugins/amdgpu/impl/machine.h
  openmp/libomptarget/plugins/amdgpu/impl/msgpack.cpp
  openmp/libomptarget/plugins/amdgpu/impl/msgpack.def
  openmp/libomptarget/plugins/amdgpu/impl/msgpack.h
  openmp/libomptarget/plugins/amdgpu/impl/rt.h
  openmp/libomptarget/plugins/amdgpu/impl/system.cpp
  openmp/libomptarget/plugins/amdgpu/impl/utils.cpp
  openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
  openmp/libomptarget/src/rtl.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85742.284764.patch
Type: text/x-patch
Size: 186517 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200811/6e5ab1a8/attachment-0001.bin>


More information about the Openmp-commits mailing list