mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
Correct getCacheProperties interface
Change-Id: I6e3cec56e78e7fad73f3afe5921ef156c308dd1d Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
3471b01f05
commit
d97db3d7dc
@@ -68,7 +68,7 @@ zeDeviceGetCacheProperties(
|
||||
ze_device_handle_t hDevice,
|
||||
uint32_t *pCount,
|
||||
ze_device_cache_properties_t *pCacheProperties) {
|
||||
return L0::Device::fromHandle(hDevice)->getCacheProperties(pCacheProperties);
|
||||
return L0::Device::fromHandle(hDevice)->getCacheProperties(pCount, pCacheProperties);
|
||||
}
|
||||
|
||||
ZE_APIEXPORT ze_result_t ZE_APICALL
|
||||
|
||||
@@ -66,7 +66,7 @@ struct Device : _ze_device_handle_t {
|
||||
virtual ze_result_t makeMemoryResident(void *ptr, size_t size) = 0;
|
||||
virtual ze_result_t setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) = 0;
|
||||
virtual ze_result_t setLastLevelCacheConfig(ze_cache_config_flags_t cacheConfig) = 0;
|
||||
virtual ze_result_t getCacheProperties(ze_device_cache_properties_t *pCacheProperties) = 0;
|
||||
virtual ze_result_t getCacheProperties(uint32_t *pCount, ze_device_cache_properties_t *pCacheProperties) = 0;
|
||||
virtual ze_result_t imageGetProperties(const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties) = 0;
|
||||
virtual ze_result_t getDeviceImageProperties(ze_device_image_properties_t *pDeviceImageProperties) = 0;
|
||||
|
||||
|
||||
@@ -456,10 +456,19 @@ ze_result_t DeviceImp::setLastLevelCacheConfig(ze_cache_config_flags_t cacheConf
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ze_result_t DeviceImp::getCacheProperties(ze_device_cache_properties_t *pCacheProperties) {
|
||||
ze_result_t DeviceImp::getCacheProperties(uint32_t *pCount, ze_device_cache_properties_t *pCacheProperties) {
|
||||
if (*pCount == 0) {
|
||||
*pCount = 1;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
if (*pCount > 1) {
|
||||
*pCount = 1;
|
||||
}
|
||||
|
||||
const auto &hardwareInfo = this->getHwInfo();
|
||||
pCacheProperties->cacheSize = getIntermediateCacheSize(hardwareInfo);
|
||||
pCacheProperties->flags = 0;
|
||||
pCacheProperties[0].cacheSize = getIntermediateCacheSize(hardwareInfo);
|
||||
pCacheProperties[0].flags = 0;
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ struct DeviceImp : public Device {
|
||||
ze_result_t makeMemoryResident(void *ptr, size_t size) override;
|
||||
ze_result_t setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) override;
|
||||
ze_result_t setLastLevelCacheConfig(ze_cache_config_flags_t cacheConfig) override;
|
||||
ze_result_t getCacheProperties(ze_device_cache_properties_t *pCacheProperties) override;
|
||||
ze_result_t getCacheProperties(uint32_t *pCount, ze_device_cache_properties_t *pCacheProperties) override;
|
||||
ze_result_t imageGetProperties(const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties) override;
|
||||
ze_result_t getDeviceImageProperties(ze_device_image_properties_t *pDeviceImageProperties) override;
|
||||
ze_result_t getCommandQueueGroupProperties(uint32_t *pCount,
|
||||
|
||||
@@ -135,10 +135,9 @@ struct Mock<Device> : public Device {
|
||||
(override));
|
||||
MOCK_METHOD(ze_result_t,
|
||||
getCacheProperties,
|
||||
|
||||
(ze_device_cache_properties_t * pCacheProperties),
|
||||
(uint32_t * pCount,
|
||||
ze_device_cache_properties_t *pCacheProperties),
|
||||
(override));
|
||||
|
||||
MOCK_METHOD(ze_result_t,
|
||||
imageGetProperties,
|
||||
(const ze_image_desc_t *desc,
|
||||
|
||||
Reference in New Issue
Block a user