Skip to content

Commit bb7793b

Browse files
committed
[SYCL] Change of name of piextDevice/ProgramInterop to piextDeviceProgramConvert.
Returning error code from clRetainDevice/clRetainProgram. Signed-off-by: Garima Gupta <[email protected]>
1 parent d2def6e commit bb7793b

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

sycl/include/CL/sycl/detail/pi.def

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
_PI_API(piPlatformsGet)
1919
_PI_API(piPlatformGetInfo)
2020
// Device
21-
_PI_API(piextDeviceInterop)
21+
_PI_API(piextDeviceConvert)
2222
_PI_API(piDevicesGet)
2323
_PI_API(piDeviceGetInfo)
2424
_PI_API(piDevicePartition)
@@ -46,7 +46,7 @@ _PI_API(piMemRetain)
4646
_PI_API(piMemRelease)
4747
_PI_API(piMemBufferPartition)
4848
// Program
49-
_PI_API(piextProgramInterop)
49+
_PI_API(piextProgramConvert)
5050
_PI_API(piProgramCreate)
5151
_PI_API(piclProgramCreateWithSource)
5252
_PI_API(piclProgramCreateWithBinary)

sycl/include/CL/sycl/detail/pi.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ pi_result piPlatformGetInfo(pi_platform platform, pi_platform_info param_name,
717717
/// the "handle" (if it was pointing to a null) from the given PI device.
718718
/// NOTE: The instance of the PI device created is retained.
719719
///
720-
pi_result piextDeviceInterop(
720+
pi_result piextDeviceConvert(
721721
pi_device *device, ///< [in,out] the pointer to PI device
722722
void **handle); ///< [in,out] the pointer to the raw device handle
723723

@@ -827,7 +827,7 @@ pi_result piMemBufferPartition(pi_mem buffer, pi_mem_flags flags,
827827
/// the "handle" (if it was pointing to a null) from the given PI program.
828828
/// NOTE: The instance of the PI program created is retained.
829829
///
830-
pi_result piextProgramInterop(
830+
pi_result piextProgramConvert(
831831
pi_context context, ///< [in] the PI context of the program
832832
pi_program *program, ///< [in,out] the pointer to PI program
833833
void **handle); ///< [in,out] the pointer to the raw program handle

sycl/include/CL/sycl/detail/pi.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ template <class To, class From> To inline pi::cast(From value) {
179179

180180
// These conversions should use PI interop API.
181181
template <> pi::PiProgram inline pi::cast(cl_program interop) {
182-
RT::assertion(false, "pi::cast -> use piextProgramInterop");
182+
RT::assertion(false, "pi::cast -> use piextProgramConvert");
183183
return {};
184184
}
185185

186186
template <> pi::PiDevice inline pi::cast(cl_device_id interop) {
187-
RT::assertion(false, "pi::cast -> use piextDeviceInterop");
187+
RT::assertion(false, "pi::cast -> use piextDeviceConvert");
188188
return {};
189189
}
190190

sycl/plugins/cuda/pi_cuda.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,8 @@ pi_result cuda_piPlatformGetInfo(pi_platform platform,
680680
return {};
681681
}
682682

683-
pi_result cuda_piextDeviceInterop(pi_device *device, void **handle) {
684-
cl::sycl::detail::pi::die("cuda_piextDeviceInterop not implemented");
683+
pi_result cuda_piextDeviceConvert(pi_device *device, void **handle) {
684+
cl::sycl::detail::pi::die("cuda_piextDeviceConvert not implemented");
685685
return {};
686686
}
687687

@@ -2143,12 +2143,12 @@ pi_result cuda_piMemRetain(pi_mem mem) {
21432143
//
21442144
// Program
21452145
//
2146-
pi_result cuda_piextProgramInterop(
2146+
pi_result cuda_piextProgramConvert(
21472147
pi_context context, ///< [in] the PI context of the program
21482148
pi_program *program, ///< [in,out] the pointer to PI program
21492149
void **handle) ///< [in,out] the pointer to the raw program handle
21502150
{
2151-
cl::sycl::detail::pi::die("cuda_piextProgramInterop not implemented");
2151+
cl::sycl::detail::pi::die("cuda_piextProgramConvert not implemented");
21522152
return {};
21532153
}
21542154

@@ -3494,7 +3494,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
34943494
_PI_CL(piPlatformsGet, cuda_piPlatformsGet)
34953495
_PI_CL(piPlatformGetInfo, cuda_piPlatformGetInfo)
34963496
// Device
3497-
_PI_CL(piextDeviceInterop, cuda_piextDeviceInterop)
3497+
_PI_CL(piextDeviceConvert, cuda_piextDeviceConvert)
34983498
_PI_CL(piDevicesGet, cuda_piDevicesGet)
34993499
_PI_CL(piDeviceGetInfo, cuda_piDeviceGetInfo)
35003500
_PI_CL(piDevicePartition, cuda_piDevicePartition)
@@ -3522,7 +3522,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
35223522
_PI_CL(piMemRelease, cuda_piMemRelease)
35233523
_PI_CL(piMemBufferPartition, cuda_piMemBufferPartition)
35243524
// Program
3525-
_PI_CL(piextProgramInterop, cuda_piextProgramInterop)
3525+
_PI_CL(piextProgramConvert, cuda_piextProgramConvert)
35263526
_PI_CL(piProgramCreate, cuda_piProgramCreate)
35273527
_PI_CL(piclProgramCreateWithSource, cuda_piclProgramCreateWithSource)
35283528
_PI_CL(piclProgramCreateWithBinary, cuda_piclProgramCreateWithBinary)

sycl/plugins/opencl/pi_opencl.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ pi_result OCL(piPlatformsGet)(pi_uint32 num_entries, pi_platform *platforms,
176176
return static_cast<pi_result>(result);
177177
}
178178

179-
pi_result OCL(piextDeviceInterop)(pi_device *device, void **handle) {
179+
pi_result OCL(piextDeviceConvert)(pi_device *device, void **handle) {
180180
// The PI device is the same as OpenCL device handle.
181181
assert(device);
182182
assert(handle);
@@ -190,8 +190,8 @@ pi_result OCL(piextDeviceInterop)(pi_device *device, void **handle) {
190190
*handle = *device;
191191
}
192192

193-
clRetainDevice(cast<cl_device_id>(*handle));
194-
return PI_SUCCESS;
193+
cl_int result = clRetainDevice(cast<cl_device_id>(*handle));
194+
return cast<pi_result>(result);
195195
}
196196

197197
// Example of a PI interface that does not map exactly to an OpenCL one.
@@ -323,7 +323,7 @@ pi_result OCL(piQueueCreate)(pi_context context, pi_device device,
323323
return cast<pi_result>(ret_err);
324324
}
325325

326-
pi_result OCL(piextProgramInterop)(
326+
pi_result OCL(piextProgramConvert)(
327327
pi_context context, ///< [in] the PI context of the program
328328
pi_program *program, ///< [in,out] the pointer to PI program
329329
void **handle) ///< [in,out] the pointer to the raw program handle
@@ -340,8 +340,8 @@ pi_result OCL(piextProgramInterop)(
340340
assert(*handle == nullptr);
341341
*handle = *program;
342342
}
343-
clRetainProgram(cast<cl_program>(*handle));
344-
return PI_SUCCESS;
343+
cl_int result = clRetainProgram(cast<cl_program>(*handle));
344+
return cast<pi_result>(result);
345345
}
346346

347347
pi_result OCL(piProgramCreate)(pi_context context, const void *il,
@@ -1031,7 +1031,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
10311031
_PI_CL(piPlatformsGet, OCL(piPlatformsGet))
10321032
_PI_CL(piPlatformGetInfo, clGetPlatformInfo)
10331033
// Device
1034-
_PI_CL(piextDeviceInterop, OCL(piextDeviceInterop))
1034+
_PI_CL(piextDeviceConvert, OCL(piextDeviceConvert))
10351035
_PI_CL(piDevicesGet, OCL(piDevicesGet))
10361036
_PI_CL(piDeviceGetInfo, clGetDeviceInfo)
10371037
_PI_CL(piDevicePartition, clCreateSubDevices)
@@ -1059,7 +1059,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
10591059
_PI_CL(piMemRelease, clReleaseMemObject)
10601060
_PI_CL(piMemBufferPartition, OCL(piMemBufferPartition))
10611061
// Program
1062-
_PI_CL(piextProgramInterop, OCL(piextProgramInterop))
1062+
_PI_CL(piextProgramConvert, OCL(piextProgramConvert))
10631063
_PI_CL(piProgramCreate, OCL(piProgramCreate))
10641064
_PI_CL(piclProgramCreateWithSource, OCL(piclProgramCreateWithSource))
10651065
_PI_CL(piclProgramCreateWithBinary, OCL(piclProgramCreateWithBinary))

sycl/source/detail/device_impl.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ device_impl::device_impl(device_interop_handle_t InteropDeviceHandle,
3838
if (Device == nullptr) {
3939
assert(InteropDeviceHandle != nullptr);
4040
// Get PI device from the raw device handle.
41-
Plugin.call<PiApiKind::piextDeviceInterop>(&MDevice,
41+
Plugin.call<PiApiKind::piextDeviceConvert>(&MDevice,
4242
(void **)&InteropDeviceHandle);
4343
InteroperabilityConstructor = true;
4444
}
@@ -56,7 +56,7 @@ device_impl::device_impl(device_interop_handle_t InteropDeviceHandle,
5656
if (!MIsRootDevice && !InteroperabilityConstructor) {
5757
// TODO catch an exception and put it to list of asynchronous exceptions
5858
// Interoperability Constructor already calls DeviceRetain in
59-
// piextDeviceInterop.
59+
// piextDeviceConvert.
6060
Plugin.call<PiApiKind::piDeviceRetain>(MDevice);
6161
}
6262

@@ -98,7 +98,7 @@ cl_device_id device_impl::get() const {
9898
Plugin.call<PiApiKind::piDeviceRetain>(MDevice);
9999
}
100100
void *handle = nullptr;
101-
Plugin.call<PiApiKind::piextDeviceInterop>(
101+
Plugin.call<PiApiKind::piextDeviceConvert>(
102102
const_cast<RT::PiDevice *>(&MDevice), &handle);
103103
return pi::cast<cl_device_id>(handle);
104104
}

sycl/source/detail/program_impl.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,18 @@ program_impl::program_impl(ContextImplPtr Context,
9292
const detail::plugin &Plugin = getPlugin();
9393
if (MProgram == nullptr) {
9494
assert(InteropProgram != nullptr &&
95-
"No InteropProgram/PiProgram defined with piextProgramInterop");
95+
"No InteropProgram/PiProgram defined with piextProgramConvert");
9696
// Translate the raw program handle into PI program.
97-
Plugin.call<PiApiKind::piextProgramInterop>(
97+
Plugin.call<PiApiKind::piextProgramConvert>(
9898
Context->getHandleRef(), &MProgram, (void **)&InteropProgram);
9999
} else
100100
Plugin.call<PiApiKind::piProgramRetain>(Program);
101101

102102
// TODO handle the case when cl_program build is in progress
103103
pi_uint32 NumDevices;
104-
Plugin.call<PiApiKind::piProgramGetInfo>(MProgram, PI_PROGRAM_INFO_NUM_DEVICES,
105-
sizeof(pi_uint32), &NumDevices,
106-
nullptr);
104+
Plugin.call<PiApiKind::piProgramGetInfo>(
105+
MProgram, PI_PROGRAM_INFO_NUM_DEVICES, sizeof(pi_uint32), &NumDevices,
106+
nullptr);
107107
vector_class<RT::PiDevice> PiDevices(NumDevices);
108108
Plugin.call<PiApiKind::piProgramGetInfo>(MProgram, PI_PROGRAM_INFO_DEVICES,
109109
sizeof(RT::PiDevice) * NumDevices,

0 commit comments

Comments
 (0)