Skip to content

Commit 1af8f81

Browse files
committed
Merge branch 'fabio/opencl_usm_import' into 'opencl_ur_port'
[SYCL][OpenCL] Port USM import and export entrypoints See merge request unified-runtime/intel-llvm!146
2 parents d7669ce + 6dccfea commit 1af8f81

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

sycl/plugins/opencl/pi_opencl.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,6 @@
2222

2323
extern "C" {
2424

25-
pi_result piextUSMImport(const void *ptr, size_t size, pi_context context) {
26-
std::ignore = ptr;
27-
std::ignore = size;
28-
std::ignore = context;
29-
return PI_SUCCESS;
30-
}
31-
32-
pi_result piextUSMRelease(const void *ptr, pi_context context) {
33-
std::ignore = ptr;
34-
std::ignore = context;
35-
return PI_SUCCESS;
36-
}
37-
3825
const char SupportedVersion[] = _PI_OPENCL_PLUGIN_VERSION_STRING;
3926

4027
pi_result piPluginInit(pi_plugin *PluginInit) {
@@ -173,8 +160,8 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
173160
_PI_CL(piextUSMEnqueueMemset2D, pi2ur::piextUSMEnqueueMemset2D)
174161
_PI_CL(piextUSMEnqueueMemcpy2D, pi2ur::piextUSMEnqueueMemcpy2D)
175162
_PI_CL(piextUSMGetMemAllocInfo, pi2ur::piextUSMGetMemAllocInfo)
176-
_PI_CL(piextUSMImport, piextUSMImport)
177-
_PI_CL(piextUSMRelease, piextUSMRelease)
163+
_PI_CL(piextUSMImport, pi2ur::piextUSMImport)
164+
_PI_CL(piextUSMRelease, pi2ur::piextUSMRelease)
178165
// Device global variable
179166
_PI_CL(piextEnqueueDeviceGlobalVariableWrite,
180167
pi2ur::piextEnqueueDeviceGlobalVariableWrite)

sycl/plugins/unified_runtime/ur/adapters/opencl/ur_interface_loader.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,18 @@ urGetUSMProcAddrTable(ur_api_version_t Version, ur_usm_dditable_t *pDdiTable) {
238238
return UR_RESULT_SUCCESS;
239239
}
240240

241+
UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable(
242+
ur_api_version_t Version, ur_usm_exp_dditable_t *pDdiTable) {
243+
auto Result = validateProcInputs(Version, pDdiTable);
244+
if (UR_RESULT_SUCCESS != Result) {
245+
return Result;
246+
}
247+
248+
pDdiTable->pfnImportExp = urUSMImportExp;
249+
pDdiTable->pfnReleaseExp = urUSMReleaseExp;
250+
return UR_RESULT_SUCCESS;
251+
}
252+
241253
UR_DLLEXPORT ur_result_t UR_APICALL urGetDeviceProcAddrTable(
242254
ur_api_version_t Version, ur_device_dditable_t *pDdiTable) {
243255
auto Result = validateProcInputs(Version, pDdiTable);

sycl/plugins/unified_runtime/ur/adapters/opencl/usm.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,3 +440,15 @@ urUSMGetMemAllocInfo(ur_context_handle_t hContext, const void *pMem,
440440

441441
return RetVal;
442442
}
443+
444+
UR_APIEXPORT ur_result_t UR_APICALL
445+
urUSMImportExp([[maybe_unused]] ur_context_handle_t Context,
446+
[[maybe_unused]] void *HostPtr, [[maybe_unused]] size_t Size) {
447+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
448+
}
449+
450+
UR_APIEXPORT ur_result_t UR_APICALL
451+
urUSMReleaseExp([[maybe_unused]] ur_context_handle_t Context,
452+
[[maybe_unused]] void *HostPtr) {
453+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
454+
}

0 commit comments

Comments
 (0)