Skip to content

Commit

Permalink
Add experimental check cl_bf16_conversion extention query
Browse files Browse the repository at this point in the history
  • Loading branch information
LiyangLingIntel committed Jun 27, 2024
1 parent fd4fce2 commit 9060485
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions csrc/gpu/aten/core/DeviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct DeviceInfo {
uint32_t max_num_sub_groups;
std::vector<size_t> sub_group_sizes;
bool support_fp64;
bool support_cl_bf16_conversion;
};

} // namespace dpcpp
Expand Down
3 changes: 3 additions & 0 deletions csrc/gpu/runtime/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ static void initDeviceProperty(DeviceId device_id) {
: 8;
device_prop.support_atomic64 = device.has(dpcpp_dev_aspect_atomic64);
device_prop.support_fp64 = device.has(dpcpp_dev_aspect_fp64);
sycl::ext::oneapi::experimental::cl_version version{20, 20, 20};
device_prop.support_cl_bf16_conversion = device.ext_oneapi_supports_cl_extension("cl_intel_bfloat16_conversions", &version);

device_properties[device_id] = device_prop;

Expand Down Expand Up @@ -358,6 +360,7 @@ static void initDeviceProperty(DeviceId device_id) {
dev_info.support_fp64 = device_prop.support_fp64;
#if (defined(__INTEL_LLVM_COMPILER) && __INTEL_LLVM_COMPILER >= 20240100)
dev_info.device_arch = static_cast<uint64_t>(device_prop.device_arch);
dev_info.support_cl_bf16_conversion = device_prop.support_cl_bf16_conversion;
#else
dev_info.device_arch = (uint64_t)0;
#endif
Expand Down
1 change: 1 addition & 0 deletions csrc/gpu/runtime/DeviceProp.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ struct DeviceProp {

bool support_fp64;
bool support_atomic64;
bool support_cl_bf16_conversion;
};

} // namespace dpcpp
Expand Down
4 changes: 3 additions & 1 deletion intel_extension_for_pytorch/csrc/xpu/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ static void register_xpu_device_info(PyObject* module) {
.def_readonly("max_num_sub_groups", &DeviceInfo::max_num_sub_groups)
.def_readonly("sub_group_sizes", &DeviceInfo::sub_group_sizes)
.def_readonly("has_fp64", &DeviceInfo::support_fp64)
.def_readonly("support_cl_bf16_conversion", &DeviceInfo::support_cl_bf16_conversion)
.def_readonly("device_arch", &DeviceInfo::device_arch)
.def_property_readonly(
"dev_type", [](const DeviceInfo& info) { return get_dev_type(info); })
Expand All @@ -589,7 +590,8 @@ static void register_xpu_device_info(PyObject* module) {
<< ", total_memory=" << info.global_mem_size / (1024 * 1024)
<< "MB, max_compute_units=" << info.max_compute_units
<< ", gpu_eu_count=" << info.gpu_eu_count
<< ", device_arch=" << info.device_arch << ")";
<< ", device_arch=" << info.device_arch
<< ", support_cl_bf16_conversion=" << info.support_cl_bf16_conversion << ")";
return stream.str();
});
}
Expand Down

0 comments on commit 9060485

Please sign in to comment.