diff --git a/level_zero/core/source/context/context_imp.cpp b/level_zero/core/source/context/context_imp.cpp index 3156f38506..f222554324 100644 --- a/level_zero/core/source/context/context_imp.cpp +++ b/level_zero/core/source/context/context_imp.cpp @@ -513,18 +513,26 @@ ze_result_t ContextImp::evictMemory(ze_device_handle_t hDevice, void *ptr, size_ ze_result_t ContextImp::makeImageResident(ze_device_handle_t hDevice, ze_image_handle_t hImage) { auto alloc = Image::fromHandle(hImage)->getAllocation(); + auto implicitArgsAlloc = Image::fromHandle(hImage)->getImplicitArgsAllocation(); NEO::Device *neoDevice = L0::Device::fromHandle(hDevice)->getNEODevice(); NEO::MemoryOperationsHandler *memoryOperationsIface = neoDevice->getRootDeviceEnvironment().memoryOperationsInterface.get(); auto success = memoryOperationsIface->makeResident(neoDevice, ArrayRef(&alloc, 1)); + if (implicitArgsAlloc) { + memoryOperationsIface->makeResident(neoDevice, ArrayRef(&implicitArgsAlloc, 1)); + } return changeMemoryOperationStatusToL0ResultType(success); } ze_result_t ContextImp::evictImage(ze_device_handle_t hDevice, ze_image_handle_t hImage) { auto alloc = Image::fromHandle(hImage)->getAllocation(); + auto implicitArgsAlloc = Image::fromHandle(hImage)->getImplicitArgsAllocation(); NEO::Device *neoDevice = L0::Device::fromHandle(hDevice)->getNEODevice(); NEO::MemoryOperationsHandler *memoryOperationsIface = neoDevice->getRootDeviceEnvironment().memoryOperationsInterface.get(); auto success = memoryOperationsIface->evict(neoDevice, *alloc); + if (implicitArgsAlloc) { + memoryOperationsIface->evict(neoDevice, *implicitArgsAlloc); + } return changeMemoryOperationStatusToL0ResultType(success); } diff --git a/level_zero/core/source/image/image.h b/level_zero/core/source/image/image.h index 2c468e430c..880d4247c8 100644 --- a/level_zero/core/source/image/image.h +++ b/level_zero/core/source/image/image.h @@ -36,10 +36,12 @@ struct Image : _ze_image_handle_t { virtual ze_result_t createView(Device *device, const ze_image_desc_t *desc, ze_image_handle_t *pImage) = 0; virtual NEO::GraphicsAllocation *getAllocation() = 0; + virtual NEO::GraphicsAllocation *getImplicitArgsAllocation() = 0; virtual void copySurfaceStateToSSH(void *surfaceStateHeap, const uint32_t surfaceStateOffset, bool isMediaBlockArg) = 0; virtual void copyRedescribedSurfaceStateToSSH(void *surfaceStateHeap, const uint32_t surfaceStateOffset) = 0; + virtual void copyImplicitArgsSurfaceStateToSSH(void *surfaceStateHeap, const uint32_t surfaceStateOffset) = 0; virtual NEO::ImageInfo getImageInfo() = 0; virtual ze_image_desc_t getImageDesc() = 0; virtual ze_result_t getMemoryProperties(ze_image_memory_properties_exp_t *pMemoryProperties) = 0; diff --git a/level_zero/core/source/image/image_hw.h b/level_zero/core/source/image/image_hw.h index 6322a8b2d9..efb3290f77 100644 --- a/level_zero/core/source/image/image_hw.h +++ b/level_zero/core/source/image/image_hw.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,6 +22,7 @@ struct ImageCoreFamily : public ImageImp { ze_result_t initialize(Device *device, const ze_image_desc_t *desc) override; void copySurfaceStateToSSH(void *surfaceStateHeap, const uint32_t surfaceStateOffset, bool isMediaBlockArg) override; void copyRedescribedSurfaceStateToSSH(void *surfaceStateHeap, const uint32_t surfaceStateOffset) override; + void copyImplicitArgsSurfaceStateToSSH(void *surfaceStateHeap, const uint32_t surfaceStateOffset) override; bool isMediaFormat(const ze_image_format_layout_t layout) { if (layout == ze_image_format_layout_t::ZE_IMAGE_FORMAT_LAYOUT_NV12 || layout == ze_image_format_layout_t::ZE_IMAGE_FORMAT_LAYOUT_P010 || @@ -49,6 +50,7 @@ struct ImageCoreFamily : public ImageImp { bool isSuitableForCompression(const StructuresLookupTable &structuresLookupTable, const NEO::ImageInfo &imgInfo); RENDER_SURFACE_STATE surfaceState; + RENDER_SURFACE_STATE implicitArgsSurfaceState; RENDER_SURFACE_STATE redescribedSurfaceState; }; diff --git a/level_zero/core/source/image/image_hw.inl b/level_zero/core/source/image/image_hw.inl index f5943b67e5..4277b801d2 100644 --- a/level_zero/core/source/image/image_hw.inl +++ b/level_zero/core/source/image/image_hw.inl @@ -11,24 +11,33 @@ #include "shared/source/device/device.h" #include "shared/source/execution_environment/root_device_environment.h" #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/gfx_core_helper.h" #include "shared/source/helpers/surface_format_info.h" #include "shared/source/image/image_surface_state.h" #include "shared/source/memory_manager/allocation_properties.h" #include "shared/source/memory_manager/memory_manager.h" +#include "shared/source/release_helper/release_helper.h" #include "level_zero/core/source/device/device.h" #include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h" #include "level_zero/core/source/helpers/properties_parser.h" +#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 "encode_surface_state_args.h" + namespace L0 { template ze_result_t ImageCoreFamily::initialize(Device *device, const ze_image_desc_t *desc) { using RENDER_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE; + const auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment(); + const bool isBindlessMode = rootDeviceEnvironment.getReleaseHelper() ? NEO::ApiSpecificConfig::getBindlessMode(rootDeviceEnvironment.getReleaseHelper()) : false; + StructuresLookupTable lookupTable = {}; lookupTable.areImageProperties = true; @@ -104,8 +113,13 @@ ze_result_t ImageCoreFamily::initialize(Device *device, const ze_ } } + if (isBindlessMode) { + NEO::AllocationProperties imgImplicitArgsAllocProperties(device->getRootDeviceIndex(), NEO::ImageImplicitArgs::getSize(), NEO::AllocationType::buffer, device->getNEODevice()->getDeviceBitfield()); + implicitArgsAllocation = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(imgImplicitArgsAllocProperties); + } + auto gmm = this->allocation->getDefaultGmm(); - auto gmmHelper = static_cast(device->getNEODevice()->getRootDeviceEnvironment()).getGmmHelper(); + auto gmmHelper = static_cast(rootDeviceEnvironment).getGmmHelper(); if (gmm != nullptr) { NEO::ImagePlane yuvPlaneType = NEO::ImagePlane::noPlane; @@ -157,6 +171,53 @@ ze_result_t ImageCoreFamily::initialize(Device *device, const ze_ NEO::EncodeSurfaceState::setImageAuxParamsForCCS(&surfaceState, gmm); } } + + if (isBindlessMode && implicitArgsAllocation) { + implicitArgsSurfaceState = GfxFamily::cmdInitRenderSurfaceState; + + auto clChannelType = getClChannelDataType(imageFormatDesc.format); + auto clChannelOrder = getClChannelOrder(imageFormatDesc.format); + + NEO::ImageImplicitArgs imageImplicitArgs{}; + imageImplicitArgs.structVersion = 0; + + imageImplicitArgs.imageWidth = imgInfo.imgDesc.imageWidth; + imageImplicitArgs.imageHeight = imgInfo.imgDesc.imageHeight; + imageImplicitArgs.imageDepth = imgInfo.imgDesc.imageDepth; + imageImplicitArgs.imageArraySize = imgInfo.imgDesc.imageArraySize; + imageImplicitArgs.numSamples = imgInfo.imgDesc.numSamples; + imageImplicitArgs.channelType = clChannelType; + imageImplicitArgs.channelOrder = clChannelOrder; + imageImplicitArgs.numMipLevels = imgInfo.imgDesc.numMipLevels; + + auto pixelSize = imgInfo.surfaceFormat->imageElementSizeInBytes; + imageImplicitArgs.flatBaseOffset = implicitArgsAllocation->getGpuAddress(); + imageImplicitArgs.flatWidth = (imgInfo.imgDesc.imageWidth * pixelSize) - 1u; + imageImplicitArgs.flagHeight = (imgInfo.imgDesc.imageHeight * pixelSize) - 1u; + imageImplicitArgs.flatPitch = imgInfo.imgDesc.imageRowPitch - 1u; + + const auto &productHelper = rootDeviceEnvironment.getHelper(); + NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *implicitArgsAllocation), *this->device->getNEODevice(), implicitArgsAllocation, 0u, &imageImplicitArgs, NEO::ImageImplicitArgs::getSize()); + + { + auto &gfxCoreHelper = this->device->getGfxCoreHelper(); + + NEO::EncodeSurfaceStateArgs args; + args.outMemory = &implicitArgsSurfaceState; + args.size = NEO::ImageImplicitArgs::getSize(); + args.graphicsAddress = implicitArgsAllocation->getGpuAddress(); + args.gmmHelper = gmmHelper; + args.allocation = implicitArgsAllocation; + args.numAvailableDevices = this->device->getNEODevice()->getNumGenericSubDevices(); + args.areMultipleSubDevicesInContext = args.numAvailableDevices > 1; + args.mocs = gfxCoreHelper.getMocsIndex(*args.gmmHelper, true, false) << 1; + args.implicitScaling = this->device->isImplicitScalingCapable(); + args.isDebuggerActive = this->device->getNEODevice()->getDebugger() != nullptr; + + gfxCoreHelper.encodeBufferSurfaceState(args); + } + } + { const uint32_t exponent = Math::log2(imgInfo.surfaceFormat->imageElementSizeInBytes); DEBUG_BREAK_IF(exponent >= 5u); @@ -232,6 +293,18 @@ void ImageCoreFamily::copyRedescribedSurfaceStateToSSH(void *surf &redescribedSurfaceState, sizeof(RENDER_SURFACE_STATE)); } +template +void ImageCoreFamily::copyImplicitArgsSurfaceStateToSSH(void *surfaceStateHeap, + const uint32_t surfaceStateOffset) { + using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; + using RENDER_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE; + + // Copy the image's surface state into position in the provided surface state heap + auto destSurfaceState = ptrOffset(surfaceStateHeap, surfaceStateOffset); + memcpy_s(destSurfaceState, sizeof(RENDER_SURFACE_STATE), + &implicitArgsSurfaceState, sizeof(RENDER_SURFACE_STATE)); +} + template bool ImageCoreFamily::isSuitableForCompression(const StructuresLookupTable &structuresLookupTable, const NEO::ImageInfo &imgInfo) { auto &hwInfo = device->getHwInfo(); diff --git a/level_zero/core/source/image/image_imp.cpp b/level_zero/core/source/image/image_imp.cpp index 049a928c29..dc4c5115f6 100644 --- a/level_zero/core/source/image/image_imp.cpp +++ b/level_zero/core/source/image/image_imp.cpp @@ -31,8 +31,13 @@ ImageImp::~ImageImp() { this->device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[this->allocation->getRootDeviceIndex()]->getBindlessHeapsHelper()->releaseSSToReusePool(*bindlessInfo); } } - if (!isImageView() && this->device != nullptr) { - this->device->getNEODevice()->getMemoryManager()->freeGraphicsMemory(this->allocation); + if (this->device != nullptr) { + if (!isImageView()) { + this->device->getNEODevice()->getMemoryManager()->freeGraphicsMemory(this->allocation); + } + if (implicitArgsAllocation) { + this->device->getNEODevice()->getMemoryManager()->freeGraphicsMemory(this->implicitArgsAllocation); + } } } @@ -100,7 +105,7 @@ ze_result_t ImageImp::allocateBindlessSlot() { if (bindlessHelper && !bindlessInfo) { auto &gfxCoreHelper = this->device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[allocation->getRootDeviceIndex()]->getHelper(); - const auto surfStateCount = 2; + const auto surfStateCount = 3; 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 f1dcce2f30..d3101f83fc 100644 --- a/level_zero/core/source/image/image_imp.h +++ b/level_zero/core/source/image/image_imp.h @@ -9,6 +9,7 @@ #include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/helpers/surface_format_info.h" +#include "shared/source/memory_manager/graphics_allocation.h" #include "level_zero/core/source/image/image.h" @@ -26,6 +27,7 @@ struct ImageImp : public Image, NEO::NonCopyableOrMovableClass { ~ImageImp() override; NEO::GraphicsAllocation *getAllocation() override { return allocation; } + NEO::GraphicsAllocation *getImplicitArgsAllocation() override { return implicitArgsAllocation; } NEO::ImageInfo getImageInfo() override { return imgInfo; } ze_image_desc_t getImageDesc() override { return imageFormatDesc; @@ -52,6 +54,7 @@ struct ImageImp : public Image, NEO::NonCopyableOrMovableClass { Device *device = nullptr; NEO::ImageInfo imgInfo = {}; NEO::GraphicsAllocation *allocation = nullptr; + NEO::GraphicsAllocation *implicitArgsAllocation = nullptr; ze_image_desc_t imageFormatDesc = {}; std::optional sourceImageFormatDesc = {}; std::unique_ptr bindlessInfo; diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index c452e6f019..70c14c9fe3 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -571,12 +571,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 state - auto bindlessSlotOffset = ssInHeap->surfaceStateOffset + surfaceStateSize; + // redescribed image's surface state is after image's implicit args + auto bindlessSlotOffset = ssInHeap->surfaceStateOffset + surfaceStateSize * 2; auto patchValue = gfxCoreHelper.getBindlessSurfaceExtendedMessageDescriptorValue(static_cast(bindlessSlotOffset)); patchWithRequiredSize(const_cast(patchLocation), sizeof(patchValue), patchValue); - image->copyRedescribedSurfaceStateToSSH(ptrOffset(ssInHeap->ssPtr, surfaceStateSize), 0u); + image->copyRedescribedSurfaceStateToSSH(ptrOffset(ssInHeap->ssPtr, surfaceStateSize * 2), 0u); isBindlessOffsetSet[argIndex] = true; this->residencyContainer.push_back(ssInHeap->heapAllocation); } else { @@ -589,6 +589,10 @@ ze_result_t KernelImp::setArgRedescribedImage(uint32_t argIndex, ze_image_handle } residencyContainer[argIndex] = image->getAllocation(); + if (image->getImplicitArgsAllocation()) { + this->residencyContainer.push_back(image->getImplicitArgsAllocation()); + } + return ZE_RESULT_SUCCESS; } @@ -778,6 +782,8 @@ ze_result_t KernelImp::setArgImage(uint32_t argIndex, size_t argSize, const void patchWithRequiredSize(const_cast(patchLocation), sizeof(patchValue), patchValue); image->copySurfaceStateToSSH(ssInHeap->ssPtr, 0u, isMediaBlockImage); + image->copyImplicitArgsSurfaceStateToSSH(ptrOffset(ssInHeap->ssPtr, surfaceStateSize), 0u); + isBindlessOffsetSet[argIndex] = true; this->residencyContainer.push_back(ssInHeap->heapAllocation); } else { @@ -791,6 +797,10 @@ ze_result_t KernelImp::setArgImage(uint32_t argIndex, size_t argSize, const void residencyContainer[argIndex] = image->getAllocation(); + if (image->getImplicitArgsAllocation()) { + this->residencyContainer.push_back(image->getImplicitArgsAllocation()); + } + auto imageInfo = image->getImageInfo(); auto clChannelType = getClChannelDataType(image->getImageDesc().format); auto clChannelOrder = getClChannelOrder(image->getImageDesc().format); 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 cf8d493cd7..60e935221a 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_image.h +++ b/level_zero/core/test/unit_tests/mocks/mock_image.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,6 +25,7 @@ struct WhiteBox<::L0::ImageCoreFamily> ~WhiteBox() override {} + using BaseClass::implicitArgsSurfaceState; using BaseClass::redescribedSurfaceState; using BaseClass::surfaceState; }; diff --git a/level_zero/core/test/unit_tests/sources/context/test_context.cpp b/level_zero/core/test/unit_tests/sources/context/test_context.cpp index 31c6a3d590..54726b0c8e 100644 --- a/level_zero/core/test/unit_tests/sources/context/test_context.cpp +++ b/level_zero/core/test/unit_tests/sources/context/test_context.cpp @@ -1901,5 +1901,109 @@ HWTEST2_F(ContextTest, WhenCreatingImageThenSuccessIsReturned, IsAtMostProductDG EXPECT_EQ(ZE_RESULT_SUCCESS, res); } +HWTEST2_F(ContextTest, givenBindlessModeDisabledWhenMakeImageResidentAndEvictThenImageImplicitArgsAllocationIsNotMadeResidentAndEvicted, IsAtLeastSkl) { + if (!device->getNEODevice()->getRootDeviceEnvironment().getReleaseHelper() || + !device->getNEODevice()->getDeviceInfo().imageSupport) { + GTEST_SKIP(); + } + + DebugManagerStateRestore restore; + NEO::debugManager.flags.UseBindlessMode.set(0); + + ze_context_handle_t hContext; + ze_context_desc_t desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr, 0}; + ze_result_t res = driverHandle->createContext(&desc, 0u, nullptr, &hContext); + EXPECT_EQ(ZE_RESULT_SUCCESS, res); + + auto mockMemoryOperationsInterface = new NEO::MockMemoryOperations(); + mockMemoryOperationsInterface->captureGfxAllocationsForMakeResident = true; + device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]->memoryOperationsInterface.reset(mockMemoryOperationsInterface); + + ContextImp *contextImp = static_cast(L0::Context::fromHandle(hContext)); + + ze_image_handle_t image = {}; + ze_image_desc_t imageDesc = {}; + imageDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC; + + res = contextImp->createImage(device, &imageDesc, &image); + EXPECT_EQ(ZE_RESULT_SUCCESS, res); + EXPECT_NE(nullptr, image); + + { + contextImp->makeImageResident(device, image); + EXPECT_EQ(1, mockMemoryOperationsInterface->makeResidentCalledCount); + auto allocIter = std::find(mockMemoryOperationsInterface->gfxAllocationsForMakeResident.begin(), + mockMemoryOperationsInterface->gfxAllocationsForMakeResident.end(), + Image::fromHandle(image)->getImplicitArgsAllocation()); + EXPECT_EQ(mockMemoryOperationsInterface->gfxAllocationsForMakeResident.end(), allocIter); + } + + { + contextImp->evictImage(device, image); + EXPECT_EQ(1, mockMemoryOperationsInterface->evictCalledCount); + auto allocIter = std::find(mockMemoryOperationsInterface->gfxAllocationsForMakeResident.begin(), + mockMemoryOperationsInterface->gfxAllocationsForMakeResident.end(), + Image::fromHandle(image)->getImplicitArgsAllocation()); + EXPECT_EQ(mockMemoryOperationsInterface->gfxAllocationsForMakeResident.end(), allocIter); + } + + Image::fromHandle(image)->destroy(); + + res = contextImp->destroy(); + EXPECT_EQ(ZE_RESULT_SUCCESS, res); +} + +HWTEST2_F(ContextTest, givenBindlessModeEnabledWhenMakeImageResidentAndEvictThenImageImplicitArgsAllocationIsMadeResidentAndEvicted, IsAtLeastSkl) { + if (!device->getNEODevice()->getRootDeviceEnvironment().getReleaseHelper() || + !device->getNEODevice()->getDeviceInfo().imageSupport) { + GTEST_SKIP(); + } + + DebugManagerStateRestore restore; + NEO::debugManager.flags.UseBindlessMode.set(1); + + ze_context_handle_t hContext; + ze_context_desc_t desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr, 0}; + ze_result_t res = driverHandle->createContext(&desc, 0u, nullptr, &hContext); + EXPECT_EQ(ZE_RESULT_SUCCESS, res); + + auto mockMemoryOperationsInterface = new NEO::MockMemoryOperations(); + mockMemoryOperationsInterface->captureGfxAllocationsForMakeResident = true; + device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]->memoryOperationsInterface.reset(mockMemoryOperationsInterface); + + ContextImp *contextImp = static_cast(L0::Context::fromHandle(hContext)); + + ze_image_handle_t image = {}; + ze_image_desc_t imageDesc = {}; + imageDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC; + + res = contextImp->createImage(device, &imageDesc, &image); + EXPECT_EQ(ZE_RESULT_SUCCESS, res); + EXPECT_NE(nullptr, image); + + { + contextImp->makeImageResident(device, image); + EXPECT_EQ(2, mockMemoryOperationsInterface->makeResidentCalledCount); + auto allocIter = std::find(mockMemoryOperationsInterface->gfxAllocationsForMakeResident.begin(), + mockMemoryOperationsInterface->gfxAllocationsForMakeResident.end(), + Image::fromHandle(image)->getImplicitArgsAllocation()); + EXPECT_NE(mockMemoryOperationsInterface->gfxAllocationsForMakeResident.end(), allocIter); + } + + { + contextImp->evictImage(device, image); + EXPECT_EQ(2, mockMemoryOperationsInterface->evictCalledCount); + auto allocIter = std::find(mockMemoryOperationsInterface->gfxAllocationsForMakeResident.begin(), + mockMemoryOperationsInterface->gfxAllocationsForMakeResident.end(), + Image::fromHandle(image)->getImplicitArgsAllocation()); + EXPECT_EQ(mockMemoryOperationsInterface->gfxAllocationsForMakeResident.end(), allocIter); + } + + Image::fromHandle(image)->destroy(); + + res = contextImp->destroy(); + EXPECT_EQ(ZE_RESULT_SUCCESS, res); +} + } // namespace ult } // namespace L0 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 978388d669..9ef6710c98 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 @@ -140,6 +140,123 @@ HWTEST2_F(ImageCreate, givenDifferentSwizzleFormatWhenImageInitializeThenCorrect RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_ZERO); } +HWTEST2_F(ImageCreate, givenBindlessModeWhenImageInitializeThenImageImplicitArgsAreCorrectlyStoredInNewSeparateAllocation, IsAtLeastSkl) { + if (!device->getNEODevice()->getRootDeviceEnvironment().getReleaseHelper()) { + GTEST_SKIP(); + } + + DebugManagerStateRestore restore; + NEO::debugManager.flags.UseBindlessMode.set(1); + + using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; + + ze_image_desc_t desc = {}; + + desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC; + desc.type = ZE_IMAGE_TYPE_3D; + desc.format.layout = ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8; + desc.format.type = ZE_IMAGE_FORMAT_TYPE_UINT; + desc.width = 11; + desc.height = 13; + desc.depth = 17; + + desc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_A; + desc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_0; + desc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1; + desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X; + + auto imageHW = std::make_unique>>(); + auto ret = imageHW->initialize(device, &desc); + ASSERT_EQ(ZE_RESULT_SUCCESS, ret); + + auto imgImplicitArgsBuffer = imageHW->getImplicitArgsAllocation()->getUnderlyingBuffer(); + + { + auto imgInfo = imageHW->getImageInfo(); + + auto clChannelType = getClChannelDataType(desc.format); + auto clChannelOrder = getClChannelOrder(desc.format); + + ImageImplicitArgs imageImplicitArgs{}; + imageImplicitArgs.structVersion = 0; + imageImplicitArgs.imageWidth = desc.width; + imageImplicitArgs.imageHeight = desc.height; + imageImplicitArgs.imageDepth = desc.depth; + + imageImplicitArgs.imageArraySize = imgInfo.imgDesc.imageArraySize; + imageImplicitArgs.numSamples = imgInfo.imgDesc.numSamples; + imageImplicitArgs.channelType = clChannelType; + imageImplicitArgs.channelOrder = clChannelOrder; + imageImplicitArgs.numMipLevels = imgInfo.imgDesc.numMipLevels; + imageImplicitArgs.flatBaseOffset = imageHW->getImplicitArgsAllocation()->getGpuAddress(); + + auto pixelSize = imgInfo.surfaceFormat->imageElementSizeInBytes; + imageImplicitArgs.flatWidth = (imgInfo.imgDesc.imageWidth * pixelSize) - 1u; + imageImplicitArgs.flagHeight = (imgInfo.imgDesc.imageHeight * pixelSize) - 1u; + imageImplicitArgs.flatPitch = imgInfo.imgDesc.imageRowPitch - 1u; + + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, structSize)), &imageImplicitArgs.structSize, ImageImplicitArgs::getSize())); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, structVersion)), &imageImplicitArgs.structVersion, sizeof(imageImplicitArgs.structVersion))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, imageWidth)), &imageImplicitArgs.imageWidth, sizeof(imageImplicitArgs.imageWidth))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, imageHeight)), &imageImplicitArgs.imageHeight, sizeof(imageImplicitArgs.imageHeight))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, imageDepth)), &imageImplicitArgs.imageDepth, sizeof(imageImplicitArgs.imageDepth))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, imageArraySize)), &imageImplicitArgs.imageArraySize, sizeof(imageImplicitArgs.imageArraySize))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, numSamples)), &imageImplicitArgs.numSamples, sizeof(imageImplicitArgs.numSamples))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, channelType)), &imageImplicitArgs.channelType, sizeof(imageImplicitArgs.channelType))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, channelOrder)), &imageImplicitArgs.channelOrder, sizeof(imageImplicitArgs.channelOrder))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, numMipLevels)), &imageImplicitArgs.numMipLevels, sizeof(imageImplicitArgs.numMipLevels))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, flatBaseOffset)), &imageImplicitArgs.flatBaseOffset, sizeof(imageImplicitArgs.flatBaseOffset))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, flatWidth)), &imageImplicitArgs.flatWidth, sizeof(imageImplicitArgs.flatWidth))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, flagHeight)), &imageImplicitArgs.flagHeight, sizeof(imageImplicitArgs.flagHeight))); + EXPECT_EQ(0, memcmp(ptrOffset(imgImplicitArgsBuffer, offsetof(ImageImplicitArgs, flatPitch)), &imageImplicitArgs.flatPitch, sizeof(imageImplicitArgs.flatPitch))); + } + { + auto implicitArgsSurfaceState = &imageHW->implicitArgsSurfaceState; + + auto implicitArgsSurfaceStateBaseAddress = reinterpret_cast(implicitArgsSurfaceState->getSurfaceBaseAddress()); + EXPECT_EQ(imgImplicitArgsBuffer, implicitArgsSurfaceStateBaseAddress); + + auto implicitArgsSurfaceType = implicitArgsSurfaceState->getSurfaceType(); + EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER, implicitArgsSurfaceType); + } +} + +HWTEST2_F(ImageCreate, givenBindlessModeDisabledWhenImageInitializeThenImageImplicitArgsAllocationAndSurfaceStateAreNotCreated, IsAtLeastSkl) { + if (!device->getNEODevice()->getRootDeviceEnvironment().getReleaseHelper()) { + GTEST_SKIP(); + } + + DebugManagerStateRestore restore; + NEO::debugManager.flags.UseBindlessMode.set(0); + + using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; + + ze_image_desc_t desc = {}; + + desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC; + desc.type = ZE_IMAGE_TYPE_3D; + desc.format.layout = ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8; + desc.format.type = ZE_IMAGE_FORMAT_TYPE_UINT; + desc.width = 11; + desc.height = 13; + desc.depth = 17; + + desc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_A; + desc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_0; + desc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1; + desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X; + + auto imageHW = std::make_unique>>(); + auto ret = imageHW->initialize(device, &desc); + ASSERT_EQ(ZE_RESULT_SUCCESS, ret); + + auto imgImplicitArgsAllocation = imageHW->getImplicitArgsAllocation(); + EXPECT_EQ(nullptr, imgImplicitArgsAllocation); + + auto implicitArgsSurfaceState = &imageHW->implicitArgsSurfaceState; + EXPECT_EQ(nullptr, reinterpret_cast(implicitArgsSurfaceState->getSurfaceBaseAddress())); +} + HWTEST2_F(ImageView, givenPlanarImageWhenCreateImageViewThenProperPlaneIsCreated, IsAtLeastSkl) { using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; const size_t width = 32; 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 872a033b3b..072de090da 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 @@ -2578,6 +2578,11 @@ struct MyMockImage : public WhiteBox<::L0::ImageCoreFamily> { passedSurfaceStateOffset = surfaceStateOffset; } + void copyImplicitArgsSurfaceStateToSSH(void *surfaceStateHeap, const uint32_t surfaceStateOffset) override { + passedImplicitArgsSurfaceStateHeap = surfaceStateHeap; + passedImplicitArgsSurfaceStateOffset = surfaceStateOffset; + } + void copyRedescribedSurfaceStateToSSH(void *surfaceStateHeap, const uint32_t surfaceStateOffset) override { passedRedescribedSurfaceStateHeap = surfaceStateHeap; passedRedescribedSurfaceStateOffset = surfaceStateOffset; @@ -2586,6 +2591,9 @@ struct MyMockImage : public WhiteBox<::L0::ImageCoreFamily> { void *passedSurfaceStateHeap = nullptr; uint32_t passedSurfaceStateOffset = 0; + void *passedImplicitArgsSurfaceStateHeap = nullptr; + uint32_t passedImplicitArgsSurfaceStateOffset = 0; + void *passedRedescribedSurfaceStateHeap = nullptr; uint32_t passedRedescribedSurfaceStateOffset = 0; }; @@ -2678,6 +2686,39 @@ HWTEST2_F(SetKernelArg, givenBindlessKernelAndNoAvailableSpaceOnSshWhenSetArgIma EXPECT_EQ(nullptr, bindlessInfo.heapAllocation); } +HWTEST2_F(SetKernelArg, givenImageAndBindlessKernelWhenSetArgImageThenCopyImplicitArgsSurfaceStateToSSHCalledWithCorrectArgs, ImageSupport) { + createKernel(); + + neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(), + neoDevice->getNumGenericSubDevices() > 1, + neoDevice->getRootDeviceIndex(), + neoDevice->getDeviceBitfield()); + auto &imageArg = const_cast(kernel->kernelImmData->getDescriptor().payloadMappings.explicitArgs[3].template as()); + auto &addressingMode = kernel->kernelImmData->getDescriptor().kernelAttributes.imageAddressingMode; + const_cast(addressingMode) = NEO::KernelDescriptor::Bindless; + imageArg.bindless = 0x0; + imageArg.bindful = undefined; + ze_image_desc_t desc = {}; + desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC; + + auto imageHW = std::make_unique>(); + auto ret = imageHW->initialize(device, &desc); + auto handle = imageHW->toHandle(); + ASSERT_EQ(ZE_RESULT_SUCCESS, ret); + + ret = kernel->setArgImage(3, sizeof(imageHW.get()), &handle); + EXPECT_EQ(ZE_RESULT_SUCCESS, ret); + + auto &gfxCoreHelper = neoDevice->getGfxCoreHelper(); + auto surfaceStateSize = gfxCoreHelper.getRenderSurfaceStateSize(); + + auto expectedSsInHeap = imageHW->getAllocation()->getBindlessInfo(); + EXPECT_EQ(imageHW->passedImplicitArgsSurfaceStateHeap, ptrOffset(expectedSsInHeap.ssPtr, surfaceStateSize)); + EXPECT_EQ(imageHW->passedImplicitArgsSurfaceStateOffset, 0u); + EXPECT_TRUE(kernel->isBindlessOffsetSet[3]); + EXPECT_FALSE(kernel->usingSurfaceStateHeap[3]); +} + HWTEST2_F(SetKernelArg, givenImageBindlessKernelAndGlobalBindlessHelperWhenSetArgRedescribedImageCalledThenCopySurfaceStateToSSHCalledWithCorrectArgs, ImageSupport) { createKernel(); @@ -2705,7 +2746,7 @@ HWTEST2_F(SetKernelArg, givenImageBindlessKernelAndGlobalBindlessHelperWhenSetAr auto surfaceStateSize = gfxCoreHelper.getRenderSurfaceStateSize(); auto expectedSsInHeap = imageHW->getAllocation()->getBindlessInfo(); - EXPECT_EQ(imageHW->passedRedescribedSurfaceStateHeap, ptrOffset(expectedSsInHeap.ssPtr, surfaceStateSize)); + EXPECT_EQ(imageHW->passedRedescribedSurfaceStateHeap, ptrOffset(expectedSsInHeap.ssPtr, surfaceStateSize * 2)); 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 f1e9df86d1..164f91bd35 100644 --- a/shared/source/helpers/bindless_heaps_helper.h +++ b/shared/source/helpers/bindless_heaps_helper.h @@ -48,7 +48,7 @@ class BindlessHeapsHelper { int getReusedSshVectorIndex(size_t ssSize) { int index = 0; - if (ssSize == 2 * surfaceStateSize) { + if (ssSize == 3 * surfaceStateSize) { index = 1; } else { UNRECOVERABLE_IF(ssSize != surfaceStateSize); diff --git a/shared/source/helpers/surface_format_info.h b/shared/source/helpers/surface_format_info.h index 2c88a3c3d7..530d8b3ee3 100644 --- a/shared/source/helpers/surface_format_info.h +++ b/shared/source/helpers/surface_format_info.h @@ -8,6 +8,8 @@ #pragma once #include "shared/source/gmm_helper/gmm_lib.h" +#include "third_party/opencl_headers/CL/cl_ext.h" + namespace NEO { enum GFX3DSTATE_SURFACEFORMAT : unsigned short { GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_FLOAT = 0x000, @@ -242,6 +244,27 @@ struct ImageInfo { bool useLocalMemory; }; +struct ImageImplicitArgs { + const uint8_t structSize = sizeof(ImageImplicitArgs); + uint8_t structVersion; + uint64_t imageWidth; + uint64_t imageHeight; + uint64_t imageDepth; + uint64_t imageArraySize; + uint32_t numSamples; + cl_channel_type channelType; + cl_channel_order channelOrder; + uint32_t numMipLevels; + uint64_t flatBaseOffset; + uint64_t flatWidth; + uint64_t flagHeight; + uint64_t flatPitch; + + static constexpr uint8_t getSize() { return sizeof(ImageImplicitArgs); } +}; + +static_assert(ImageImplicitArgs::getSize() == 88); + struct McsSurfaceInfo { uint32_t pitch; uint32_t qPitch; diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index 97a30728d0..bdb9f8c778 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -1020,7 +1020,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 ? 2 : 1; + auto surfStateCount = isImage ? 3 : 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 695d8dcede..b09f422abc 100644 --- a/shared/test/unit_test/helpers/bindless_heaps_helper_tests.cpp +++ b/shared/test/unit_test/helpers/bindless_heaps_helper_tests.cpp @@ -120,7 +120,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThen EXPECT_EQ(ssInHeapInfo.ssPtr, allocInHeapPtr); } -TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapForImageThenTwoBindlessSlotsAreAllocated) { +TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapForImageThenThreeBindlessSlotsAreAllocated) { auto bindlessHeapHelper = std::make_unique(getMemoryManager(), false, rootDeviceIndex, devBitfield); auto surfaceStateSize = bindlessHeapHelper->surfaceStateSize; memManager->mockExecutionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release()); @@ -130,14 +130,14 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapForI EXPECT_TRUE(getMemoryManager()->allocateBindlessSlot(&alloc)); auto ssInHeapInfo1 = alloc.getBindlessInfo(); - EXPECT_EQ(surfaceStateSize * 2, ssInHeapInfo1.ssSize); + EXPECT_EQ(surfaceStateSize * 3, ssInHeapInfo1.ssSize); MockGraphicsAllocation alloc2; alloc2.allocationType = AllocationType::sharedImage; EXPECT_TRUE(getMemoryManager()->allocateBindlessSlot(&alloc2)); auto ssInHeapInfo2 = alloc2.getBindlessInfo(); - EXPECT_EQ(surfaceStateSize * 2, ssInHeapInfo2.ssSize); + EXPECT_EQ(surfaceStateSize * 3, ssInHeapInfo2.ssSize); } TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwiceForTheSameAllocationThenTheSameOffsetReturned) { @@ -337,10 +337,10 @@ TEST_F(BindlessHeapsHelperTests, givenFreeSlotsExceedingThresholdInResuePoolWhen ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[1] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); - // allocate double size for image - ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(2 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + // allocate triple size for image + ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[3] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); - ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(2 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_FALSE(bindlessHeapHelper->allocateFromReusePool); @@ -368,10 +368,10 @@ TEST_F(BindlessHeapsHelperTests, givenReusePoolExhaustedWhenNewSlotsAllocatedThe ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[1] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); - // allocate double size for image - ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(2 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + // allocate triple size for image + ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[3] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); - ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(2 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_FALSE(bindlessHeapHelper->allocateFromReusePool); @@ -420,10 +420,10 @@ TEST_F(BindlessHeapsHelperTests, givenReleasedSlotsToSecondPoolWhenThresholdReac ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[1] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); - // allocate double size for image - ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(2 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + // allocate triple size for image + ssInHeapInfos[2] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); ssInHeapInfos[3] = bindlessHeapHelper->allocateSSInHeap(size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); - ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(2 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); for (int i = 0; i < 5; i++) { bindlessHeapHelper->releaseSSToReusePool(ssInHeapInfos[i]); @@ -451,7 +451,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(2 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[3] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_EQ(1u, bindlessHeapHelper->allocatePoolIndex); EXPECT_EQ(0u, bindlessHeapHelper->releasePoolIndex); @@ -461,7 +461,7 @@ TEST_F(BindlessHeapsHelperTests, givenReleasedSlotsToSecondPoolWhenThresholdReac EXPECT_EQ(bindlessHeapHelper->surfaceStateInHeapVectorReuse[allocatePoolIndex][1].size(), 1u); - ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(2 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[4] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_EQ(bindlessHeapHelper->surfaceStateInHeapVectorReuse[allocatePoolIndex][1].size(), 0u); EXPECT_FALSE(bindlessHeapHelper->allocateFromReusePool); @@ -476,7 +476,7 @@ TEST_F(BindlessHeapsHelperTests, givenReleasedSlotsToSecondPoolWhenThresholdReac bindlessHeapHelper->stateCacheDirtyForContext.reset(); - ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(2 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_EQ(0u, bindlessHeapHelper->allocatePoolIndex); EXPECT_EQ(1u, bindlessHeapHelper->releasePoolIndex); @@ -518,7 +518,7 @@ TEST_F(BindlessHeapsHelperTests, givenFreeSlotsInReusePoolForONeSizeWhenAllocati ssInHeapInfos[i] = {0}; } - ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(2 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); + ssInHeapInfos[0] = bindlessHeapHelper->allocateSSInHeap(3 * size, nullptr, BindlessHeapsHelper::BindlesHeapType::globalSsh); EXPECT_EQ(0u, bindlessHeapHelper->allocatePoolIndex); EXPECT_EQ(1u, bindlessHeapHelper->releasePoolIndex);