feature: make global bindless heaps resident when created

Make bindless heaps resident right after heap allocation.
Motivation is that SYCL bindless image can be passed as a value argument
or through memory. Therefore, we're not able to make its bindless heap
resident during kernel initialization or setting kernel arguments.

This fixes SYCL bindless image read_write_*D.cpp tests on DG2.

Related-To: NEO-7063
Signed-off-by: Wenju He <wenju.he@intel.com>
This commit is contained in:
Wenju He
2024-03-20 11:45:31 +00:00
committed by Compute-Runtime-Automation
parent 27b930cabc
commit 03078541d7
32 changed files with 227 additions and 266 deletions

View File

@@ -402,10 +402,8 @@ HWTEST_F(CommandListImmediateFlushTaskComputeTests, givenBindlessModeAndUseCsrIm
NEO::debugManager.flags.EnableFlushTaskSubmission.set(1);
NEO::debugManager.flags.UseBindlessMode.set(1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
size_t size = 0x100000001;
NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::AllocationType::internalHostMemory,

View File

@@ -1461,10 +1461,8 @@ HWTEST2_F(CommandListBindlessSshPrivateHeapTest,
IsAtLeastSkl) {
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device->getNEODevice()->getMemoryManager(),
device->getNEODevice()->getNumGenericSubDevices() > 1,
device->getNEODevice()->getRootDeviceIndex(),
device->getNEODevice()->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device->getNEODevice(),
device->getNEODevice()->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = false;
auto globalBindlessBase = mockHelper->getGlobalHeapsBase();
device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getNEODevice()->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
@@ -1610,10 +1608,8 @@ HWTEST2_F(CommandListBindlessSshPrivateHeapTest,
IsAtLeastSkl) {
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device->getNEODevice()->getMemoryManager(),
device->getNEODevice()->getNumGenericSubDevices() > 1,
device->getNEODevice()->getRootDeviceIndex(),
device->getNEODevice()->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device->getNEODevice(),
device->getNEODevice()->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = true;
auto globalBindlessBase = mockHelper->getGlobalHeapsBase();
device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getNEODevice()->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
@@ -1666,10 +1662,8 @@ HWTEST2_F(CommandListBindlessSshPrivateHeapTest,
IsAtLeastSkl) {
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device->getNEODevice()->getMemoryManager(),
device->getNEODevice()->getNumGenericSubDevices() > 1,
device->getNEODevice()->getRootDeviceIndex(),
device->getNEODevice()->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device->getNEODevice(),
device->getNEODevice()->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = false;
auto globalBindlessBase = mockHelper->getGlobalHeapsBase();
device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getNEODevice()->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
@@ -1739,10 +1733,8 @@ HWTEST2_F(CommandListBindlessSshPrivateHeapTest,
IsAtLeastSkl) {
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device->getNEODevice()->getMemoryManager(),
device->getNEODevice()->getNumGenericSubDevices() > 1,
device->getNEODevice()->getRootDeviceIndex(),
device->getNEODevice()->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device->getNEODevice(),
device->getNEODevice()->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = false;
auto globalBindlessBase = mockHelper->getGlobalHeapsBase();
device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getNEODevice()->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());

View File

@@ -1190,7 +1190,7 @@ HWTEST2_F(CmdlistAppendLaunchKernelTests, givenGlobalBindlessAllocatorAndKernelW
DebugManagerStateRestore restorer;
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumGenericSubDevices() > 1, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield());
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice, neoDevice->getNumGenericSubDevices() > 1);
execEnv->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());
std::unique_ptr<MockImmutableData> mockKernelImmData = std::make_unique<MockImmutableData>(0u);
@@ -1231,7 +1231,7 @@ HWTEST2_F(CmdlistAppendLaunchKernelTests, givenGlobalBindlessAllocatorAndKernelW
DebugManagerStateRestore restorer;
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumGenericSubDevices() > 1, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield());
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice, neoDevice->getNumGenericSubDevices() > 1);
execEnv->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());
std::unique_ptr<MockImmutableData> mockKernelImmData = std::make_unique<MockImmutableData>(0u);

View File

@@ -1278,7 +1278,7 @@ HWTEST2_F(CommandQueueDestroy, givenCommandQueueAndCommandListWithSshAndPrivateS
HWTEST2_F(ExecuteCommandListTests, givenBindlessHelperWhenCommandListIsExecutedOnCommandQueueThenHeapContainerIsEmpty, IsAtLeastSkl) {
DebugManagerStateRestore dbgRestorer;
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumGenericSubDevices() > 1, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield());
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice, neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());
ze_command_queue_desc_t desc = {};
NEO::CommandStreamReceiver *csr;

View File

@@ -55,6 +55,7 @@ struct CommandQueueProgramSBATest : public ::testing::Test {
for (uint32_t i = 0; i < numRootDevices; i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
executionEnvironment->rootDeviceEnvironments[i]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
}
memoryManager = new MockMemoryManagerCommandQueueSBA(*executionEnvironment);
@@ -145,7 +146,7 @@ HWTEST2_F(CommandQueueProgramSBATest, whenProgrammingStateBaseAddressWithStatele
HWTEST2_F(CommandQueueProgramSBATest,
givenGlobalSshWhenProgrammingStateBaseAddressThenBindlessBaseAddressAndSizeAreSet, CommandQueueSBASupport) {
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumGenericSubDevices() > 1, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield());
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice, neoDevice->getNumGenericSubDevices() > 1);
MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());
NEO::MockGraphicsAllocation baseAllocation;
@@ -184,7 +185,7 @@ HWTEST2_F(CommandQueueProgramSBATest,
HWTEST2_F(CommandQueueProgramSBATest,
givenGlobalSshAndDshWhenProgrammingStateBaseAddressThenBindlessBaseAddressAndSizeAreSet, CommandQueueSBASupport) {
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumGenericSubDevices() > 1, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield());
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice, neoDevice->getNumGenericSubDevices() > 1);
MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get();
bindlessHeapsHelperPtr->globalBindlessDsh = true;
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());
@@ -229,7 +230,7 @@ HWTEST2_F(CommandQueueProgramSBATest,
HWTEST2_F(CommandQueueProgramSBATest,
givenGlobalBindlessSshWhenProgrammingStateBaseAddressThenBindlessBaseAddressIsSet, CommandQueueSBASupport) {
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumGenericSubDevices() > 1, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield());
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice, neoDevice->getNumGenericSubDevices() > 1);
MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());

View File

@@ -788,7 +788,7 @@ HWTEST_F(CommandQueueExecuteCommandListsSimpleTest, GivenDirtyFlagForContextInBi
ze_command_queue_desc_t queueDesc = {};
ze_result_t returnValue;
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(), neoDevice->getNumGenericSubDevices() > 1, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield());
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice, neoDevice->getNumGenericSubDevices() > 1);
MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());

View File

@@ -1971,11 +1971,11 @@ HWTEST2_F(ContextTest, givenBindlessImageWhenMakeImageResidentAndEvictThenImageI
auto mockMemoryOperationsInterface = new NEO::MockMemoryOperations();
mockMemoryOperationsInterface->captureGfxAllocationsForMakeResident = true;
device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]->memoryOperationsInterface.reset(mockMemoryOperationsInterface);
auto bindlessHelper = new MockBindlesHeapsHelper(device->getNEODevice()->getMemoryManager(),
device->getNEODevice()->getNumGenericSubDevices() > 1,
device->getNEODevice()->getRootDeviceIndex(),
device->getNEODevice()->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(device->getNEODevice(),
device->getNEODevice()->getNumGenericSubDevices() > 1);
device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getNEODevice()->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
// Reset ResidentCalledCount to 0 since bindlessHeapsHelper constructor changes the value.
mockMemoryOperationsInterface->makeResidentCalledCount = 0;
ContextImp *contextImp = static_cast<ContextImp *>(L0::Context::fromHandle(hContext));

View File

@@ -746,10 +746,8 @@ struct DebuggerWithGlobalBindlessFixture : public L0DebuggerFixture {
NEO::debugManager.flags.UseExternalAllocatorForSshAndDsh.set(true);
L0DebuggerFixture::setUp(false);
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = false;
bindlessHelper = mockHelper.get();

View File

@@ -148,10 +148,8 @@ HWTEST2_F(ImageCreate, givenBindlessImageWhenImageInitializeThenImageImplicitArg
GTEST_SKIP();
}
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
@@ -1604,10 +1602,8 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenGettingDeviceOffsetThenBindlessSlot
const size_t height = 32;
const size_t depth = 1;
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
ze_image_bindless_exp_desc_t bindlessExtDesc = {};
@@ -1650,10 +1646,8 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenBindlessSlotAllocationFailsThenImag
const size_t height = 32;
const size_t depth = 1;
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
ze_image_bindless_exp_desc_t bindlessExtDesc = {};
@@ -1687,10 +1681,8 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageCreatedWithInvalidPitchedPtrTh
const size_t height = 32;
const size_t depth = 1;
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
ze_image_pitched_exp_desc_t pitchedDesc = {};
@@ -1724,10 +1716,8 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageCreatedWithDeviceUMSPitchedPtr
const size_t height = 32;
const size_t depth = 1;
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
const size_t size = 4096;
@@ -1797,10 +1787,8 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageViewCreatedWithDeviceUMSPitche
const size_t height = 32;
const size_t depth = 1;
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
const size_t size = 4096;
@@ -1844,10 +1832,8 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenImageViewCreatedWithTheSameFormatTh
const size_t height = 32;
const size_t depth = 1;
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
const size_t size = 4096;
@@ -1906,10 +1892,8 @@ HWTEST2_F(ImageCreate, GivenBindlessImageWhenInitializedThenSurfaceStateCopiedTo
const size_t height = 32;
const size_t depth = 1;
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
ze_image_bindless_exp_desc_t bindlessExtDesc = {};

View File

@@ -2139,10 +2139,8 @@ using KernelImpPatchBindlessTest = Test<ModuleFixture>;
TEST_F(KernelImpPatchBindlessTest, GivenKernelImpWhenPatchBindlessOffsetCalledThenOffsetPatchedCorrectly) {
Mock<KernelImp> kernel;
neoDevice->incRefInternal();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
Mock<Module> mockModule(device, nullptr);
kernel.module = &mockModule;
NEO::MockGraphicsAllocation alloc;
@@ -2204,10 +2202,8 @@ HWTEST2_F(KernelImpPatchBindlessTest, GivenKernelImpWhenSetSurfaceStateBindlessT
const_cast<NEO::KernelDescriptor &>(mockKernel.kernelImmData->getDescriptor()).kernelAttributes.bufferAddressingMode = NEO::KernelDescriptor::BindlessAndStateless;
const_cast<NEO::KernelDescriptor &>(mockKernel.kernelImmData->getDescriptor()).kernelAttributes.imageAddressingMode = NEO::KernelDescriptor::Bindless;
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
auto &gfxCoreHelper = device->getGfxCoreHelper();
size_t size = gfxCoreHelper.getRenderSurfaceStateSize();
@@ -2245,10 +2241,8 @@ HWTEST2_F(KernelImpPatchBindlessTest, GivenMisalignedBufferAddressWhenSettingSur
const_cast<NEO::KernelDescriptor &>(mockKernel.kernelImmData->getDescriptor()).kernelAttributes.imageAddressingMode = NEO::KernelDescriptor::Bindless;
const_cast<NEO::KernelDescriptor &>(mockKernel.kernelImmData->getDescriptor()).initBindlessOffsetToSurfaceState();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
auto &gfxCoreHelper = device->getGfxCoreHelper();
size_t size = gfxCoreHelper.getRenderSurfaceStateSize();
@@ -2307,10 +2301,8 @@ HWTEST2_F(KernelImpPatchBindlessTest, GivenBindlessImplicitArgAndBindlessHeapsHe
EXPECT_EQ(0u, mockKernel.getSurfaceStateHeapDataSize());
const_cast<NEO::KernelDescriptor &>(mockKernel.kernelImmData->getDescriptor()).payloadMappings.implicitArgs.globalConstantsSurfaceAddress.bindless = 0x20;
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
EXPECT_EQ(0u, mockKernel.getSurfaceStateHeapDataSize());
}
@@ -2333,10 +2325,8 @@ HWTEST2_F(KernelImpPatchBindlessTest, GivenMisalignedAndAlignedBufferAddressWhen
const_cast<NEO::KernelDescriptor &>(mockKernel.kernelImmData->getDescriptor()).kernelAttributes.imageAddressingMode = NEO::KernelDescriptor::Bindless;
const_cast<NEO::KernelDescriptor &>(mockKernel.kernelImmData->getDescriptor()).initBindlessOffsetToSurfaceState();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
auto &gfxCoreHelper = device->getGfxCoreHelper();
size_t size = gfxCoreHelper.getRenderSurfaceStateSize();
@@ -2379,10 +2369,8 @@ HWTEST2_F(KernelImpPatchBindlessTest, GivenKernelImpWhenSetSurfaceStateBindfulTh
arg.bindless = undefined<CrossThreadDataOffset>;
arg.bindful = 0x40;
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
auto &gfxCoreHelper = device->getGfxCoreHelper();
size_t size = gfxCoreHelper.getRenderSurfaceStateSize();
@@ -2417,10 +2405,8 @@ HWTEST2_F(KernelImpL3CachingTests, GivenKernelImpWhenSetSurfaceStateWithUnaligne
arg.bindless = undefined<CrossThreadDataOffset>;
arg.bindful = 0x40;
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
auto &gfxCoreHelper = device->getGfxCoreHelper();
size_t size = gfxCoreHelper.getRenderSurfaceStateSize();
uint64_t gpuAddress = 0x2000;
@@ -2754,10 +2740,8 @@ struct MyMockImage : public WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>> {
HWTEST2_F(SetKernelArg, givenImageAndBindlessKernelWhenSetArgImageThenCopySurfaceStateToSSHCalledWithCorrectArgs, ImageSupport) {
createKernel();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
auto &imageArg = const_cast<NEO::ArgDescImage &>(kernel->kernelImmData->getDescriptor().payloadMappings.explicitArgs[3].template as<NEO::ArgDescImage>());
auto &addressingMode = kernel->kernelImmData->getDescriptor().kernelAttributes.imageAddressingMode;
const_cast<NEO::KernelDescriptor::AddressingMode &>(addressingMode) = NEO::KernelDescriptor::Bindless;
@@ -2808,10 +2792,8 @@ HWTEST2_F(SetKernelArg, givenBindlessKernelAndNoAvailableSpaceOnSshWhenSetArgIma
createKernel();
auto mockMemManager = static_cast<MockMemoryManager *>(neoDevice->getMemoryManager());
auto bindlessHelper = new MockBindlesHeapsHelper(mockMemManager,
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
auto &imageArg = const_cast<NEO::ArgDescImage &>(kernel->kernelImmData->getDescriptor().payloadMappings.explicitArgs[3].template as<NEO::ArgDescImage>());
@@ -2842,10 +2824,8 @@ HWTEST2_F(SetKernelArg, givenBindlessKernelAndNoAvailableSpaceOnSshWhenSetArgIma
HWTEST2_F(SetKernelArg, givenImageAndBindlessKernelWhenSetArgImageThenCopyImplicitArgsSurfaceStateToSSHCalledWithCorrectArgs, ImageSupport) {
createKernel();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
auto &imageArg = const_cast<NEO::ArgDescImage &>(kernel->kernelImmData->getDescriptor().payloadMappings.explicitArgs[3].template as<NEO::ArgDescImage>());
auto &addressingMode = kernel->kernelImmData->getDescriptor().kernelAttributes.imageAddressingMode;
const_cast<NEO::KernelDescriptor::AddressingMode &>(addressingMode) = NEO::KernelDescriptor::Bindless;
@@ -2875,10 +2855,8 @@ HWTEST2_F(SetKernelArg, givenImageAndBindlessKernelWhenSetArgImageThenCopyImplic
HWTEST2_F(SetKernelArg, givenImageBindlessKernelAndGlobalBindlessHelperWhenSetArgRedescribedImageCalledThenCopySurfaceStateToSSHCalledWithCorrectArgs, ImageSupport) {
createKernel();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
auto &imageArg = const_cast<NEO::ArgDescImage &>(kernel->kernelImmData->getDescriptor().payloadMappings.explicitArgs[3].template as<NEO::ArgDescImage>());
auto &addressingMode = kernel->kernelImmData->getDescriptor().kernelAttributes.imageAddressingMode;
const_cast<NEO::KernelDescriptor::AddressingMode &>(addressingMode) = NEO::KernelDescriptor::Bindless;
@@ -2908,10 +2886,8 @@ HWTEST2_F(SetKernelArg, givenImageBindlessKernelAndGlobalBindlessHelperWhenSetAr
HWTEST2_F(SetKernelArg, givenGlobalBindlessHelperAndImageViewWhenAllocatingBindlessSlotThenViewHasDifferentSlotThanParentImage, ImageSupport) {
createKernel();
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
auto &imageArg = const_cast<NEO::ArgDescImage &>(kernel->kernelImmData->getDescriptor().payloadMappings.explicitArgs[3].template as<NEO::ArgDescImage>());
auto &addressingMode = kernel->kernelImmData->getDescriptor().kernelAttributes.imageAddressingMode;
const_cast<NEO::KernelDescriptor::AddressingMode &>(addressingMode) = NEO::KernelDescriptor::Bindless;
@@ -2951,10 +2927,8 @@ HWTEST2_F(SetKernelArg, givenGlobalBindlessHelperAndImageViewWhenAllocatingBindl
HWTEST2_F(SetKernelArg, givenGlobalBindlessHelperImageViewAndNoAvailableSpaceOnSshWhenAllocatingBindlessSlotThenOutOfMemoryErrorReturned, ImageSupport) {
createKernel();
auto mockMemManager = static_cast<MockMemoryManager *>(neoDevice->getMemoryManager());
auto bindlessHelper = new MockBindlesHeapsHelper(mockMemManager,
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
auto &imageArg = const_cast<NEO::ArgDescImage &>(kernel->kernelImmData->getDescriptor().payloadMappings.explicitArgs[3].template as<NEO::ArgDescImage>());
@@ -3065,10 +3039,8 @@ HWTEST2_F(SetKernelArg, givenBindlessKernelAndNoAvailableSpaceOnSshWhenSetArgRed
createKernel();
auto mockMemManager = static_cast<MockMemoryManager *>(neoDevice->getMemoryManager());
auto bindlessHelper = new MockBindlesHeapsHelper(mockMemManager,
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
auto &imageArg = const_cast<NEO::ArgDescImage &>(kernel->kernelImmData->getDescriptor().payloadMappings.explicitArgs[3].template as<NEO::ArgDescImage>());
@@ -3099,10 +3071,8 @@ HWTEST2_F(SetKernelArg, givenBindlessKernelAndNoAvailableSpaceOnSshWhenSetArgRed
HWTEST2_F(SetKernelArg, givenBindlessKernelAndNoAvailableSpaceOnSshWhenSetArgBufferCalledThenOutOfMemoryErrorReturned, MatchAny) {
auto mockMemManager = static_cast<MockMemoryManager *>(neoDevice->getMemoryManager());
auto bindlessHelper = new MockBindlesHeapsHelper(mockMemManager,
neoDevice->getNumGenericSubDevices() > 1,
neoDevice->getRootDeviceIndex(),
neoDevice->getDeviceBitfield());
auto bindlessHelper = new MockBindlesHeapsHelper(neoDevice,
neoDevice->getNumGenericSubDevices() > 1);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHelper);
ze_kernel_desc_t desc = {};

View File

@@ -651,10 +651,9 @@ HWTEST2_F(KernelImmutableDataBindlessTest, givenGlobalConstBufferAndBindlessExpl
HardwareInfo hwInfo = *defaultHwInfo;
auto device = std::unique_ptr<NEO::MockDevice>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device->getMemoryManager(),
device->getNumGenericSubDevices() > 1,
device->getRootDeviceIndex(),
device->getDeviceBitfield());
device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device.get(),
device->getNumGenericSubDevices() > 1);
device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
static EncodeSurfaceStateArgs savedSurfaceStateArgs{};
@@ -731,10 +730,9 @@ HWTEST2_F(KernelImmutableDataBindlessTest, givenGlobalVarBufferAndBindlessExplic
HardwareInfo hwInfo = *defaultHwInfo;
auto device = std::unique_ptr<NEO::MockDevice>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device->getMemoryManager(),
device->getNumGenericSubDevices() > 1,
device->getRootDeviceIndex(),
device->getDeviceBitfield());
device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(device.get(),
device->getNumGenericSubDevices() > 1);
device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
static EncodeSurfaceStateArgs savedSurfaceStateArgs{};