Skip to content

Commit 0794e64

Browse files
authored
[XPU] Get mem_clock_rate and sm_clock_rate in KHz instead of MHz to align with other backends (#5454)
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
1 parent 5ac41b4 commit 0794e64

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

third_party/intel/backend/driver.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ extern "C" EXPORT_FUNC PyObject *get_device_properties(int device_id) {
5353

5454
int multiprocessor_count =
5555
device_properties.numSlices * device_properties.numSubslicesPerSlice;
56-
int sm_clock_rate = device_properties.coreClockRate;
56+
// To align with other backends - convert MHz to KHz
57+
int sm_clock_rate = device_properties.coreClockRate * 1000;
5758

5859
ze_device_compute_properties_t compute_properties = {};
5960
compute_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_COMPUTE_PROPERTIES;
@@ -76,7 +77,9 @@ extern "C" EXPORT_FUNC PyObject *get_device_properties(int device_id) {
7677
}
7778
zeDeviceGetMemoryProperties(phDevice, &memoryCount, pMemoryProperties);
7879

79-
int mem_clock_rate = pMemoryProperties[0].maxClockRate;
80+
// To align with other backends - convert MHz to KHz
81+
// https://github.com/intel/compute-runtime/blob/cfa007e5519d3a038d726b62237b86fca9a49e2c/shared/source/xe_hpc_core/linux/product_helper_pvc.cpp#L51
82+
int mem_clock_rate = pMemoryProperties[0].maxClockRate * 1000;
8083
int mem_bus_width = pMemoryProperties[0].maxBusWidth;
8184

8285
delete[] pMemoryProperties;

third_party/intel/backend/proton_utils.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ extern "C" void getDeviceProperties(uint64_t index, uint32_t *clockRate,
8181
device_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;
8282
check(zeDeviceGetProperties(phDevice, &device_properties),
8383
"zeDeviceGetProperties");
84-
*clockRate = device_properties.coreClockRate;
84+
// To align with other backends - convert MHz to KHz
85+
*clockRate = device_properties.coreClockRate * 1000;
8586
*numSms =
8687
device_properties.numSlices * device_properties.numSubslicesPerSlice;
8788
// create a struct to hold device memory properties
@@ -96,7 +97,9 @@ extern "C" void getDeviceProperties(uint64_t index, uint32_t *clockRate,
9697
check(zeDeviceGetMemoryProperties(phDevice, &memoryCount, pMemoryProperties),
9798
"zeDeviceGetMemoryProperties");
9899

99-
*memoryClockRate = pMemoryProperties[0].maxClockRate;
100+
// To align with other backends - convert MHz to KHz
101+
// https://github.com/intel/compute-runtime/blob/cfa007e5519d3a038d726b62237b86fca9a49e2c/shared/source/xe_hpc_core/linux/product_helper_pvc.cpp#L51
102+
*memoryClockRate = pMemoryProperties[0].maxClockRate * 1000;
100103
*busWidth = pMemoryProperties[0].maxBusWidth;
101104

102105
delete[] pMemoryProperties;

0 commit comments

Comments
 (0)