Skip to content

Commit df743a5

Browse files
[SYCL] Implement info::device::backend_version for Level Zero, OpenCL and HIP (#9205)
This patch implements info::device::backend_version query for Level Zeroб OpenCL and HIP plugins. \+ some small unrelated typo fixed.
1 parent 8686069 commit df743a5

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

sycl/doc/extensions/supported/sycl_ext_oneapi_backend_level_zero.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,12 @@ The behavior of the SYCL buffer destructor depends on the Ownership flag. As wit
619619
* If the ownership is keep (i.e. the application retains ownership of the Level Zero memory allocation), then the SYCL buffer destructor blocks until all work in queues on the buffer have completed. The buffer's contents is not copied back to the Level Zero memory allocation.
620620
* If the ownership is transfer (i.e. the SYCL runtime has ownership of the Level Zero memory allocation), then the SYCL buffer destructor does not need to block even if work on the buffer has not completed. The SYCL runtime frees the Level Zero memory allocation asynchronously when it is no longer in use in queues.
621621
622+
## 5. Device information descriptors
623+
624+
|Device descriptors|Value|
625+
|-------------|:------------|
626+
|`info::device::backend_version`|The Level Zero backend does not define the value of this information descriptor. Applications should not use it, and implementations are encouraged to return the empty string.
627+
622628
## Revision History
623629
|Rev|Date|Author|Changes|
624630
|-------------|:------------|:------------|:------------|

sycl/plugins/hip/pi_hip.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,10 @@ pi_result hip_piDeviceGetInfo(pi_device device, pi_device_info param_name,
17061706
case PI_DEVICE_INFO_OPENCL_C_VERSION: {
17071707
return getInfo(param_value_size, param_value, param_value_size_ret, "");
17081708
}
1709+
case PI_DEVICE_INFO_BACKEND_VERSION: {
1710+
// TODO: return some meaningful for backend_version below
1711+
return getInfo(param_value_size, param_value, param_value_size_ret, "");
1712+
}
17091713
case PI_DEVICE_INFO_EXTENSIONS: {
17101714
// TODO: Remove comment when HIP support native asserts.
17111715
// DEVICELIB_ASSERT extension is set so fallback assert

sycl/plugins/opencl/pi_opencl.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ pi_result piDeviceGetInfo(pi_device device, pi_device_info paramName,
312312
case PI_DEVICE_INFO_UUID:
313313
return PI_ERROR_INVALID_VALUE;
314314
case PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: {
315-
// This query is missing beore OpenCL 3.0
315+
// This query is missing before OpenCL 3.0
316316
// Check version and handle appropriately
317317
OCLV::OpenCLVersion devVer;
318318
cl_device_id deviceID = cast<cl_device_id>(device);
@@ -644,6 +644,16 @@ pi_result piDeviceGetInfo(pi_device device, pi_device_info paramName,
644644

645645
return static_cast<pi_result>(CL_SUCCESS);
646646
}
647+
case PI_DEVICE_INFO_BACKEND_VERSION: {
648+
// TODO: return some meaningful for backend_version below
649+
const char *value = "";
650+
size_t valueSize = (strlen(value) + 1) * sizeof(char);
651+
if (paramValue)
652+
std::memcpy(paramValue, value, valueSize);
653+
if (paramValueSizeRet != nullptr)
654+
*paramValueSizeRet = valueSize;
655+
return PI_SUCCESS;
656+
}
647657
case PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT: {
648658
cl_int ret_err = CL_SUCCESS;
649659
cl_bool result = CL_FALSE;

sycl/plugins/unified_runtime/pi2ur.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,11 @@ inline pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
791791
case PI_DEVICE_INFO_IMAGE_SRGB:
792792
InfoType = (ur_device_info_t)UR_DEVICE_INFO_IMAGE_SRGB;
793793
break;
794+
case PI_DEVICE_INFO_BACKEND_VERSION: {
795+
// TODO: return some meaningful for backend_version below
796+
ReturnHelper ReturnValue(ParamValueSize, ParamValue, ParamValueSizeRet);
797+
return ReturnValue("");
798+
}
794799
default:
795800
return PI_ERROR_UNKNOWN;
796801
};

sycl/test-e2e/Basic/info.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ int main() {
327327
print_info<info::device::driver_version, std::string>(dev, "Driver version");
328328
print_info<info::device::profile, std::string>(dev, "Profile");
329329
print_info<info::device::version, std::string>(dev, "Version");
330+
print_info<info::device::backend_version, std::string>(dev,
331+
"Backend version");
330332
print_info<info::device::opencl_c_version, std::string>(dev,
331333
"OpenCL C version");
332334
print_info<info::device::extensions, std::vector<std::string>>(dev,

0 commit comments

Comments
 (0)