Skip to content

Commit

Permalink
Just testing something...
Browse files Browse the repository at this point in the history
  • Loading branch information
RossBrunton committed Jan 31, 2025
1 parent b3c4c96 commit 953f359
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 100 deletions.
59 changes: 34 additions & 25 deletions source/adapters/cuda/ur_interface_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,38 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable(
return UR_RESULT_SUCCESS;
}

UR_DLLEXPORT ur_result_t UR_APICALL urAllAddrTable(ur_api_version_t version,
ur_dditable_t *pDdiTable) {
auto result = validateProcInputs(version, pDdiTable);
if (UR_RESULT_SUCCESS != result) {
return result;
}

urGetGlobalProcAddrTable(version, &pDdiTable->Global);
urGetBindlessImagesExpProcAddrTable(version, &pDdiTable->BindlessImagesExp);
urGetCommandBufferExpProcAddrTable(version, &pDdiTable->CommandBufferExp);
urGetContextProcAddrTable(version, &pDdiTable->Context);
urGetEnqueueProcAddrTable(version, &pDdiTable->Enqueue);
urGetEnqueueExpProcAddrTable(version, &pDdiTable->EnqueueExp);
urGetEventProcAddrTable(version, &pDdiTable->Event);
urGetKernelProcAddrTable(version, &pDdiTable->Kernel);
urGetKernelExpProcAddrTable(version, &pDdiTable->KernelExp);
urGetMemProcAddrTable(version, &pDdiTable->Mem);
urGetPhysicalMemProcAddrTable(version, &pDdiTable->PhysicalMem);
urGetPlatformProcAddrTable(version, &pDdiTable->Platform);
urGetProgramProcAddrTable(version, &pDdiTable->Program);
urGetProgramExpProcAddrTable(version, &pDdiTable->ProgramExp);
urGetQueueProcAddrTable(version, &pDdiTable->Queue);
urGetSamplerProcAddrTable(version, &pDdiTable->Sampler);
urGetUSMProcAddrTable(version, &pDdiTable->USM);
urGetUSMExpProcAddrTable(version, &pDdiTable->USMExp);
urGetUsmP2PExpProcAddrTable(version, &pDdiTable->UsmP2PExp);
urGetVirtualMemProcAddrTable(version, &pDdiTable->VirtualMem);
urGetDeviceProcAddrTable(version, &pDdiTable->Device);

return UR_RESULT_SUCCESS;
}

#if defined(__cplusplus)
} // extern "C"
#endif
Expand All @@ -455,30 +487,7 @@ const ur_dditable_t *cuda_ddi_getter::value() {
static std::once_flag flag;
static ur_dditable_t table;

std::call_once(flag, []() {
urGetGlobalProcAddrTable(UR_API_VERSION_CURRENT, &table.Global);
urGetBindlessImagesExpProcAddrTable(UR_API_VERSION_CURRENT,
&table.BindlessImagesExp);
urGetCommandBufferExpProcAddrTable(UR_API_VERSION_CURRENT,
&table.CommandBufferExp);
urGetContextProcAddrTable(UR_API_VERSION_CURRENT, &table.Context);
urGetEnqueueProcAddrTable(UR_API_VERSION_CURRENT, &table.Enqueue);
urGetEnqueueExpProcAddrTable(UR_API_VERSION_CURRENT, &table.EnqueueExp);
urGetEventProcAddrTable(UR_API_VERSION_CURRENT, &table.Event);
urGetKernelProcAddrTable(UR_API_VERSION_CURRENT, &table.Kernel);
urGetKernelExpProcAddrTable(UR_API_VERSION_CURRENT, &table.KernelExp);
urGetMemProcAddrTable(UR_API_VERSION_CURRENT, &table.Mem);
urGetPhysicalMemProcAddrTable(UR_API_VERSION_CURRENT, &table.PhysicalMem);
urGetPlatformProcAddrTable(UR_API_VERSION_CURRENT, &table.Platform);
urGetProgramProcAddrTable(UR_API_VERSION_CURRENT, &table.Program);
urGetProgramExpProcAddrTable(UR_API_VERSION_CURRENT, &table.ProgramExp);
urGetQueueProcAddrTable(UR_API_VERSION_CURRENT, &table.Queue);
urGetSamplerProcAddrTable(UR_API_VERSION_CURRENT, &table.Sampler);
urGetUSMProcAddrTable(UR_API_VERSION_CURRENT, &table.USM);
urGetUSMExpProcAddrTable(UR_API_VERSION_CURRENT, &table.USMExp);
urGetUsmP2PExpProcAddrTable(UR_API_VERSION_CURRENT, &table.UsmP2PExp);
urGetVirtualMemProcAddrTable(UR_API_VERSION_CURRENT, &table.VirtualMem);
urGetDeviceProcAddrTable(UR_API_VERSION_CURRENT, &table.Device);
});
std::call_once(flag,
[]() { urAllAddrTable(UR_API_VERSION_CURRENT, &table); });
return &table;
}
59 changes: 34 additions & 25 deletions source/adapters/hip/ur_interface_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,38 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable(
return UR_RESULT_SUCCESS;
}

UR_DLLEXPORT ur_result_t UR_APICALL urAllAddrTable(ur_api_version_t version,
ur_dditable_t *pDdiTable) {
auto result = validateProcInputs(version, pDdiTable);
if (UR_RESULT_SUCCESS != result) {
return result;
}

urGetGlobalProcAddrTable(version, &pDdiTable->Global);
urGetBindlessImagesExpProcAddrTable(version, &pDdiTable->BindlessImagesExp);
urGetCommandBufferExpProcAddrTable(version, &pDdiTable->CommandBufferExp);
urGetContextProcAddrTable(version, &pDdiTable->Context);
urGetEnqueueProcAddrTable(version, &pDdiTable->Enqueue);
urGetEnqueueExpProcAddrTable(version, &pDdiTable->EnqueueExp);
urGetEventProcAddrTable(version, &pDdiTable->Event);
urGetKernelProcAddrTable(version, &pDdiTable->Kernel);
urGetKernelExpProcAddrTable(version, &pDdiTable->KernelExp);
urGetMemProcAddrTable(version, &pDdiTable->Mem);
urGetPhysicalMemProcAddrTable(version, &pDdiTable->PhysicalMem);
urGetPlatformProcAddrTable(version, &pDdiTable->Platform);
urGetProgramProcAddrTable(version, &pDdiTable->Program);
urGetProgramExpProcAddrTable(version, &pDdiTable->ProgramExp);
urGetQueueProcAddrTable(version, &pDdiTable->Queue);
urGetSamplerProcAddrTable(version, &pDdiTable->Sampler);
urGetUSMProcAddrTable(version, &pDdiTable->USM);
urGetUSMExpProcAddrTable(version, &pDdiTable->USMExp);
urGetUsmP2PExpProcAddrTable(version, &pDdiTable->UsmP2PExp);
urGetVirtualMemProcAddrTable(version, &pDdiTable->VirtualMem);
urGetDeviceProcAddrTable(version, &pDdiTable->Device);

return UR_RESULT_SUCCESS;
}

#if defined(__cplusplus)
} // extern "C"
#endif
Expand All @@ -421,30 +453,7 @@ const ur_dditable_t *hip_ddi_getter::value() {
static std::once_flag flag;
static ur_dditable_t table;

std::call_once(flag, []() {
urGetGlobalProcAddrTable(UR_API_VERSION_CURRENT, &table.Global);
urGetBindlessImagesExpProcAddrTable(UR_API_VERSION_CURRENT,
&table.BindlessImagesExp);
urGetCommandBufferExpProcAddrTable(UR_API_VERSION_CURRENT,
&table.CommandBufferExp);
urGetContextProcAddrTable(UR_API_VERSION_CURRENT, &table.Context);
urGetEnqueueProcAddrTable(UR_API_VERSION_CURRENT, &table.Enqueue);
urGetEnqueueExpProcAddrTable(UR_API_VERSION_CURRENT, &table.EnqueueExp);
urGetEventProcAddrTable(UR_API_VERSION_CURRENT, &table.Event);
urGetKernelProcAddrTable(UR_API_VERSION_CURRENT, &table.Kernel);
urGetKernelExpProcAddrTable(UR_API_VERSION_CURRENT, &table.KernelExp);
urGetMemProcAddrTable(UR_API_VERSION_CURRENT, &table.Mem);
urGetPhysicalMemProcAddrTable(UR_API_VERSION_CURRENT, &table.PhysicalMem);
urGetPlatformProcAddrTable(UR_API_VERSION_CURRENT, &table.Platform);
urGetProgramProcAddrTable(UR_API_VERSION_CURRENT, &table.Program);
urGetProgramExpProcAddrTable(UR_API_VERSION_CURRENT, &table.ProgramExp);
urGetQueueProcAddrTable(UR_API_VERSION_CURRENT, &table.Queue);
urGetSamplerProcAddrTable(UR_API_VERSION_CURRENT, &table.Sampler);
urGetUSMProcAddrTable(UR_API_VERSION_CURRENT, &table.USM);
urGetUSMExpProcAddrTable(UR_API_VERSION_CURRENT, &table.USMExp);
urGetUsmP2PExpProcAddrTable(UR_API_VERSION_CURRENT, &table.UsmP2PExp);
urGetVirtualMemProcAddrTable(UR_API_VERSION_CURRENT, &table.VirtualMem);
urGetDeviceProcAddrTable(UR_API_VERSION_CURRENT, &table.Device);
});
std::call_once(flag,
[]() { urAllAddrTable(UR_API_VERSION_CURRENT, &table); });
return &table;
}
59 changes: 34 additions & 25 deletions source/adapters/native_cpu/ur_interface_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,36 +431,45 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable(

return UR_RESULT_SUCCESS;
}

UR_DLLEXPORT ur_result_t UR_APICALL urAllAddrTable(ur_api_version_t version,
ur_dditable_t *pDdiTable) {
auto result = validateProcInputs(version, pDdiTable);
if (UR_RESULT_SUCCESS != result) {
return result;
}

urGetGlobalProcAddrTable(version, &pDdiTable->Global);
urGetBindlessImagesExpProcAddrTable(version, &pDdiTable->BindlessImagesExp);
urGetCommandBufferExpProcAddrTable(version, &pDdiTable->CommandBufferExp);
urGetContextProcAddrTable(version, &pDdiTable->Context);
urGetEnqueueProcAddrTable(version, &pDdiTable->Enqueue);
urGetEnqueueExpProcAddrTable(version, &pDdiTable->EnqueueExp);
urGetEventProcAddrTable(version, &pDdiTable->Event);
urGetKernelProcAddrTable(version, &pDdiTable->Kernel);
urGetKernelExpProcAddrTable(version, &pDdiTable->KernelExp);
urGetMemProcAddrTable(version, &pDdiTable->Mem);
urGetPhysicalMemProcAddrTable(version, &pDdiTable->PhysicalMem);
urGetPlatformProcAddrTable(version, &pDdiTable->Platform);
urGetProgramProcAddrTable(version, &pDdiTable->Program);
urGetProgramExpProcAddrTable(version, &pDdiTable->ProgramExp);
urGetQueueProcAddrTable(version, &pDdiTable->Queue);
urGetSamplerProcAddrTable(version, &pDdiTable->Sampler);
urGetUSMProcAddrTable(version, &pDdiTable->USM);
urGetUSMExpProcAddrTable(version, &pDdiTable->USMExp);
urGetUsmP2PExpProcAddrTable(version, &pDdiTable->UsmP2PExp);
urGetVirtualMemProcAddrTable(version, &pDdiTable->VirtualMem);
urGetDeviceProcAddrTable(version, &pDdiTable->Device);

return UR_RESULT_SUCCESS;
}
} // extern "C"

const ur_dditable_t *native_cpu::native_cpu_ddi_getter::value() {
static std::once_flag flag;
static ur_dditable_t table;

std::call_once(flag, []() {
urGetGlobalProcAddrTable(UR_API_VERSION_CURRENT, &table.Global);
urGetBindlessImagesExpProcAddrTable(UR_API_VERSION_CURRENT,
&table.BindlessImagesExp);
urGetCommandBufferExpProcAddrTable(UR_API_VERSION_CURRENT,
&table.CommandBufferExp);
urGetContextProcAddrTable(UR_API_VERSION_CURRENT, &table.Context);
urGetEnqueueProcAddrTable(UR_API_VERSION_CURRENT, &table.Enqueue);
urGetEnqueueExpProcAddrTable(UR_API_VERSION_CURRENT, &table.EnqueueExp);
urGetEventProcAddrTable(UR_API_VERSION_CURRENT, &table.Event);
urGetKernelProcAddrTable(UR_API_VERSION_CURRENT, &table.Kernel);
urGetKernelExpProcAddrTable(UR_API_VERSION_CURRENT, &table.KernelExp);
urGetMemProcAddrTable(UR_API_VERSION_CURRENT, &table.Mem);
urGetPhysicalMemProcAddrTable(UR_API_VERSION_CURRENT, &table.PhysicalMem);
urGetPlatformProcAddrTable(UR_API_VERSION_CURRENT, &table.Platform);
urGetProgramProcAddrTable(UR_API_VERSION_CURRENT, &table.Program);
urGetProgramExpProcAddrTable(UR_API_VERSION_CURRENT, &table.ProgramExp);
urGetQueueProcAddrTable(UR_API_VERSION_CURRENT, &table.Queue);
urGetSamplerProcAddrTable(UR_API_VERSION_CURRENT, &table.Sampler);
urGetUSMProcAddrTable(UR_API_VERSION_CURRENT, &table.USM);
urGetUSMExpProcAddrTable(UR_API_VERSION_CURRENT, &table.USMExp);
urGetUsmP2PExpProcAddrTable(UR_API_VERSION_CURRENT, &table.UsmP2PExp);
urGetVirtualMemProcAddrTable(UR_API_VERSION_CURRENT, &table.VirtualMem);
urGetDeviceProcAddrTable(UR_API_VERSION_CURRENT, &table.Device);
});
std::call_once(flag,
[]() { urAllAddrTable(UR_API_VERSION_CURRENT, &table); });
return &table;
}
60 changes: 35 additions & 25 deletions source/adapters/opencl/ur_interface_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,39 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable(

return UR_RESULT_SUCCESS;
}

UR_DLLEXPORT ur_result_t UR_APICALL urAllAddrTable(ur_api_version_t version,
ur_dditable_t *pDdiTable) {
auto result = validateProcInputs(version, pDdiTable);
if (UR_RESULT_SUCCESS != result) {
return result;
}

urGetGlobalProcAddrTable(version, &pDdiTable->Global);
urGetBindlessImagesExpProcAddrTable(version, &pDdiTable->BindlessImagesExp);
urGetCommandBufferExpProcAddrTable(version, &pDdiTable->CommandBufferExp);
urGetContextProcAddrTable(version, &pDdiTable->Context);
urGetEnqueueProcAddrTable(version, &pDdiTable->Enqueue);
urGetEnqueueExpProcAddrTable(version, &pDdiTable->EnqueueExp);
urGetEventProcAddrTable(version, &pDdiTable->Event);
urGetKernelProcAddrTable(version, &pDdiTable->Kernel);
urGetKernelExpProcAddrTable(version, &pDdiTable->KernelExp);
urGetMemProcAddrTable(version, &pDdiTable->Mem);
urGetPhysicalMemProcAddrTable(version, &pDdiTable->PhysicalMem);
urGetPlatformProcAddrTable(version, &pDdiTable->Platform);
urGetProgramProcAddrTable(version, &pDdiTable->Program);
urGetProgramExpProcAddrTable(version, &pDdiTable->ProgramExp);
urGetQueueProcAddrTable(version, &pDdiTable->Queue);
urGetSamplerProcAddrTable(version, &pDdiTable->Sampler);
urGetUSMProcAddrTable(version, &pDdiTable->USM);
urGetUSMExpProcAddrTable(version, &pDdiTable->USMExp);
urGetUsmP2PExpProcAddrTable(version, &pDdiTable->UsmP2PExp);
urGetVirtualMemProcAddrTable(version, &pDdiTable->VirtualMem);
urGetDeviceProcAddrTable(version, &pDdiTable->Device);

return UR_RESULT_SUCCESS;
}

#if defined(__cplusplus)
} // extern "C"
#endif
Expand All @@ -447,30 +480,7 @@ const ur_dditable_t *cl_adapter::ddi_getter::value() {
static std::once_flag flag;
static ur_dditable_t table;

std::call_once(flag, []() {
urGetGlobalProcAddrTable(UR_API_VERSION_CURRENT, &table.Global);
urGetBindlessImagesExpProcAddrTable(UR_API_VERSION_CURRENT,
&table.BindlessImagesExp);
urGetCommandBufferExpProcAddrTable(UR_API_VERSION_CURRENT,
&table.CommandBufferExp);
urGetContextProcAddrTable(UR_API_VERSION_CURRENT, &table.Context);
urGetEnqueueProcAddrTable(UR_API_VERSION_CURRENT, &table.Enqueue);
urGetEnqueueExpProcAddrTable(UR_API_VERSION_CURRENT, &table.EnqueueExp);
urGetEventProcAddrTable(UR_API_VERSION_CURRENT, &table.Event);
urGetKernelProcAddrTable(UR_API_VERSION_CURRENT, &table.Kernel);
urGetKernelExpProcAddrTable(UR_API_VERSION_CURRENT, &table.KernelExp);
urGetMemProcAddrTable(UR_API_VERSION_CURRENT, &table.Mem);
urGetPhysicalMemProcAddrTable(UR_API_VERSION_CURRENT, &table.PhysicalMem);
urGetPlatformProcAddrTable(UR_API_VERSION_CURRENT, &table.Platform);
urGetProgramProcAddrTable(UR_API_VERSION_CURRENT, &table.Program);
urGetProgramExpProcAddrTable(UR_API_VERSION_CURRENT, &table.ProgramExp);
urGetQueueProcAddrTable(UR_API_VERSION_CURRENT, &table.Queue);
urGetSamplerProcAddrTable(UR_API_VERSION_CURRENT, &table.Sampler);
urGetUSMProcAddrTable(UR_API_VERSION_CURRENT, &table.USM);
urGetUSMExpProcAddrTable(UR_API_VERSION_CURRENT, &table.USMExp);
urGetUsmP2PExpProcAddrTable(UR_API_VERSION_CURRENT, &table.UsmP2PExp);
urGetVirtualMemProcAddrTable(UR_API_VERSION_CURRENT, &table.VirtualMem);
urGetDeviceProcAddrTable(UR_API_VERSION_CURRENT, &table.Device);
});
std::call_once(flag,
[]() { urAllAddrTable(UR_API_VERSION_CURRENT, &table); });
return &table;
}

0 comments on commit 953f359

Please sign in to comment.