Skip to content

Commit f88de96

Browse files
committed
Add amd plugin interfaces
1 parent 3917503 commit f88de96

File tree

1 file changed

+32
-0
lines changed
  • offload/plugins-nextgen/amdgpu/src

1 file changed

+32
-0
lines changed

offload/plugins-nextgen/amdgpu/src/rtl.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2712,6 +2712,38 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
27122712
return Plugin::success();
27132713
}
27142714

2715+
interop_spec_t selectInteropPreference(int32_t InteropType,
2716+
int32_t NumPrefers,
2717+
interop_spec_t *Prefers) override {
2718+
// TODO: update once targetsync is supported
2719+
if (InteropType != kmp_interop_type_target)
2720+
return interop_spec_t{tgt_fr_hip, {false, 0}, 0};
2721+
return interop_spec_t{tgt_fr_none, {false, 0}, 0};
2722+
}
2723+
2724+
Expected<omp_interop_val_t *>
2725+
createInterop(int32_t InteropType, interop_spec_t &InteropSpec) override {
2726+
auto *Ret = new omp_interop_val_t(
2727+
DeviceId, static_cast<kmp_interop_type_t>(InteropType));
2728+
Ret->fr_id = tgt_fr_hip;
2729+
Ret->vendor_id = omp_vendor_amd;
2730+
2731+
// TODO: implement targetsync support
2732+
2733+
Ret->device_info.Platform = nullptr;
2734+
Ret->device_info.Device = reinterpret_cast<void *>(Agent.handle);
2735+
Ret->device_info.Context = nullptr;
2736+
2737+
return Ret;
2738+
}
2739+
2740+
Error releaseInterop(omp_interop_val_t *Interop) override {
2741+
if (!Interop)
2742+
return Plugin::success();
2743+
delete Interop;
2744+
return Plugin::success();
2745+
}
2746+
27152747
Error enqueueHostCallImpl(void (*Callback)(void *), void *UserData,
27162748
AsyncInfoWrapperTy &AsyncInfo) override {
27172749
AMDGPUStreamTy *Stream = nullptr;

0 commit comments

Comments
 (0)