[Openmp-commits] [PATCH] D137607: Add interop support for OpenMP AMD GPU plugin

Jisheng Zhao via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Nov 17 07:26:58 PST 2022


jz10 updated this revision to Diff 476120.
jz10 added a comment.

Thanks Johannes,

1. for the "else and return" thing, I fixed the code style based on you suggestion, please check if that works

2. for the workflow of __tgt_interop_init, I agree with you point and revised the workflow as:

i. handle task dependencies
ii. check if the device is ready, if not, set the interop object as omp_interop_none;
iii. create omp_interop_val_t that is corresponding the actual type of backend runtime, it has two types currently CUDA and HIP, other backend runtime support are not fully available yet;
iv. call init_device_info to setup the Context and Device fields for tgt_device_info object, if this failed, then destroy omp_interop_val_t;
v. if the interop type is kmp_interop_type_tasksync, then call init_async_info to setup the async Queue for tgt_async_info object, if this failed, then destroy omp_interop_val_t.

So the main changes is at step ii and iii, since the functionality of deviceIsReady is to check: 1. if the RTL object (backend runtime) was created or not ; 2. if the RTL initOnce was successfully invoked and the isInit flag was set, if neither of those 2 conditions satisfied, the interop can not provide any valuable information to user (e.g. the queue object or device information), so we just set interop object as omp_interop_none if the invocation of deviceIsReady failed;

3. "Either we can always do that, and therefore can always call init_device_info to initialize the thing in the plugin,"

This needs the plugin to be aware about the interop related data structure and APIs, I'm not sure if that is right way to manage interop related content

4. "or we cannot always do that, and should consequently not call get_driver_type if the device is not ready."

This is what we are doing so far.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137607/new/

https://reviews.llvm.org/D137607

Files:
  openmp/libomptarget/include/interop.h
  openmp/libomptarget/include/omptarget.h
  openmp/libomptarget/include/omptargetplugin.h
  openmp/libomptarget/include/rtl.h
  openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
  openmp/libomptarget/plugins/cuda/src/rtl.cpp
  openmp/libomptarget/src/interop.cpp
  openmp/libomptarget/src/rtl.cpp
  openmp/libomptarget/test/api/omp_interop_amdgpu.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137607.476120.patch
Type: text/x-patch
Size: 11961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221117/4e493243/attachment-0001.bin>


More information about the Openmp-commits mailing list