@@ -567,9 +567,13 @@ ur_result_t urDeviceGetInfo(
567
567
case UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE:
568
568
return ReturnValue (UR_DEVICE_MEM_CACHE_TYPE_READ_WRITE_CACHE);
569
569
case UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE:
570
- return ReturnValue (
571
- // TODO[1.0]: how to query cache line-size?
572
- uint32_t {1 });
570
+ if (Device->Platform ->zeDriverExtensionMap .count (
571
+ ZE_CACHELINE_SIZE_EXT_NAME)) {
572
+ return ReturnValue (uint32_t {static_cast <uint32_t >(
573
+ Device->ZeDeviceCacheLinePropertiesExt ->cacheLineSize )});
574
+ } else {
575
+ return ReturnValue (uint32_t {1 });
576
+ }
573
577
case UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE:
574
578
return ReturnValue (uint64_t {Device->ZeDeviceCacheProperties ->cacheSize });
575
579
case UR_DEVICE_INFO_IP_VERSION:
@@ -1856,6 +1860,28 @@ ur_result_t ur_device_handle_t_::initialize(int SubSubDeviceOrdinal,
1856
1860
(ZeDevice, &Count, &Properties));
1857
1861
};
1858
1862
1863
+ if (this ->Platform ->zeDriverExtensionMap .count (ZE_CACHELINE_SIZE_EXT_NAME)) {
1864
+ ZeDeviceCacheLinePropertiesExt.Compute =
1865
+ [ZeDevice](ze_device_cache_line_size_ext_t &Properties) {
1866
+ // TODO: Since v1.0 there can be multiple cache properties.
1867
+ // For now remember the first one, if any.
1868
+ uint32_t Count = 0 ;
1869
+ ZE_CALL_NOCHECK (zeDeviceGetCacheProperties,
1870
+ (ZeDevice, &Count, nullptr ));
1871
+ if (Count > 0 )
1872
+ Count = 1 ;
1873
+ ze_device_cache_properties_t P;
1874
+ P.stype = ZE_STRUCTURE_TYPE_DEVICE_CACHE_PROPERTIES;
1875
+ P.pNext = &Properties;
1876
+ ZE_CALL_NOCHECK (zeDeviceGetCacheProperties, (ZeDevice, &Count, &P));
1877
+ if (Properties.cacheLineSize == 0 ) {
1878
+ // If cache line size is not set, use the default value.
1879
+ Properties.cacheLineSize =
1880
+ 1 ; // Default cache line size property value.
1881
+ }
1882
+ };
1883
+ }
1884
+
1859
1885
ZeDeviceMutableCmdListsProperties.Compute =
1860
1886
[ZeDevice](
1861
1887
ZeStruct<ze_mutable_command_list_exp_properties_t > &Properties) {
0 commit comments