diff --git a/level_zero/api/core/ze_core_loader.cpp b/level_zero/api/core/ze_core_loader.cpp index 7aa93b3d35..9aa3ccfb5a 100644 --- a/level_zero/api/core/ze_core_loader.cpp +++ b/level_zero/api/core/ze_core_loader.cpp @@ -698,6 +698,7 @@ zeGetImageExpProcAddrTable( ze_result_t result = ZE_RESULT_SUCCESS; fillDdiEntry(pDdiTable->pfnGetMemoryPropertiesExp, L0::zeImageGetMemoryPropertiesExp, version, ZE_API_VERSION_1_2); fillDdiEntry(pDdiTable->pfnViewCreateExp, L0::zeImageViewCreateExp, version, ZE_API_VERSION_1_2); + fillDdiEntry(pDdiTable->pfnGetDeviceOffsetExp, L0::zeImageGetDeviceOffsetExp, version, ZE_API_VERSION_1_9); driverDdiTable.coreDdiTable.ImageExp = *pDdiTable; return result; } diff --git a/level_zero/api/driver_experimental/public/ze_bindless_image_exp.h b/level_zero/api/driver_experimental/public/ze_bindless_image_exp.h index 755fc6b053..4445dd5047 100644 --- a/level_zero/api/driver_experimental/public/ze_bindless_image_exp.h +++ b/level_zero/api/driver_experimental/public/ze_bindless_image_exp.h @@ -24,6 +24,7 @@ typedef enum _ze_bindless_image_exp_version_t { typedef enum _ze_image_bindless_exp_flags_t { ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS = ZE_BIT(0), + ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE = ZE_BIT(1), ZE_IMAGE_BINDLESS_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_image_bindless_exp_flags_t; @@ -72,4 +73,7 @@ zeImageGetDeviceOffsetExp( uint64_t *pDeviceOffset); #endif // ZE_BINDLESS_IMAGE_EXP_NAME + +#define ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE 2 + #endif \ No newline at end of file diff --git a/level_zero/core/source/helpers/properties_parser.h b/level_zero/core/source/helpers/properties_parser.h index 7e2114f830..825d35450a 100644 --- a/level_zero/core/source/helpers/properties_parser.h +++ b/level_zero/core/source/helpers/properties_parser.h @@ -59,6 +59,7 @@ struct StructuresLookupTable { uint32_t planeIndex; bool isPlanarExtension; void *pitchedPtr; + const ze_sampler_desc_t *samplerDesc; } imageProperties; struct SharedHandleType { @@ -77,6 +78,7 @@ struct StructuresLookupTable { bool uncompressedHint; bool rayTracingMemory; bool bindlessImage; + bool sampledImage; }; inline ze_result_t prepareL0StructuresLookupTable(StructuresLookupTable &lookupTable, const void *desc) { @@ -122,11 +124,15 @@ inline ze_result_t prepareL0StructuresLookupTable(StructuresLookupTable &lookupT const ze_image_bindless_exp_desc_t *imageBindlessDesc = reinterpret_cast(extendedDesc); lookupTable.bindlessImage = imageBindlessDesc->flags & ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS; - + lookupTable.sampledImage = imageBindlessDesc->flags & ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE; } else if (extendedDesc->stype == ZE_STRUCTURE_TYPE_PITCHED_IMAGE_EXP_DESC) { const ze_image_pitched_exp_desc_t *pitchedDesc = reinterpret_cast(extendedDesc); lookupTable.areImageProperties = true; lookupTable.imageProperties.pitchedPtr = pitchedDesc->ptr; + } else if (extendedDesc->stype == ZE_STRUCTURE_TYPE_SAMPLER_DESC) { + const ze_sampler_desc_t *samplerDesc = reinterpret_cast(extendedDesc); + lookupTable.areImageProperties = true; + lookupTable.imageProperties.samplerDesc = samplerDesc; } else if (extendedDesc->stype == ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC) { const ze_relaxed_allocation_limits_exp_desc_t *relaxedLimitsDesc = reinterpret_cast(extendedDesc); diff --git a/level_zero/core/source/image/image_hw.inl b/level_zero/core/source/image/image_hw.inl index 2ce8425996..7f6b180174 100644 --- a/level_zero/core/source/image/image_hw.inl +++ b/level_zero/core/source/image/image_hw.inl @@ -13,6 +13,7 @@ #include "shared/source/gmm_helper/gmm.h" #include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/basic_math.h" +#include "shared/source/helpers/bindless_heaps_helper.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/surface_format_info.h" #include "shared/source/image/image_surface_state.h" @@ -28,6 +29,7 @@ #include "level_zero/core/source/image/image_format_desc_helper.h" #include "level_zero/core/source/image/image_formats.h" #include "level_zero/core/source/image/image_hw.h" +#include "level_zero/core/source/sampler/sampler_imp.h" #include "encode_surface_state_args.h" @@ -96,6 +98,15 @@ ze_result_t ImageCoreFamily::initialize(Device *device, const ze_ this->imageFromBuffer = true; } + if (lookupTable.sampledImage) { + if (!this->bindlessImage || lookupTable.imageProperties.samplerDesc == nullptr) { + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + } + this->sampledImage = true; + this->samplerDesc = *lookupTable.imageProperties.samplerDesc; + this->samplerDesc.pNext = nullptr; + } + if (!isImageView()) { if (lookupTable.isSharedHandle) { if (!lookupTable.sharedHandleType.isSupportedHandle) { @@ -217,6 +228,20 @@ ze_result_t ImageCoreFamily::initialize(Device *device, const ze_ if (this->bindlessImage) { auto ssInHeap = getBindlessSlot(); copySurfaceStateToSSH(ssInHeap->ssPtr, 0u, false); + + if (this->sampledImage) { + auto productFamily = this->device->getNEODevice()->getHardwareInfo().platform.eProductFamily; + auto sampler = Sampler::create(productFamily, device, &this->samplerDesc); + if (!sampler) { + return ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + auto &gfxCoreHelper = this->device->getGfxCoreHelper(); + auto surfaceStateSize = gfxCoreHelper.getRenderSurfaceStateSize(); + auto samplerStateOffset = static_cast(NEO::BindlessImageSlot::sampler * surfaceStateSize); + + sampler->copySamplerStateToDSH(ssInHeap->ssPtr, static_cast(ssInHeap->ssSize), samplerStateOffset); + sampler->destroy(); + } } if (this->bindlessImage && implicitArgsAllocation) { diff --git a/level_zero/core/source/image/image_imp.cpp b/level_zero/core/source/image/image_imp.cpp index d8c65d2130..309ae2a803 100644 --- a/level_zero/core/source/image/image_imp.cpp +++ b/level_zero/core/source/image/image_imp.cpp @@ -112,7 +112,7 @@ ze_result_t ImageImp::allocateBindlessSlot() { if (bindlessHelper && !bindlessInfo) { auto &gfxCoreHelper = this->device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[allocation->getRootDeviceIndex()]->getHelper(); - const auto surfStateCount = 3; + const auto surfStateCount = NEO::BindlessImageSlot::max; auto surfaceStateSize = surfStateCount * gfxCoreHelper.getRenderSurfaceStateSize(); auto surfaceStateInfo = bindlessHelper->allocateSSInHeap(surfaceStateSize, allocation, NEO::BindlessHeapsHelper::globalSsh); diff --git a/level_zero/core/source/image/image_imp.h b/level_zero/core/source/image/image_imp.h index 8e761c61eb..4924bf8e1b 100644 --- a/level_zero/core/source/image/image_imp.h +++ b/level_zero/core/source/image/image_imp.h @@ -57,9 +57,11 @@ struct ImageImp : public Image, NEO::NonCopyableOrMovableClass { NEO::GraphicsAllocation *allocation = nullptr; NEO::GraphicsAllocation *implicitArgsAllocation = nullptr; ze_image_desc_t imageFormatDesc = {}; + ze_sampler_desc_t samplerDesc = {}; std::optional sourceImageFormatDesc = {}; std::unique_ptr bindlessInfo; bool bindlessImage = false; bool imageFromBuffer = false; + bool sampledImage = false; }; } // namespace L0 diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index 0c68046f22..8094db6aa7 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -613,12 +613,12 @@ ze_result_t KernelImp::setArgRedescribedImage(uint32_t argIndex, ze_image_handle auto ssInHeap = image->getBindlessSlot(); auto patchLocation = ptrOffset(getCrossThreadData(), arg.bindless); - // redescribed image's surface state is after image's implicit args - auto bindlessSlotOffset = ssInHeap->surfaceStateOffset + surfaceStateSize * 2; + // redescribed image's surface state is after image's implicit args and sampler + auto bindlessSlotOffset = ssInHeap->surfaceStateOffset + surfaceStateSize * NEO::BindlessImageSlot::redescribedImage; auto patchValue = gfxCoreHelper.getBindlessSurfaceExtendedMessageDescriptorValue(static_cast(bindlessSlotOffset)); patchWithRequiredSize(const_cast(patchLocation), sizeof(patchValue), patchValue); - image->copyRedescribedSurfaceStateToSSH(ptrOffset(ssInHeap->ssPtr, surfaceStateSize * 2), 0u); + image->copyRedescribedSurfaceStateToSSH(ptrOffset(ssInHeap->ssPtr, surfaceStateSize * NEO::BindlessImageSlot::redescribedImage), 0u); isBindlessOffsetSet[argIndex] = true; this->residencyContainer.push_back(ssInHeap->heapAllocation); } else { diff --git a/level_zero/core/test/unit_tests/mocks/mock_image.h b/level_zero/core/test/unit_tests/mocks/mock_image.h index 816eea2a42..1ca67c48ec 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_image.h +++ b/level_zero/core/test/unit_tests/mocks/mock_image.h @@ -29,9 +29,9 @@ struct WhiteBox<::L0::ImageCoreFamily> using BaseClass::redescribedSurfaceState; using BaseClass::surfaceState; using BaseClass::ImageImp::imageFromBuffer; - ; using BaseClass::ImageImp::imgInfo; - ; + using BaseClass::ImageImp::sampledImage; + using BaseClass::ImageImp::samplerDesc; }; } // namespace ult diff --git a/level_zero/core/test/unit_tests/sources/image/test_image.cpp b/level_zero/core/test/unit_tests/sources/image/test_image.cpp index eb0d81f5e8..a094008fe5 100644 --- a/level_zero/core/test/unit_tests/sources/image/test_image.cpp +++ b/level_zero/core/test/unit_tests/sources/image/test_image.cpp @@ -1539,7 +1539,14 @@ HWTEST2_F(ImageCreate, WhenImageViewCreateExtThenSuccessIsReturned, IsAtLeastSkl zeImageDestroy(planeY); } -HWTEST2_F(ImageCreate, GivenNonBindlessImageWhenGettingDeviceOffsetThenErrorIsReturned, IsAtLeastSkl) { +struct ImageSupport { + template + static constexpr bool isMatched() { + return productFamily >= IGFX_SKYLAKE && NEO::HwMapper::GfxProduct::supportsSampler; + } +}; + +HWTEST2_F(ImageCreate, GivenNonBindlessImageWhenGettingDeviceOffsetThenErrorIsReturned, ImageSupport) { const size_t width = 32; const size_t height = 32; const size_t depth = 1; @@ -1569,7 +1576,7 @@ HWTEST2_F(ImageCreate, GivenNonBindlessImageWhenGettingDeviceOffsetThenErrorIsRe ASSERT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, ret); } -HWTEST2_F(ImageCreate, GivenNoBindlessHelperAndBindlessImageFlagWhenCreatingImageThenErrorIsReturned, IsAtLeastSkl) { +HWTEST2_F(ImageCreate, GivenNoBindlessHelperAndBindlessImageFlagWhenCreatingImageThenErrorIsReturned, ImageSupport) { const size_t width = 32; const size_t height = 32; const size_t depth = 1; @@ -1597,7 +1604,7 @@ HWTEST2_F(ImageCreate, GivenNoBindlessHelperAndBindlessImageFlagWhenCreatingImag ASSERT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret); } -HWTEST2_F(ImageCreate, GivenBindlessImageWhenGettingDeviceOffsetThenBindlessSlotIsReturned, IsAtLeastSkl) { +HWTEST2_F(ImageCreate, GivenBindlessImageWhenGettingDeviceOffsetThenBindlessSlotIsReturned, ImageSupport) { const size_t width = 32; const size_t height = 32; const size_t depth = 1; @@ -1641,7 +1648,7 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenGettingDeviceOffsetThenBindlessSlot EXPECT_EQ(ssHeapInfo->surfaceStateOffset, deviceOffset); } -HWTEST2_F(ImageCreate, GivenBindlessImageWhenBindlessSlotAllocationFailsThenImageInitializationFails, IsAtLeastSkl) { +HWTEST2_F(ImageCreate, GivenBindlessImageWhenBindlessSlotAllocationFailsThenImageInitializationFails, ImageSupport) { const size_t width = 32; const size_t height = 32; const size_t depth = 1; @@ -1676,7 +1683,7 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenBindlessSlotAllocationFailsThenImag ASSERT_EQ(ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY, ret); } -HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageCreatedWithInvalidPitchedPtrThenErrorIsReturned, IsAtLeastSkl) { +HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageCreatedWithInvalidPitchedPtrThenErrorIsReturned, ImageSupport) { const size_t width = 32; const size_t height = 32; const size_t depth = 1; @@ -1711,7 +1718,7 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageCreatedWithInvalidPitchedPtrTh ASSERT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, ret); } -HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageCreatedWithDeviceUMSPitchedPtrThenImageIsCreated, IsAtLeastSkl) { +HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageCreatedWithDeviceUMSPitchedPtrThenImageIsCreated, ImageSupport) { const size_t width = 32; const size_t height = 32; const size_t depth = 1; @@ -1782,7 +1789,7 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageCreatedWithDeviceUMSPitchedPtr EXPECT_EQ(ZE_RESULT_SUCCESS, ret); } -HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageViewCreatedWithDeviceUMSPitchedPtrThenErrorIsReturned, IsAtLeastSkl) { +HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageViewCreatedWithDeviceUMSPitchedPtrThenErrorIsReturned, ImageSupport) { const size_t width = 32; const size_t height = 32; const size_t depth = 1; @@ -1827,7 +1834,7 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageViewCreatedWithDeviceUMSPitche ret = context->freeMem(ptr); } -HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageViewCreatedWithTheSameFormatThenImageViewHasCorrectImgInfo, IsAtLeastSkl) { +HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageViewCreatedWithTheSameFormatThenImageViewHasCorrectImgInfo, ImageSupport) { const size_t width = 32; const size_t height = 32; const size_t depth = 1; @@ -1887,7 +1894,7 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageViewCreatedWithTheSameFormatTh ret = context->freeMem(ptr); } -HWTEST2_F(ImageCreate, GivenBindlessImageWhenInitializedThenSurfaceStateCopiedToSSH, IsAtLeastSkl) { +HWTEST2_F(ImageCreate, GivenBindlessImageWhenInitializedThenSurfaceStateCopiedToSSH, ImageSupport) { const size_t width = 32; const size_t height = 32; const size_t depth = 1; @@ -1931,5 +1938,349 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenInitializedThenSurfaceStateCopiedTo ASSERT_EQ(surfaceState->getDepth(), depth); } +HWTEST2_F(ImageCreate, GivenBindlessSampledImageWhenCreatedThenSampledImageFlagAndSamplerDescIsSet, ImageSupport) { + const size_t width = 32; + const size_t height = 32; + const size_t depth = 1; + + auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice, + neoDevice->getNumGenericSubDevices() > 1); + neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper); + + ze_sampler_desc_t samplerDesc = { + ZE_STRUCTURE_TYPE_SAMPLER_DESC, + nullptr, + ZE_SAMPLER_ADDRESS_MODE_CLAMP, + ZE_SAMPLER_FILTER_MODE_LINEAR, + false}; + + ze_image_bindless_exp_desc_t bindlessExtDesc = {}; + bindlessExtDesc.stype = ZE_STRUCTURE_TYPE_BINDLESS_IMAGE_EXP_DESC; + bindlessExtDesc.pNext = &samplerDesc; + bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS | ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE; + + ze_image_desc_t srcImgDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC, + &bindlessExtDesc, + ZE_IMAGE_FLAG_KERNEL_WRITE, + ZE_IMAGE_TYPE_2D, + {ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8, ZE_IMAGE_FORMAT_TYPE_UINT, + ZE_IMAGE_FORMAT_SWIZZLE_R, ZE_IMAGE_FORMAT_SWIZZLE_G, + ZE_IMAGE_FORMAT_SWIZZLE_B, ZE_IMAGE_FORMAT_SWIZZLE_A}, + width, + height, + depth, + 0, + 0}; + + auto imageHW = std::make_unique>>(); + auto ret = imageHW->initialize(device, &srcImgDesc); + ASSERT_EQ(ZE_RESULT_SUCCESS, ret); + + EXPECT_TRUE(imageHW->bindlessImage); + + EXPECT_TRUE(imageHW->sampledImage); + EXPECT_EQ(imageHW->samplerDesc.addressMode, samplerDesc.addressMode); + EXPECT_EQ(imageHW->samplerDesc.filterMode, samplerDesc.filterMode); + EXPECT_EQ(imageHW->samplerDesc.isNormalized, samplerDesc.isNormalized); + EXPECT_EQ(nullptr, imageHW->samplerDesc.pNext); +} + +HWTEST2_F(ImageCreate, GivenBindlessSampledImageWhenImageViewCreatedWithCorrectFlagsThenImageCreationIsSuccessful, ImageSupport) { + const size_t width = 32; + const size_t height = 32; + const size_t depth = 1; + + auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice, + neoDevice->getNumGenericSubDevices() > 1); + neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper); + + ze_sampler_desc_t samplerDesc = { + ZE_STRUCTURE_TYPE_SAMPLER_DESC, + nullptr, + ZE_SAMPLER_ADDRESS_MODE_CLAMP, + ZE_SAMPLER_FILTER_MODE_LINEAR, + false}; + + ze_image_bindless_exp_desc_t bindlessExtDesc = {}; + bindlessExtDesc.stype = ZE_STRUCTURE_TYPE_BINDLESS_IMAGE_EXP_DESC; + bindlessExtDesc.pNext = &samplerDesc; + bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS | ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE; + + ze_image_desc_t srcImgDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC, + &bindlessExtDesc, + ZE_IMAGE_FLAG_KERNEL_WRITE, + ZE_IMAGE_TYPE_2D, + {ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8, ZE_IMAGE_FORMAT_TYPE_UINT, + ZE_IMAGE_FORMAT_SWIZZLE_R, ZE_IMAGE_FORMAT_SWIZZLE_G, + ZE_IMAGE_FORMAT_SWIZZLE_B, ZE_IMAGE_FORMAT_SWIZZLE_A}, + width, + height, + depth, + 0, + 0}; + + auto imageHW = std::make_unique>>(); + auto ret = imageHW->initialize(device, &srcImgDesc); + ASSERT_EQ(ZE_RESULT_SUCCESS, ret); + + EXPECT_TRUE(imageHW->bindlessImage); + + ze_image_handle_t imageView = {}; + bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE; + bindlessExtDesc.pNext = nullptr; + ret = imageHW->createView(device, &srcImgDesc, &imageView); + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, ret); + + bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS | ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE; + bindlessExtDesc.pNext = nullptr; + ret = imageHW->createView(device, &srcImgDesc, &imageView); + EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, ret); + + bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS | ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE; + bindlessExtDesc.pNext = &samplerDesc; + ret = imageHW->createView(device, &srcImgDesc, &imageView); + EXPECT_EQ(ZE_RESULT_SUCCESS, ret); + + auto imageViewObject = static_cast> *>(Image::fromHandle(imageView)); + + EXPECT_TRUE(imageViewObject->bindlessImage); + EXPECT_TRUE(imageViewObject->sampledImage); + + EXPECT_EQ(ZE_SAMPLER_ADDRESS_MODE_CLAMP, imageViewObject->samplerDesc.addressMode); + EXPECT_EQ(ZE_SAMPLER_FILTER_MODE_LINEAR, imageViewObject->samplerDesc.filterMode); + + EXPECT_EQ(imageHW->imgInfo.slicePitch, imageViewObject->getImageInfo().slicePitch); + EXPECT_NE(0u, imageViewObject->getImageInfo().slicePitch); + EXPECT_EQ(imageHW->imgInfo.rowPitch, imageViewObject->getImageInfo().rowPitch); + EXPECT_NE(0u, imageViewObject->getImageInfo().rowPitch); + EXPECT_EQ(imageHW->imgInfo.offset, imageViewObject->getImageInfo().offset); + EXPECT_EQ(imageHW->imgInfo.size, imageViewObject->getImageInfo().size); + EXPECT_NE(0u, imageViewObject->getImageInfo().size); + EXPECT_EQ(imageHW->imgInfo.linearStorage, imageViewObject->getImageInfo().linearStorage); + + Image::fromHandle(imageView)->destroy(); +} + +HWTEST2_F(ImageCreate, GivenNoBindlessFlagWhenSampledImageCreatedThenErrorIsReturned, ImageSupport) { + const size_t width = 32; + const size_t height = 32; + const size_t depth = 1; + + auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice, + neoDevice->getNumGenericSubDevices() > 1); + neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper); + + ze_sampler_desc_t samplerDesc = { + ZE_STRUCTURE_TYPE_SAMPLER_DESC, + nullptr, + ZE_SAMPLER_ADDRESS_MODE_CLAMP, + ZE_SAMPLER_FILTER_MODE_LINEAR, + false}; + + ze_image_bindless_exp_desc_t bindlessExtDesc = {}; + bindlessExtDesc.stype = ZE_STRUCTURE_TYPE_BINDLESS_IMAGE_EXP_DESC; + bindlessExtDesc.pNext = &samplerDesc; + bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE; + + ze_image_desc_t srcImgDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC, + &bindlessExtDesc, + ZE_IMAGE_FLAG_KERNEL_WRITE, + ZE_IMAGE_TYPE_2D, + {ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8, ZE_IMAGE_FORMAT_TYPE_UINT, + ZE_IMAGE_FORMAT_SWIZZLE_R, ZE_IMAGE_FORMAT_SWIZZLE_G, + ZE_IMAGE_FORMAT_SWIZZLE_B, ZE_IMAGE_FORMAT_SWIZZLE_A}, + width, + height, + depth, + 0, + 0}; + + auto imageHW = std::make_unique>>(); + auto ret = imageHW->initialize(device, &srcImgDesc); + ASSERT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, ret); +} + +HWTEST2_F(ImageCreate, GivenNoSamplerDescWhenSampledImageCreatedThenErrorIsReturned, ImageSupport) { + const size_t width = 32; + const size_t height = 32; + const size_t depth = 1; + + auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice, + neoDevice->getNumGenericSubDevices() > 1); + neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper); + + ze_image_bindless_exp_desc_t bindlessExtDesc = {}; + bindlessExtDesc.stype = ZE_STRUCTURE_TYPE_BINDLESS_IMAGE_EXP_DESC; + bindlessExtDesc.pNext = nullptr; + bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS | ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE; + + ze_image_desc_t srcImgDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC, + &bindlessExtDesc, + ZE_IMAGE_FLAG_KERNEL_WRITE, + ZE_IMAGE_TYPE_2D, + {ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8, ZE_IMAGE_FORMAT_TYPE_UINT, + ZE_IMAGE_FORMAT_SWIZZLE_R, ZE_IMAGE_FORMAT_SWIZZLE_G, + ZE_IMAGE_FORMAT_SWIZZLE_B, ZE_IMAGE_FORMAT_SWIZZLE_A}, + width, + height, + depth, + 0, + 0}; + + auto imageHW = std::make_unique>>(); + auto ret = imageHW->initialize(device, &srcImgDesc); + ASSERT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, ret); +} + +HWTEST2_F(ImageCreate, GivenBindlessSampledImageWhenInitializedThenSamplerStateCopiedToSSH, ImageSupport) { + const size_t width = 32; + const size_t height = 32; + const size_t depth = 1; + + auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice, + neoDevice->getNumGenericSubDevices() > 1); + neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper); + + ze_sampler_desc_t samplerDesc = { + ZE_STRUCTURE_TYPE_SAMPLER_DESC, + nullptr, + ZE_SAMPLER_ADDRESS_MODE_CLAMP, + ZE_SAMPLER_FILTER_MODE_LINEAR, + false}; + + ze_image_bindless_exp_desc_t bindlessExtDesc = {}; + bindlessExtDesc.stype = ZE_STRUCTURE_TYPE_BINDLESS_IMAGE_EXP_DESC; + bindlessExtDesc.pNext = &samplerDesc; + bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS | ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE; + + ze_image_desc_t srcImgDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC, + &bindlessExtDesc, + ZE_IMAGE_FLAG_KERNEL_WRITE, + ZE_IMAGE_TYPE_2D, + {ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8, ZE_IMAGE_FORMAT_TYPE_UINT, + ZE_IMAGE_FORMAT_SWIZZLE_R, ZE_IMAGE_FORMAT_SWIZZLE_G, + ZE_IMAGE_FORMAT_SWIZZLE_B, ZE_IMAGE_FORMAT_SWIZZLE_A}, + width, + height, + depth, + 0, + 0}; + + auto imageHW = std::make_unique>>(); + auto ret = imageHW->initialize(device, &srcImgDesc); + ASSERT_EQ(ZE_RESULT_SUCCESS, ret); + + auto ssHeapInfo = imageHW->getBindlessSlot(); + ASSERT_NE(nullptr, ssHeapInfo); + + using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; + auto *surfaceState = static_cast(ssHeapInfo->ssPtr); + ASSERT_EQ(surfaceState->getSurfaceType(), RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_2D); + ASSERT_EQ(surfaceState->getSurfaceFormat(), + RENDER_SURFACE_STATE::SURFACE_FORMAT_R8G8B8A8_UINT); + ASSERT_EQ(surfaceState->getWidth(), width); + ASSERT_EQ(surfaceState->getHeight(), height); + ASSERT_EQ(surfaceState->getDepth(), depth); + + using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE; + auto *samplerState = static_cast(ptrOffset(ssHeapInfo->ssPtr, sizeof(RENDER_SURFACE_STATE) * NEO::BindlessImageSlot::sampler)); + + ASSERT_EQ(samplerState->getTcxAddressControlMode(), SAMPLER_STATE::TEXTURE_COORDINATE_MODE_CLAMP); + ASSERT_EQ(samplerState->getTcyAddressControlMode(), SAMPLER_STATE::TEXTURE_COORDINATE_MODE_CLAMP); + ASSERT_EQ(samplerState->getTczAddressControlMode(), SAMPLER_STATE::TEXTURE_COORDINATE_MODE_CLAMP); + + ASSERT_EQ(samplerState->getMinModeFilter(), SAMPLER_STATE::MIN_MODE_FILTER_LINEAR); + ASSERT_EQ(samplerState->getMagModeFilter(), SAMPLER_STATE::MAG_MODE_FILTER_LINEAR); +} + +HWTEST2_F(ImageCreate, GivenBindlessSampledImageViewFromUnsampledImageWhenInitializedThenSamplerStateCopiedToSSH, ImageSupport) { + const size_t width = 32; + const size_t height = 32; + const size_t depth = 1; + + auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice, + neoDevice->getNumGenericSubDevices() > 1); + neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper); + + ze_sampler_desc_t samplerDesc = { + ZE_STRUCTURE_TYPE_SAMPLER_DESC, + nullptr, + ZE_SAMPLER_ADDRESS_MODE_CLAMP, + ZE_SAMPLER_FILTER_MODE_LINEAR, + false}; + + ze_image_bindless_exp_desc_t bindlessExtDesc = {}; + bindlessExtDesc.stype = ZE_STRUCTURE_TYPE_BINDLESS_IMAGE_EXP_DESC; + bindlessExtDesc.pNext = nullptr; + bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS; + + ze_image_desc_t srcImgDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC, + &bindlessExtDesc, + ZE_IMAGE_FLAG_KERNEL_WRITE, + ZE_IMAGE_TYPE_2D, + {ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8, ZE_IMAGE_FORMAT_TYPE_UINT, + ZE_IMAGE_FORMAT_SWIZZLE_R, ZE_IMAGE_FORMAT_SWIZZLE_G, + ZE_IMAGE_FORMAT_SWIZZLE_B, ZE_IMAGE_FORMAT_SWIZZLE_A}, + width, + height, + depth, + 0, + 0}; + + auto imageHW = std::make_unique>>(); + auto ret = imageHW->initialize(device, &srcImgDesc); + ASSERT_EQ(ZE_RESULT_SUCCESS, ret); + + EXPECT_TRUE(imageHW->bindlessImage); + EXPECT_FALSE(imageHW->sampledImage); + + ze_image_handle_t imageView = {}; + bindlessExtDesc.flags = ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS | ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE; + bindlessExtDesc.pNext = &samplerDesc; + ret = imageHW->createView(device, &srcImgDesc, &imageView); + EXPECT_EQ(ZE_RESULT_SUCCESS, ret); + + auto imageViewObject = static_cast> *>(Image::fromHandle(imageView)); + + EXPECT_TRUE(imageViewObject->bindlessImage); + EXPECT_TRUE(imageViewObject->sampledImage); + + EXPECT_EQ(ZE_SAMPLER_ADDRESS_MODE_CLAMP, imageViewObject->samplerDesc.addressMode); + EXPECT_EQ(ZE_SAMPLER_FILTER_MODE_LINEAR, imageViewObject->samplerDesc.filterMode); + + EXPECT_EQ(imageHW->imgInfo.slicePitch, imageViewObject->getImageInfo().slicePitch); + EXPECT_NE(0u, imageViewObject->getImageInfo().slicePitch); + EXPECT_EQ(imageHW->imgInfo.rowPitch, imageViewObject->getImageInfo().rowPitch); + EXPECT_NE(0u, imageViewObject->getImageInfo().rowPitch); + EXPECT_EQ(imageHW->imgInfo.offset, imageViewObject->getImageInfo().offset); + EXPECT_EQ(imageHW->imgInfo.size, imageViewObject->getImageInfo().size); + EXPECT_NE(0u, imageViewObject->getImageInfo().size); + EXPECT_EQ(imageHW->imgInfo.linearStorage, imageViewObject->getImageInfo().linearStorage); + + auto ssHeapInfo = imageViewObject->getBindlessSlot(); + ASSERT_NE(nullptr, ssHeapInfo); + EXPECT_NE(imageHW->getBindlessSlot(), ssHeapInfo); + + using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; + auto *surfaceState = static_cast(ssHeapInfo->ssPtr); + ASSERT_EQ(surfaceState->getSurfaceType(), RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_2D); + ASSERT_EQ(surfaceState->getSurfaceFormat(), RENDER_SURFACE_STATE::SURFACE_FORMAT_R8G8B8A8_UINT); + ASSERT_EQ(surfaceState->getWidth(), width); + ASSERT_EQ(surfaceState->getHeight(), height); + ASSERT_EQ(surfaceState->getDepth(), depth); + + using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE; + auto *samplerState = static_cast(ptrOffset(ssHeapInfo->ssPtr, sizeof(RENDER_SURFACE_STATE) * NEO::BindlessImageSlot::sampler)); + + ASSERT_EQ(samplerState->getTcxAddressControlMode(), SAMPLER_STATE::TEXTURE_COORDINATE_MODE_CLAMP); + ASSERT_EQ(samplerState->getTcyAddressControlMode(), SAMPLER_STATE::TEXTURE_COORDINATE_MODE_CLAMP); + ASSERT_EQ(samplerState->getTczAddressControlMode(), SAMPLER_STATE::TEXTURE_COORDINATE_MODE_CLAMP); + + ASSERT_EQ(samplerState->getMinModeFilter(), SAMPLER_STATE::MIN_MODE_FILTER_LINEAR); + ASSERT_EQ(samplerState->getMagModeFilter(), SAMPLER_STATE::MAG_MODE_FILTER_LINEAR); + + Image::fromHandle(imageView)->destroy(); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp b/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp index dff71c8779..1539c6e8c0 100644 --- a/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp +++ b/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp @@ -2883,7 +2883,7 @@ HWTEST2_F(SetKernelArg, givenImageBindlessKernelAndGlobalBindlessHelperWhenSetAr auto surfaceStateSize = gfxCoreHelper.getRenderSurfaceStateSize(); auto expectedSsInHeap = imageHW->getAllocation()->getBindlessInfo(); - EXPECT_EQ(imageHW->passedRedescribedSurfaceStateHeap, ptrOffset(expectedSsInHeap.ssPtr, surfaceStateSize * 2)); + EXPECT_EQ(imageHW->passedRedescribedSurfaceStateHeap, ptrOffset(expectedSsInHeap.ssPtr, surfaceStateSize * NEO::BindlessImageSlot::redescribedImage)); EXPECT_EQ(imageHW->passedRedescribedSurfaceStateOffset, 0u); EXPECT_TRUE(kernel->isBindlessOffsetSet[3]); EXPECT_FALSE(kernel->usingSurfaceStateHeap[3]); diff --git a/shared/source/helpers/bindless_heaps_helper.h b/shared/source/helpers/bindless_heaps_helper.h index dbf0194007..b2ce1975a6 100644 --- a/shared/source/helpers/bindless_heaps_helper.h +++ b/shared/source/helpers/bindless_heaps_helper.h @@ -19,6 +19,15 @@ namespace NEO { class IndirectHeap; + +namespace BindlessImageSlot { +constexpr uint32_t image = 0; +constexpr uint32_t implicitArgs = 1; +constexpr uint32_t sampler = 2; +constexpr uint32_t redescribedImage = 3; +constexpr uint32_t max = 4; +}; // namespace BindlessImageSlot + class BindlessHeapsHelper { public: enum BindlesHeapType { @@ -27,6 +36,7 @@ class BindlessHeapsHelper { globalDsh, numHeapTypes }; + BindlessHeapsHelper(Device *rootDevice, bool isMultiOsContextCapable); MOCKABLE_VIRTUAL ~BindlessHeapsHelper(); @@ -48,7 +58,7 @@ class BindlessHeapsHelper { int getReusedSshVectorIndex(size_t ssSize) { int index = 0; - if (ssSize == 3 * surfaceStateSize) { + if (ssSize == NEO::BindlessImageSlot::max * surfaceStateSize) { index = 1; } else { UNRECOVERABLE_IF(ssSize != surfaceStateSize); diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index ed0b26a2b7..8cb8006670 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -1096,7 +1096,7 @@ bool MemoryManager::allocateBindlessSlot(GraphicsAllocation *allocation) { if (bindlessHelper && allocation->getBindlessOffset() == std::numeric_limits::max()) { auto &gfxCoreHelper = peekExecutionEnvironment().rootDeviceEnvironments[allocation->getRootDeviceIndex()]->getHelper(); const auto isImage = allocation->getAllocationType() == AllocationType::image || allocation->getAllocationType() == AllocationType::sharedImage; - auto surfStateCount = isImage ? 3 : 1; + auto surfStateCount = isImage ? NEO::BindlessImageSlot::max : 1; auto surfaceStateSize = surfStateCount * gfxCoreHelper.getRenderSurfaceStateSize(); auto surfaceStateInfo = bindlessHelper->allocateSSInHeap(surfaceStateSize, allocation, NEO::BindlessHeapsHelper::globalSsh); diff --git a/shared/test/unit_test/helpers/bindless_heaps_helper_tests.cpp b/shared/test/unit_test/helpers/bindless_heaps_helper_tests.cpp index bd01868ad5..4860e8e368 100644 --- a/shared/test/unit_test/helpers/bindless_heaps_helper_tests.cpp +++ b/shared/test/unit_test/helpers/bindless_heaps_helper_tests.cpp @@ -137,14 +137,14 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapForI EXPECT_TRUE(getMemoryManager()->allocateBindlessSlot(&alloc)); auto ssInHeapInfo1 = alloc.getBindlessInfo(); - EXPECT_EQ(surfaceStateSize * 3, ssInHeapInfo1.ssSize); + EXPECT_EQ(surfaceStateSize * NEO::BindlessImageSlot::max, ssInHeapInfo1.ssSize); MockGraphicsAllocation alloc2; alloc2.allocationType = AllocationType::sharedImage; EXPECT_TRUE(getMemoryManager()->allocateBindlessSlot(&alloc2)); auto ssInHeapInfo2 = alloc2.getBindlessInfo(); - EXPECT_EQ(surfaceStateSize * 3, ssInHeapInfo2.ssSize); + EXPECT_EQ(surfaceStateSize * NEO::BindlessImageSlot::max, ssInHeapInfo2.ssSize); } TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwiceForTheSameAllocationThenTheSameOffsetReturned) { @@ -344,9 +344,9 @@ TEST_F(BindlessHeapsHelperTests, givenFreeSlotsExceedingThresholdInResuePoolWhen ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[1] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); // allocate triple size for image - ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(NEO::BindlessImageSlot::max * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[3] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); - ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(NEO::BindlessImageSlot::max * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_FALSE(bindlessHeapHelper->allocateFromReusePool); @@ -375,9 +375,9 @@ TEST_F(BindlessHeapsHelperTests, givenReusePoolExhaustedWhenNewSlotsAllocatedThe ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[1] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); // allocate triple size for image - ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(NEO::BindlessImageSlot::max * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[3] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); - ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(NEO::BindlessImageSlot::max * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_FALSE(bindlessHeapHelper->allocateFromReusePool); @@ -427,9 +427,9 @@ TEST_F(BindlessHeapsHelperTests, givenReleasedSlotsToSecondPoolWhenThresholdReac ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[1] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); // allocate triple size for image - ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(NEO::BindlessImageSlot::max * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[3] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); - ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(NEO::BindlessImageSlot::max * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); for (int i = 0; i < 5; i++) { bindlessHeapHelper->releaseSSToReusePool(ssInHeapInfos[i]); @@ -457,7 +457,7 @@ TEST_F(BindlessHeapsHelperTests, givenReleasedSlotsToSecondPoolWhenThresholdReac EXPECT_EQ(bindlessHeapHelper->surfaceStateInHeapVectorReuse[releasePoolIndex][0].size(), 3u); EXPECT_EQ(bindlessHeapHelper->surfaceStateInHeapVectorReuse[releasePoolIndex][1].size(), 2u); - ssInHeapInfos[3] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[3] = bindlessHeapHelper->allocateSSInHeap(NEO::BindlessImageSlot::max * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_EQ(1u, bindlessHeapHelper->allocatePoolIndex); EXPECT_EQ(0u, bindlessHeapHelper->releasePoolIndex); @@ -467,7 +467,7 @@ TEST_F(BindlessHeapsHelperTests, givenReleasedSlotsToSecondPoolWhenThresholdReac EXPECT_EQ(bindlessHeapHelper->surfaceStateInHeapVectorReuse[allocatePoolIndex][1].size(), 1u); - ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(NEO::BindlessImageSlot::max * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_EQ(bindlessHeapHelper->surfaceStateInHeapVectorReuse[allocatePoolIndex][1].size(), 0u); EXPECT_FALSE(bindlessHeapHelper->allocateFromReusePool); @@ -482,7 +482,7 @@ TEST_F(BindlessHeapsHelperTests, givenReleasedSlotsToSecondPoolWhenThresholdReac bindlessHeapHelper->stateCacheDirtyForContext.reset(); - ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(NEO::BindlessImageSlot::max * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_EQ(0u, bindlessHeapHelper->allocatePoolIndex); EXPECT_EQ(1u, bindlessHeapHelper->releasePoolIndex); @@ -524,7 +524,7 @@ TEST_F(BindlessHeapsHelperTests, givenFreeSlotsInReusePoolForONeSizeWhenAllocati ssInHeapInfos[i] = {0}; } - ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(NEO::BindlessImageSlot::max * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_EQ(0u, bindlessHeapHelper->allocatePoolIndex); EXPECT_EQ(1u, bindlessHeapHelper->releasePoolIndex);