Skip to content

Commit 423ff17

Browse files
committed
[SYCL] Add BFloat16 aspect
Currently this aspect is mapped on a device info which is being proved by get_platform_name function, claiming, that any Intel GPU device supports BFloat16 extension. Once we have a lower-level spec we can re-map it on the appropriate OpenCL extension. Spec: #4237 Signed-off-by: Dmitry Sidorov <[email protected]>
1 parent 7dfaf3b commit 423ff17

File tree

7 files changed

+30
-1
lines changed

7 files changed

+30
-1
lines changed

sycl/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
1313
include(AddSYCLExecutable)
1414

1515
set(SYCL_MAJOR_VERSION 5)
16-
set(SYCL_MINOR_VERSION 3)
16+
set(SYCL_MINOR_VERSION 4)
1717
set(SYCL_PATCH_VERSION 0)
1818
set(SYCL_DEV_ABI_VERSION 0)
1919
if (SYCL_ADD_DEV_VERSION_POSTFIX)

sycl/include/CL/sycl/aspects.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ enum class aspect {
4646
atomic64 = 28,
4747
ext_intel_device_info_uuid = 29,
4848
ext_oneapi_srgb = 30,
49+
ext_intel_bf16_conversion = 31,
4950
};
5051

5152
} // namespace sycl

sycl/include/CL/sycl/info/device_traits.def

+1
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,4 @@ __SYCL_PARAM_TRAITS_SPEC(device, ext_intel_max_mem_bandwidth, pi_uint64)
9898
__SYCL_PARAM_TRAITS_SPEC(device, ext_intel_mem_channel, bool)
9999
__SYCL_PARAM_TRAITS_SPEC(device, ext_oneapi_srgb, bool)
100100
__SYCL_PARAM_TRAITS_SPEC(device, ext_intel_device_info_uuid, detail::uuid_type)
101+
__SYCL_PARAM_TRAITS_SPEC(device, ext_intel_bf16_conversion, bool)

sycl/include/CL/sycl/info/info_desc.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ enum class device : cl_device_info {
154154
atomic64 = PI_DEVICE_INFO_ATOMIC_64,
155155
atomic_memory_order_capabilities =
156156
PI_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES,
157+
ext_intel_bf16_conversion,
157158
};
158159

159160
enum class device_type : pi_uint64 {

sycl/source/detail/device_info.hpp

+22
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,23 @@ template <> struct get_device_info<device, info::device::parent_device> {
493493
}
494494
};
495495

496+
// Specialization for bfloat16
497+
template <>
498+
struct get_device_info<bool, info::device::ext_intel_bf16_conversion> {
499+
static bool get(RT::PiDevice dev, const plugin &Plugin) {
500+
// TODO: We claim, that all Intel GPU devices support bfloat16 conversion
501+
// feature but we'd better have a low-level extension to query for support
502+
// of the feature
503+
platform plt =
504+
get_device_info<platform, info::device::platform>::get(dev, Plugin);
505+
std::string platform_name = plt.get_info<info::platform::name>();
506+
if (platform_name == "Intel(R) OpenCL HD Graphics")
507+
return true;
508+
509+
return false;
510+
}
511+
};
512+
496513
// SYCL host device information
497514

498515
// Default template is disabled, all possible instantiations are
@@ -998,6 +1015,11 @@ inline bool get_device_info_host<info::device::ext_intel_mem_channel>() {
9981015
return false;
9991016
}
10001017

1018+
template <>
1019+
inline bool get_device_info_host<info::device::ext_intel_bf16_conversion>() {
1020+
return false;
1021+
}
1022+
10011023
cl_uint get_native_vector_width(size_t idx);
10021024

10031025
// USM

sycl/test/abi/sycl_symbols_linux.dump

+1
Original file line numberDiff line numberDiff line change
@@ -4173,6 +4173,7 @@ _ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE65574EEENS3_12param_traitsIS4_XT_
41734173
_ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE65575EEENS3_12param_traitsIS4_XT_EE11return_typeEv
41744174
_ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE65808EEENS3_12param_traitsIS4_XT_EE11return_typeEv
41754175
_ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE65809EEENS3_12param_traitsIS4_XT_EE11return_typeEv
4176+
_ZNK2cl4sycl6device8get_infoILNS0_4info6deviceE65810EEENS3_12param_traitsIS4_XT_EE11return_typeEv
41764177
_ZNK2cl4sycl6device9getNativeEv
41774178
_ZNK2cl4sycl6kernel11get_contextEv
41784179
_ZNK2cl4sycl6kernel11get_programEv

sycl/test/on-device/basic_tests/aspects.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ int main() {
9696
if (plt.has(aspect::usm_system_allocations)) {
9797
std::cout << " USM system allocations" << std::endl;
9898
}
99+
if (plt.has(aspect::ext_intel_bf16_conversion)) {
100+
std::cout << " BFloat16 conversion extension" << std::endl;
101+
}
99102
}
100103
std::cout << "Passed." << std::endl;
101104
return 0;

0 commit comments

Comments
 (0)