mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Add device_id to XPU device properties (#156481)
# Motivation
Some older Intel iGPUs may share the same device name across different hardware products.
(See [device name example](aaa01c06f9/shared/source/dll/devices/devices_base.inl (L190-L199)
))
To help disambiguate which specific iGPU product is being used, we introduce the use of a
[device id](https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_intel_device_info.md#device-id). This device id corresponds to the Device ID in [official Intel product specification](https://www.intel.com/content/www/us/en/products/sku/232155/intel-core-i71360p-processor-18m-cache-up-to-5-00-ghz/specifications.html) and enables more accurate identification and troubleshooting for user issues.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/156481
Approved by: https://github.com/EikanWang, https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
7597988f1b
commit
5cc4e856fd
@ -113,18 +113,21 @@ namespace c10::xpu {
|
||||
_(native_vector_width_double) \
|
||||
_(native_vector_width_half)
|
||||
|
||||
#define AT_FORALL_XPU_EXT_DEVICE_PROPERTIES(_) \
|
||||
/* the number of EUs associated with the Intel GPU. */ \
|
||||
_(gpu_eu_count, 512) \
|
||||
\
|
||||
/* the number of EUs in a subslice. */ \
|
||||
_(gpu_eu_count_per_subslice, 8) \
|
||||
\
|
||||
/* the simd width of EU of GPU. */ \
|
||||
_(gpu_eu_simd_width, 8) \
|
||||
\
|
||||
/* the number of hardware threads per EU of GPU. */ \
|
||||
_(gpu_hw_threads_per_eu, 8)
|
||||
#define AT_FORALL_XPU_EXT_DEVICE_PROPERTIES(_) \
|
||||
/* the number of EUs associated with the Intel GPU. */ \
|
||||
_(gpu_eu_count, 512) \
|
||||
\
|
||||
/* the number of EUs in a subslice. */ \
|
||||
_(gpu_eu_count_per_subslice, 8) \
|
||||
\
|
||||
/* the simd width of EU of GPU. */ \
|
||||
_(gpu_eu_simd_width, 8) \
|
||||
\
|
||||
/* the number of hardware threads per EU of GPU. */ \
|
||||
_(gpu_hw_threads_per_eu, 8) \
|
||||
\
|
||||
/* the device identifier of the Intel GPU, also known as the product ID. */ \
|
||||
_(device_id, 0)
|
||||
|
||||
#define AT_FORALL_XPU_DEVICE_ASPECT(_) \
|
||||
/* sycl::half is supported on device. */ \
|
||||
|
@ -101,6 +101,7 @@ class TestXpu(TestCase):
|
||||
self.assertEqual(device_name, torch.xpu.get_device_name())
|
||||
|
||||
device_capability = torch.xpu.get_device_capability(current_device)
|
||||
self.assertTrue(device_capability["device_id"] > 0)
|
||||
self.assertTrue(device_capability["max_work_group_size"] > 0)
|
||||
self.assertTrue(device_capability["max_num_sub_groups"] > 0)
|
||||
self.assertEqual(
|
||||
|
@ -2342,6 +2342,7 @@ class _XpuDeviceProperties:
|
||||
name: str
|
||||
platform_name: str
|
||||
vendor: str
|
||||
device_id: _int
|
||||
driver_version: str
|
||||
version: str
|
||||
max_compute_units: _int
|
||||
|
@ -305,6 +305,7 @@ static void registerXpuDeviceProperties(PyObject* module) {
|
||||
._(name) \
|
||||
._(platform_name) \
|
||||
._(vendor) \
|
||||
._(device_id) \
|
||||
._(driver_version) \
|
||||
._(version) \
|
||||
._(max_compute_units) \
|
||||
@ -333,8 +334,10 @@ static void registerXpuDeviceProperties(PyObject* module) {
|
||||
std::ostringstream stream;
|
||||
stream << "_XpuDeviceProperties(name='" << prop.name
|
||||
<< "', platform_name='" << prop.platform_name << "', type='"
|
||||
<< get_device_type(prop) << "', driver_version='"
|
||||
<< prop.driver_version << "', total_memory="
|
||||
<< get_device_type(prop) << "', device_id=0x" << std::hex
|
||||
<< std::uppercase << prop.device_id << std::dec
|
||||
<< ", driver_version='" << prop.driver_version
|
||||
<< "', total_memory="
|
||||
<< prop.global_mem_size / (1024ull * 1024) << "MB"
|
||||
<< ", max_compute_units=" << prop.max_compute_units
|
||||
<< ", gpu_eu_count=" << prop.gpu_eu_count
|
||||
|
Reference in New Issue
Block a user