[llvm] [OFFLOAD] Restore interop functionality (PR #161429)
Kevin Sala Penades via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 1 11:35:39 PDT 2025
================
@@ -2712,6 +2712,38 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
return Plugin::success();
}
+ interop_spec_t selectInteropPreference(int32_t InteropType,
+ int32_t NumPrefers,
+ interop_spec_t *Prefers) override {
+ // TODO: update once targetsync is supported
+ if (InteropType != kmp_interop_type_target)
+ return interop_spec_t{tgt_fr_hip, {false, 0}, 0};
+ return interop_spec_t{tgt_fr_none, {false, 0}, 0};
+ }
+
+ Expected<omp_interop_val_t *>
+ createInterop(int32_t InteropType, interop_spec_t &InteropSpec) override {
+ auto *Ret = new omp_interop_val_t(
+ DeviceId, static_cast<kmp_interop_type_t>(InteropType));
+ Ret->fr_id = tgt_fr_hip;
+ Ret->vendor_id = omp_vendor_amd;
+
+ // TODO: implement targetsync support
+
+ Ret->device_info.Platform = nullptr;
+ Ret->device_info.Device = reinterpret_cast<void *>(Agent.handle);
+ Ret->device_info.Context = nullptr;
+
+ return Ret;
+ }
+
+ Error releaseInterop(omp_interop_val_t *Interop) override {
+ if (!Interop)
+ return Plugin::success();
+ delete Interop;
+ return Plugin::success();
----------------
kevinsala wrote:
```cpp
if (Interop)
delete Interop;
return Plugin::success();
```
https://github.com/llvm/llvm-project/pull/161429
More information about the llvm-commits
mailing list