From f6e0262eac95ec817df235e8515304aa5c322f97 Mon Sep 17 00:00:00 2001 From: Yevhenii Havrylko Date: Mon, 5 Aug 2024 20:04:07 +0000 Subject: [PATCH] Update device property names --- csrc/gpu/aten/core/DeviceInfo.h | 8 +++--- csrc/gpu/runtime/Device.cpp | 26 +++++++++++++------ csrc/gpu/runtime/DeviceProp.h | 8 +++--- .../csrc/xpu/Module.cpp | 25 +++++++++++------- 4 files changed, 42 insertions(+), 25 deletions(-) diff --git a/csrc/gpu/aten/core/DeviceInfo.h b/csrc/gpu/aten/core/DeviceInfo.h index 2bd0a4b01..a0fdbe150 100644 --- a/csrc/gpu/aten/core/DeviceInfo.h +++ b/csrc/gpu/aten/core/DeviceInfo.h @@ -34,10 +34,10 @@ struct DeviceInfo { uint32_t max_num_sub_groups; std::vector sub_group_sizes; bool support_fp64; - bool support_cl_bf16_conversion; - bool support_cl_sg_matmul_acc; - bool support_cl_sg_matmul_acc_tf32; - bool support_cl_sg_2d_block_io; + bool has_bf16_conversion; + bool has_subgroup_matrix_multiply_accumulate; + bool has_subgroup_matrix_multiply_accumulate_tensor_float32; + bool has_subgroup_2d_block_io; }; } // namespace dpcpp diff --git a/csrc/gpu/runtime/Device.cpp b/csrc/gpu/runtime/Device.cpp index fcf679453..9a76bccbd 100644 --- a/csrc/gpu/runtime/Device.cpp +++ b/csrc/gpu/runtime/Device.cpp @@ -323,10 +323,18 @@ static void initDeviceProperty(DeviceId device_id) { 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; - device_prop.support_cl_bf16_conversion = device.ext_oneapi_supports_cl_extension("cl_intel_bfloat16_conversions", &version); - device_prop.support_cl_sg_matmul_acc = device.ext_oneapi_supports_cl_extension("cl_intel_subgroup_matrix_multiply_accumulate", &version); - device_prop.support_cl_sg_matmul_acc_tf32 = device.ext_oneapi_supports_cl_extension("cl_intel_subgroup_matrix_multiply_accumulate_tensor_float32", &version); - device_prop.support_cl_sg_2d_block_io = device.ext_oneapi_supports_cl_extension("cl_intel_subgroup_2d_block_io", &version); + device_prop.has_bf16_conversion = device.ext_oneapi_supports_cl_extension( + "cl_intel_bfloat16_conversions", &version); + device_prop.has_subgroup_matrix_multiply_accumulate = + device.ext_oneapi_supports_cl_extension( + "cl_intel_subgroup_matrix_multiply_accumulate", &version); + device_prop.has_subgroup_matrix_multiply_accumulate_tensor_float32 = + device.ext_oneapi_supports_cl_extension( + "cl_intel_subgroup_matrix_multiply_accumulate_tensor_float32", + &version); + device_prop.has_subgroup_2d_block_io = + device.ext_oneapi_supports_cl_extension( + "cl_intel_subgroup_2d_block_io", &version); device_properties[device_id] = device_prop; @@ -361,10 +369,12 @@ static void initDeviceProperty(DeviceId device_id) { dev_info.max_num_sub_groups = device_prop.max_num_subgroup; dev_info.sub_group_sizes = device_prop.subgroup_sizes; dev_info.support_fp64 = device_prop.support_fp64; - dev_info.support_cl_bf16_conversion = device_prop.support_cl_bf16_conversion; - dev_info.support_cl_sg_matmul_acc = device_prop.support_cl_sg_matmul_acc; - dev_info.support_cl_sg_matmul_acc_tf32 = device_prop.support_cl_sg_matmul_acc_tf32; - dev_info.support_cl_sg_2d_block_io = device_prop.support_cl_sg_2d_block_io; + dev_info.has_bf16_conversion = device_prop.has_bf16_conversion; + dev_info.has_subgroup_matrix_multiply_accumulate = + device_prop.has_subgroup_matrix_multiply_accumulate; + dev_info.has_subgroup_matrix_multiply_accumulate_tensor_float32 = + device_prop.has_subgroup_matrix_multiply_accumulate_tensor_float32; + dev_info.has_subgroup_2d_block_io = device_prop.has_subgroup_2d_block_io; #if (defined(__INTEL_LLVM_COMPILER) && __INTEL_LLVM_COMPILER >= 20240100) dev_info.device_arch = static_cast(device_prop.device_arch); #else diff --git a/csrc/gpu/runtime/DeviceProp.h b/csrc/gpu/runtime/DeviceProp.h index b4bd5ce70..2f132b371 100644 --- a/csrc/gpu/runtime/DeviceProp.h +++ b/csrc/gpu/runtime/DeviceProp.h @@ -143,10 +143,10 @@ struct DeviceProp { bool support_fp64; bool support_atomic64; - bool support_cl_bf16_conversion; - bool support_cl_sg_matmul_acc; - bool support_cl_sg_matmul_acc_tf32; - bool support_cl_sg_2d_block_io; + bool has_bf16_conversion; + bool has_subgroup_matrix_multiply_accumulate; + bool has_subgroup_matrix_multiply_accumulate_tensor_float32; + bool has_subgroup_2d_block_io; }; } // namespace dpcpp diff --git a/intel_extension_for_pytorch/csrc/xpu/Module.cpp b/intel_extension_for_pytorch/csrc/xpu/Module.cpp index fb0a96a3f..229df040e 100644 --- a/intel_extension_for_pytorch/csrc/xpu/Module.cpp +++ b/intel_extension_for_pytorch/csrc/xpu/Module.cpp @@ -577,10 +577,15 @@ 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("support_cl_sg_matmul_acc", &DeviceInfo::support_cl_sg_matmul_acc) - .def_readonly("support_cl_sg_matmul_acc_tf32", &DeviceInfo::support_cl_sg_matmul_acc_tf32) - .def_readonly("support_cl_sg_2d_block_io", &DeviceInfo::support_cl_sg_2d_block_io) + .def_readonly("has_bf16_conversion", &DeviceInfo::has_bf16_conversion) + .def_readonly( + "has_subgroup_matrix_multiply_accumulate", + &DeviceInfo::has_subgroup_matrix_multiply_accumulate) + .def_readonly( + "has_subgroup_matrix_multiply_accumulate_tensor_float32", + &DeviceInfo::has_subgroup_matrix_multiply_accumulate_tensor_float32) + .def_readonly( + "has_subgroup_2d_block_io", &DeviceInfo::has_subgroup_2d_block_io) .def_readonly("device_arch", &DeviceInfo::device_arch) .def_property_readonly( "dev_type", [](const DeviceInfo& info) { return get_dev_type(info); }) @@ -593,11 +598,13 @@ 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 - << ", support_cl_bf16_conversion=" << info.support_cl_bf16_conversion - << ", support_cl_sg_matmul_acc=" << info.support_cl_sg_matmul_acc - << ", support_cl_sg_matmul_acc_tf32=" << info.support_cl_sg_matmul_acc_tf32 - << ", support_cl_sg_2d_block_io=" << info.support_cl_sg_2d_block_io + << ", device_arch=" << info.device_arch + << ", has_bf16_conversion=" << info.has_bf16_conversion + << ", has_subgroup_matrix_multiply_accumulate=" + << info.has_subgroup_matrix_multiply_accumulate + << ", has_subgroup_matrix_multiply_accumulate_tensor_float32=" + << info.has_subgroup_matrix_multiply_accumulate_tensor_float32 + << ", has_subgroup_2d_block_io=" << info.has_subgroup_2d_block_io << ")"; return stream.str(); });