Skip to content

Commit 932973b

Browse files
committed
Add get_cache_reservation_properties_ext(...) to harness
1 parent 433ea9b commit 932973b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

utils/test_harness/include/test_harness/test_harness_device.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ get_memory_access_properties(ze_device_handle_t device);
7676
bool is_concurrent_memory_access_supported(ze_device_handle_t device);
7777
std::vector<ze_device_cache_properties_t>
7878
get_cache_properties(ze_device_handle_t device);
79+
std::vector<ze_cache_reservation_ext_desc_t>
80+
get_cache_reservation_properties_ext(ze_device_handle_t device);
7981
ze_device_image_properties_t get_image_properties(ze_device_handle_t device);
8082
ze_device_module_properties_t
8183
get_device_module_properties(ze_device_handle_t device);

utils/test_harness/src/test_harness_device.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,31 @@ get_cache_properties(ze_device_handle_t device) {
319319
return properties;
320320
}
321321

322+
std::vector<ze_cache_reservation_ext_desc_t>
323+
get_cache_reservation_properties_ext(ze_device_handle_t device) {
324+
std::vector<ze_device_cache_properties_t> properties;
325+
std::vector<ze_cache_reservation_ext_desc_t> cacheReservationProperties;
326+
uint32_t count = 0;
327+
auto device_initial = device;
328+
EXPECT_ZE_RESULT_SUCCESS(zeDeviceGetCacheProperties(device, &count, nullptr));
329+
properties.resize(count);
330+
cacheReservationProperties.reserve(count);
331+
memset(properties.data(), 0, sizeof(ze_device_cache_properties_t) * count);
332+
memset(cacheReservationProperties.data(), 0,
333+
sizeof(ze_cache_reservation_ext_desc_t) * count);
334+
for (auto i = 0; i < count; i++) {
335+
properties[i].stype = ZE_STRUCTURE_TYPE_DEVICE_CACHE_PROPERTIES;
336+
cacheReservationProperties[i].stype =
337+
ZE_STRUCTURE_TYPE_CACHE_RESERVATION_EXT_DESC;
338+
properties[i].pNext = &cacheReservationProperties[i];
339+
}
340+
341+
EXPECT_ZE_RESULT_SUCCESS(
342+
zeDeviceGetCacheProperties(device, &count, properties.data()));
343+
EXPECT_EQ(device, device_initial);
344+
return cacheReservationProperties;
345+
}
346+
322347
ze_device_image_properties_t get_image_properties(ze_device_handle_t device) {
323348
ze_device_image_properties_t properties;
324349
memset(&properties, 0, sizeof(properties));

0 commit comments

Comments
 (0)