Skip to content

[SYCL][CUDA] Add backend_version device property #5802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sycl/include/CL/sycl/detail/pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ typedef enum {
PI_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES = 0x10111,
PI_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES = 0x11000,
PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU = 0x10112,
PI_DEVICE_INFO_BACKEND_VERSION = 0x10113,
PI_EXT_ONEAPI_DEVICE_INFO_MAX_GLOBAL_WORK_GROUPS = 0x20000,
PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_1D = 0x20001,
PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_2D = 0x20002,
Expand Down
1 change: 1 addition & 0 deletions sycl/include/CL/sycl/info/device_traits.def
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ __SYCL_PARAM_TRAITS_SPEC(device, max_num_sub_groups, pi_uint32)
__SYCL_PARAM_TRAITS_SPEC(device, sub_group_independent_forward_progress, bool)
__SYCL_PARAM_TRAITS_SPEC(device, sub_group_sizes, std::vector<size_t>)
__SYCL_PARAM_TRAITS_SPEC(device, kernel_kernel_pipe_support, bool)
__SYCL_PARAM_TRAITS_SPEC(device, backend_version, std::string)
__SYCL_PARAM_TRAITS_SPEC(device, usm_device_allocations, bool)
__SYCL_PARAM_TRAITS_SPEC(device, usm_host_allocations, bool)
__SYCL_PARAM_TRAITS_SPEC(device, usm_shared_allocations, bool)
Expand Down
1 change: 1 addition & 0 deletions sycl/include/CL/sycl/info/info_desc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ enum class device : cl_device_info {
partition_type_property,
kernel_kernel_pipe_support,
built_in_kernel_ids,
backend_version = PI_DEVICE_INFO_BACKEND_VERSION,
// USM
usm_device_allocations = PI_USM_DEVICE_SUPPORT,
usm_host_allocations = PI_USM_HOST_SUPPORT,
Expand Down
9 changes: 9 additions & 0 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,15 @@ pi_result cuda_piDeviceGetInfo(pi_device device, pi_device_info param_name,
}
return getInfo(param_value_size, param_value, param_value_size_ret, value);
}
case PI_DEVICE_INFO_BACKEND_VERSION: {
int major =
getAttribute(device, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR);
int minor =
getAttribute(device, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR);
std::string result = std::to_string(major) + "." + std::to_string(minor);
return getInfo(param_value_size, param_value, param_value_size_ret,
result.c_str());
}

// TODO: Investigate if this information is available on CUDA.
case PI_DEVICE_INFO_PCI_ADDRESS:
Expand Down
7 changes: 7 additions & 0 deletions sycl/source/detail/device_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,13 @@ inline bool get_device_info_host<info::device::kernel_kernel_pipe_support>() {
return false;
}

template <>
inline std::string get_device_info_host<info::device::backend_version>() {
throw runtime_error(
"Backend version feature is not supported on HOST device.",
PI_INVALID_DEVICE);
}

Comment on lines +1158 to +1164
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand correctly that it's only a stub and going to be modified in follow-up patch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is a stub, but we currently do not have plans for implementing it for other backends. I am not even sure what it should return for host, as it is supposed to be defined by backend specification.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could just throw an exception for host.

template <>
inline bool get_device_info_host<info::device::usm_device_allocations>() {
return true;
Expand Down
1 change: 1 addition & 0 deletions sycl/test/abi/sycl_symbols_linux.dump
Original file line number Diff line number Diff line change
Expand Up @@ -4287,6 +4287,7 @@ _ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE65575EEENS3_12param_traitsIS4_XT_
_ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE65808EEENS3_12param_traitsIS4_XT_EE11return_typeEv
_ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE65809EEENS3_12param_traitsIS4_XT_EE11return_typeEv
_ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE65810EEENS3_12param_traitsIS4_XT_EE11return_typeEv
_ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE65811EEENS3_12param_traitsIS4_XT_EE11return_typeEv
_ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE69632EEENS3_12param_traitsIS4_XT_EE11return_typeEv
_ZNK2cl4sycl6device9getNativeEv
_ZNK2cl4sycl6kernel11get_backendEv
Expand Down
1 change: 1 addition & 0 deletions sycl/test/abi/sycl_symbols_windows.dump
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
??$get_info@$0BABBB@@device@sycl@cl@@QEBA?AV?$vector@W4memory_order@sycl@cl@@V?$allocator@W4memory_order@sycl@cl@@@std@@@std@@XZ
??$get_info@$0BABBC@@device@sycl@cl@@QEBAIXZ
??$get_info@$0BABBC@@kernel@sycl@cl@@QEBAIAEBVdevice@12@@Z
??$get_info@$0BABBD@@device@sycl@cl@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ
??$get_info@$0BABC@@device@sycl@cl@@QEBA_KXZ
??$get_info@$0BABD@@device@sycl@cl@@QEBA_KXZ
??$get_info@$0BABE@@device@sycl@cl@@QEBA_KXZ
Expand Down