feature: bindless image extension - image properties

- add support for device image properties
(ze_device_pitched_alloc_exp_properties_t)

Related-To: NEO-10352

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe 2024-02-14 14:42:58 +00:00 committed by Compute-Runtime-Automation
parent 2061b5bedf
commit a22b9f454d
2 changed files with 40 additions and 0 deletions

View File

@ -1138,6 +1138,16 @@ ze_result_t DeviceImp::getDeviceImageProperties(ze_device_image_properties_t *pD
pDeviceImageProperties->maxSamplers = deviceInfo.maxSamplers;
pDeviceImageProperties->maxReadImageArgs = deviceInfo.maxReadImageArgs;
pDeviceImageProperties->maxWriteImageArgs = deviceInfo.maxWriteImageArgs;
ze_base_properties_t *extendedProperties = reinterpret_cast<ze_base_properties_t *>(pDeviceImageProperties->pNext);
while (extendedProperties) {
if (extendedProperties->stype == ZE_STRUCTURE_TYPE_PITCHED_ALLOC_DEVICE_EXP_PROPERTIES) {
ze_device_pitched_alloc_exp_properties_t *properties = reinterpret_cast<ze_device_pitched_alloc_exp_properties_t *>(extendedProperties);
properties->maxImageLinearHeight = deviceInfo.image2DMaxHeight;
properties->maxImageLinearWidth = deviceInfo.image2DMaxWidth;
}
extendedProperties = reinterpret_cast<ze_base_properties_t *>(extendedProperties->pNext);
}
} else {
pDeviceImageProperties->maxImageDims1D = 0u;
pDeviceImageProperties->maxImageDims2D = 0u;

View File

@ -4081,6 +4081,36 @@ TEST(zeDevice, givenValidImagePropertiesStructWhenGettingImagePropertiesThenSucc
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
}
TEST(zeDevice, givenPitchedAllocPropertiesStructWhenGettingImagePropertiesThenCorrectPropertiesAreReturned) {
ze_result_t errorValue;
DriverHandleImp driverHandle{};
NEO::MockDevice *neoDevice = (NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get(), 0));
auto device = std::unique_ptr<L0::Device>(Device::create(&driverHandle, neoDevice, false, &errorValue));
DeviceInfo &deviceInfo = neoDevice->deviceInfo;
neoDevice->deviceInfo.imageSupport = true;
deviceInfo.image2DMaxWidth = 32;
deviceInfo.image2DMaxHeight = 16;
deviceInfo.image3DMaxDepth = 1;
deviceInfo.imageMaxBufferSize = 1024;
deviceInfo.imageMaxArraySize = 1;
deviceInfo.maxSamplers = 6;
deviceInfo.maxReadImageArgs = 7;
deviceInfo.maxWriteImageArgs = 8;
ze_result_t result = ZE_RESULT_SUCCESS;
ze_device_pitched_alloc_exp_properties_t extendedProperties = {};
extendedProperties.stype = ZE_STRUCTURE_TYPE_PITCHED_ALLOC_DEVICE_EXP_PROPERTIES;
ze_device_image_properties_t imageProperties;
imageProperties.pNext = &extendedProperties;
result = zeDeviceGetImageProperties(device->toHandle(), &imageProperties);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(32u, extendedProperties.maxImageLinearWidth);
EXPECT_EQ(16u, extendedProperties.maxImageLinearHeight);
}
TEST(zeDevice, givenImagesSupportedWhenGettingImagePropertiesThenValidValuesAreReturned) {
ze_result_t errorValue;