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{};

View File

@@ -1277,8 +1277,8 @@ TEST(SubDevicesTest, givenCreateMultipleSubDevicesFlagSetWhenBindlessHeapHelperC
debugManager.flags.CreateMultipleSubDevices.set(2);
VariableBackup<bool> mockDeviceFlagBackup(&MockDevice::createSingleDevice, false);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->createBindlessHeapsHelper(device->getMemoryManager(), device->getNumGenericSubDevices() > 1, device->getRootDeviceIndex(), device->getDeviceBitfield());
device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->createBindlessHeapsHelper(device.get(), device->getNumGenericSubDevices() > 1);
EXPECT_EQ(device->getBindlessHeapsHelper(), device->subdevices.at(0)->getBindlessHeapsHelper());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -23,6 +23,7 @@ void ClDeviceFixture::setUp() {
void ClDeviceFixture::setUpImpl(const NEO::HardwareInfo *hardwareInfo) {
pDevice = MockClDevice::createWithNewExecutionEnvironment<MockDevice>(hardwareInfo, rootDeviceIndex);
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
ASSERT_NE(nullptr, pDevice);
pClExecutionEnvironment = static_cast<MockClExecutionEnvironment *>(pDevice->getExecutionEnvironment());
pClDevice = new MockClDevice{pDevice};

View File

@@ -676,10 +676,8 @@ HWTEST_F(KernelArgBufferTestBindless, givenUsedBindlessBuffersWhenSettingKernelA
HWTEST_F(KernelArgBufferTestBindless, givenBindlessBuffersWhenPatchBindlessOffsetCalledThenBindlessOffsetToSurfaceStateWrittenInCrossThreadData) {
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pClDevice->getMemoryManager(),
pClDevice->getNumGenericSubDevices() > 1,
pClDevice->getRootDeviceIndex(),
pClDevice->getDeviceBitfield());
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice,
pClDevice->getNumGenericSubDevices() > 1);
using DataPortBindlessSurfaceExtendedMessageDescriptor = typename FamilyType::DataPortBindlessSurfaceExtendedMessageDescriptor;
auto patchLocation = reinterpret_cast<uint32_t *>(ptrOffset(pKernel->getCrossThreadData(), bindlessOffset));

View File

@@ -39,7 +39,7 @@ Device *RootDevice::getRootDevice() const {
void RootDevice::createBindlessHeapsHelper() {
if (ApiSpecificConfig::getGlobalBindlessHeapConfiguration() && ApiSpecificConfig::getBindlessMode(this->getReleaseHelper())) {
this->executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->createBindlessHeapsHelper(getMemoryManager(), getNumGenericSubDevices() > 1, rootDeviceIndex, getDeviceBitfield());
this->executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->createBindlessHeapsHelper(this, getNumGenericSubDevices() > 1);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2023 Intel Corporation
* Copyright (C) 2019-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -135,8 +135,8 @@ const ProductHelper &RootDeviceEnvironment::getProductHelper() const {
return *productHelper;
}
void RootDeviceEnvironment::createBindlessHeapsHelper(MemoryManager *memoryManager, bool availableDevices, uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield) {
bindlessHeapsHelper = std::make_unique<BindlessHeapsHelper>(memoryManager, availableDevices, rootDeviceIndex, deviceBitfield);
void RootDeviceEnvironment::createBindlessHeapsHelper(Device *rootDevice, bool availableDevices) {
bindlessHeapsHelper = std::make_unique<BindlessHeapsHelper>(rootDevice, availableDevices);
}
CompilerInterface *RootDeviceEnvironment::getCompilerInterface() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2023 Intel Corporation
* Copyright (C) 2019-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -76,7 +76,7 @@ struct RootDeviceEnvironment : NonCopyableClass {
BuiltIns *getBuiltIns();
BindlessHeapsHelper *getBindlessHeapsHelper() const;
AssertHandler *getAssertHandler(Device *neoDevice);
void createBindlessHeapsHelper(MemoryManager *memoryManager, bool availableDevices, uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield);
void createBindlessHeapsHelper(Device *rootDevice, bool availableDevices);
void limitNumberOfCcs(uint32_t numberOfCcs);
bool isNumberOfCcsLimited() const;
void setRcsExposure();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,7 @@
#include "shared/source/helpers/bindless_heaps_helper.h"
#include "shared/source/device/device.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/gfx_core_helper.h"
@@ -15,6 +16,7 @@
#include "shared/source/memory_manager/allocation_properties.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/memory_manager/memory_operations_handler.h"
#include "shared/source/os_interface/os_context.h"
namespace NEO {
@@ -23,12 +25,12 @@ constexpr size_t globalSshAllocationSize = 4 * MemoryConstants::pageSize64k;
constexpr size_t borderColorAlphaOffset = alignUp(4 * sizeof(float), MemoryConstants::cacheLineSize);
using BindlesHeapType = BindlessHeapsHelper::BindlesHeapType;
BindlessHeapsHelper::BindlessHeapsHelper(MemoryManager *memManager, bool isMultiOsContextCapable,
const uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield) : surfaceStateSize(memManager->peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->getHelper<GfxCoreHelper>().getRenderSurfaceStateSize()),
memManager(memManager),
isMultiOsContextCapable(isMultiOsContextCapable),
rootDeviceIndex(rootDeviceIndex),
deviceBitfield(deviceBitfield) {
BindlessHeapsHelper::BindlessHeapsHelper(Device *rootDevice, bool isMultiOsContextCapable) : rootDevice(rootDevice),
surfaceStateSize(rootDevice->getRootDeviceEnvironment().getHelper<GfxCoreHelper>().getRenderSurfaceStateSize()),
memManager(rootDevice->getMemoryManager()),
isMultiOsContextCapable(isMultiOsContextCapable),
rootDeviceIndex(rootDevice->getRootDeviceIndex()),
deviceBitfield(rootDevice->getDeviceBitfield()) {
for (auto heapType = 0; heapType < BindlesHeapType::numHeapTypes; heapType++) {
auto size = MemoryConstants::pageSize64k;
@@ -60,7 +62,14 @@ GraphicsAllocation *BindlessHeapsHelper::getHeapAllocation(size_t heapSize, size
properties.flags.use32BitFrontWindow = allocInFrontWindow;
properties.alignment = alignment;
return this->memManager->allocateGraphicsMemoryWithProperties(properties);
GraphicsAllocation *allocation = memManager->allocateGraphicsMemoryWithProperties(properties);
MemoryOperationsHandler *memoryOperationsIface = rootDevice->getRootDeviceEnvironmentRef().memoryOperationsInterface.get();
auto result = memoryOperationsIface->makeResident(rootDevice, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1));
if (result != NEO::MemoryOperationsStatus::success) {
memManager->freeGraphicsMemory(allocation);
return nullptr;
}
return allocation;
}
void BindlessHeapsHelper::clearStateDirtyForContext(uint32_t osContextId) {

View File

@@ -27,7 +27,7 @@ class BindlessHeapsHelper {
globalDsh,
numHeapTypes
};
BindlessHeapsHelper(MemoryManager *memManager, bool isMultiOsContextCapable, const uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield);
BindlessHeapsHelper(Device *rootDevice, bool isMultiOsContextCapable);
MOCKABLE_VIRTUAL ~BindlessHeapsHelper();
BindlessHeapsHelper(const BindlessHeapsHelper &) = delete;
@@ -59,6 +59,7 @@ class BindlessHeapsHelper {
void clearStateDirtyForContext(uint32_t osContextId);
protected:
Device *rootDevice = nullptr;
const size_t surfaceStateSize;
bool growHeap(BindlesHeapType heapType);
MemoryManager *memManager = nullptr;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,7 +14,7 @@ using namespace NEO;
class MockBindlesHeapsHelper : public BindlessHeapsHelper {
public:
using BaseClass = BindlessHeapsHelper;
MockBindlesHeapsHelper(MemoryManager *memManager, bool isMultiOsContextCapable, const uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield) : BaseClass(memManager, isMultiOsContextCapable, rootDeviceIndex, deviceBitfield) {
MockBindlesHeapsHelper(Device *rootDevice, bool isMultiOsContextCapable) : BindlessHeapsHelper(rootDevice, isMultiOsContextCapable) {
globalSsh = surfaceStateHeaps[BindlesHeapType::globalSsh].get();
specialSsh = surfaceStateHeaps[BindlesHeapType::specialSsh].get();
scratchSsh = surfaceStateHeaps[BindlesHeapType::specialSsh].get();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -57,6 +57,9 @@ MockDevice::MockDevice(ExecutionEnvironment *executionEnvironment, uint32_t root
auto &hwInfo = getHardwareInfo();
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfoAndInitHelpers(&hwInfo);
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->initGmm();
if (!executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface) {
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
}
initializeCaps();
preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo);

View File

@@ -14,6 +14,7 @@
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/variable_backup.h"
#include "shared/test/common/mocks/mock_memory_operations_handler.h"
namespace NEO {
class CommandStreamReceiver;
@@ -121,6 +122,9 @@ class MockDevice : public RootDevice {
static T *createWithExecutionEnvironment(const HardwareInfo *pHwInfo, ExecutionEnvironment *executionEnvironment, uint32_t rootDeviceIndex) {
pHwInfo = pHwInfo ? pHwInfo : defaultHwInfo.get();
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfoAndInitHelpers(pHwInfo);
if (!executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface) {
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
}
T *device = new T(executionEnvironment, rootDeviceIndex);
return createDeviceInternals(device);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2023 Intel Corporation
* Copyright (C) 2019-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -147,7 +147,8 @@ void DrmMemoryManagerFixtureWithoutQuietIoctlExpectation::setUp(bool enableLocal
regionInfo[1].probedSize = 16 * MemoryConstants::gigaByte;
mock->memoryInfo.reset(new MockedMemoryInfo(regionInfo, *mock));
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*mock, 0u, false);
memoryManager.reset(new TestedDrmMemoryManager(enableLocalMem, false, false, *executionEnvironment));
memoryManager = new TestedDrmMemoryManager(enableLocalMem, false, false, *executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager);
ASSERT_NE(nullptr, memoryManager);
if (memoryManager->getgemCloseWorker()) {

View File

@@ -115,7 +115,7 @@ class DrmMemoryManagerFixtureWithoutQuietIoctlExpectation {
public:
DrmMemoryManagerFixtureWithoutQuietIoctlExpectation();
DrmMemoryManagerFixtureWithoutQuietIoctlExpectation(uint32_t numRootDevices, uint32_t rootIndex);
std::unique_ptr<TestedDrmMemoryManager> memoryManager;
TestedDrmMemoryManager *memoryManager = nullptr;
DrmMockCustom *mock;
void setUp();

View File

@@ -1531,10 +1531,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsWit
auto csr = pDevice->getDefaultEngine().commandStreamReceiver;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex(),
pDevice->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice, pDevice->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = false;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());

View File

@@ -4588,7 +4588,7 @@ HWTEST_F(CommandStreamReceiverHwTest, GivenDirtyFlagForContextInBindlessHelperWh
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice, pDevice->getNumGenericSubDevices() > 1);
MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get();
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());
@@ -4638,7 +4638,7 @@ HWTEST_F(CommandStreamReceiverHwTest, GivenDirtyFlagForContextInBindlessHelperWh
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto bindlessHeapsHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice, pDevice->getNumGenericSubDevices() > 1);
MockBindlesHeapsHelper *bindlessHeapsHelperPtr = bindlessHeapsHelper.get();
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(bindlessHeapsHelper.release());

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -1430,10 +1430,8 @@ HWTEST_F(BindlessCommandEncodeStatesContainerTest, givenBindlessKernelAndBindles
debugManager.flags.UseBindlessMode.set(1);
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex(),
pDevice->getDeviceBitfield());
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice,
pDevice->getNumGenericSubDevices() > 1);
auto commandContainer = std::make_unique<CommandContainer>();
commandContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
@@ -1467,10 +1465,8 @@ HWTEST_F(BindlessCommandEncodeStatesContainerTest, givenBindfulKernelWhenBindles
commandContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
commandContainer->setDirtyStateForAllHeaps(false);
commandContainer->l1CachePolicyDataRef() = &l1CachePolicyData;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex(),
pDevice->getDeviceBitfield());
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice,
pDevice->getNumGenericSubDevices() > 1);
uint32_t numBindingTable = 1;
BINDING_TABLE_STATE bindingTableState = FamilyType::cmdInitBindingTableState;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -78,10 +78,8 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWit
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex(),
pDevice->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice,
pDevice->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = true;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
@@ -103,10 +101,8 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWit
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex(),
pDevice->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice,
pDevice->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = true;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
@@ -138,10 +134,8 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessHeapHelperAndGlobalDshNot
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex(),
pDevice->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice,
pDevice->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = false;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
@@ -178,10 +172,8 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsRe
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex(),
pDevice->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice,
pDevice->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = true;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
@@ -200,10 +192,8 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsGr
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex(),
pDevice->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice,
pDevice->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = true;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
@@ -222,10 +212,8 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsBl
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex(),
pDevice->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice,
pDevice->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = true;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());
@@ -244,10 +232,8 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsAl
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(1);
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
uint32_t numSamplers = 1;
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(),
pDevice->getNumGenericSubDevices() > 1,
pDevice->getRootDeviceIndex(),
pDevice->getDeviceBitfield());
auto mockHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice,
pDevice->getNumGenericSubDevices() > 1);
mockHelper->globalBindlessDsh = true;
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset(mockHelper.release());

View File

@@ -46,16 +46,23 @@ class BindlessHeapsHelperFixture {
void setUp() {
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(true);
memManager = std::make_unique<MockMemoryManager>();
rootDevice = std::unique_ptr<NEO::MockDevice>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get(), rootDeviceIndex));
memManager = static_cast<MockMemoryManager *>(rootDevice->getMemoryManager());
rootDevice->getRootDeviceEnvironmentRef().memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
}
void tearDown() {}
Device *getDevice() {
return rootDevice.get();
}
MemoryManager *getMemoryManager() {
return memManager.get();
return memManager;
}
DebugManagerStateRestore dbgRestorer;
std::unique_ptr<MockMemoryManager> memManager;
std::unique_ptr<MockDevice> rootDevice;
MockMemoryManager *memManager = nullptr;
uint32_t rootDeviceIndex = 0;
DeviceBitfield devBitfield = 1;
int genericSubDevices = 1;
@@ -64,13 +71,13 @@ class BindlessHeapsHelperFixture {
using BindlessHeapsHelperTests = Test<BindlessHeapsHelperFixture>;
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenItsCreatedThenSpecialSshAllocatedAtHeapBegining) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
auto specialSshAllocation = bindlessHeapHelper->specialSsh->getGraphicsAllocation();
EXPECT_EQ(specialSshAllocation->getGpuAddress(), specialSshAllocation->getGpuBaseAddress());
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThenHeapUsedSpaceGrow) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
auto usedBefore = bindlessHeapHelper->globalSsh->getUsed();
MockGraphicsAllocation alloc;
@@ -81,7 +88,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThen
}
TEST_F(BindlessHeapsHelperTests, givenNoMemoryAvailableWhenAllocateSsInHeapThenNullptrIsReturned) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
MockGraphicsAllocation alloc;
size_t size = 0x40;
@@ -96,9 +103,9 @@ TEST_F(BindlessHeapsHelperTests, givenNoMemoryAvailableWhenAllocateSsInHeapThenN
}
TEST_F(BindlessHeapsHelperTests, givenNoMemoryAvailableWhenAllocatingBindlessSlotThenFalseIsReturned) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
auto bindlessHeapHelperPtr = bindlessHeapHelper.get();
memManager->mockExecutionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
memManager->peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
MockGraphicsAllocation alloc;
bindlessHeapHelperPtr->globalSsh->getSpace(bindlessHeapHelperPtr->globalSsh->getAvailableSpace());
@@ -110,7 +117,7 @@ TEST_F(BindlessHeapsHelperTests, givenNoMemoryAvailableWhenAllocatingBindlessSlo
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThenMemoryAtReturnedOffsetIsCorrect) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
MockGraphicsAllocation alloc;
size_t size = 0x40;
@@ -121,9 +128,9 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapThen
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapForImageThenThreeBindlessSlotsAreAllocated) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
auto surfaceStateSize = bindlessHeapHelper->surfaceStateSize;
memManager->mockExecutionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
memManager->peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
MockGraphicsAllocation alloc;
alloc.allocationType = AllocationType::image;
@@ -141,7 +148,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapForI
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwiceForTheSameAllocationThenTheSameOffsetReturned) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
MockGraphicsAllocation alloc;
@@ -154,7 +161,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwic
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwiceForDifferentAllocationsThenDifferentOffsetsReturned) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
MockGraphicsAllocation alloc1;
MockGraphicsAllocation alloc2;
@@ -168,7 +175,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInHeapTwic
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocatingMoreSsThenNewHeapAllocationCreated) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
size_t ssSize = 0x40;
auto ssCount = bindlessHeapHelper->globalSsh->getAvailableSpace() / ssSize;
auto graphicsAllocations = std::make_unique<MockGraphicsAllocation[]>(ssCount);
@@ -185,27 +192,27 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocatingMoreSsThen
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenCreatedThenAllocationsHaveTheSameBaseAddress) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
for (auto allocation : bindlessHeapHelper->ssHeapsAllocations) {
EXPECT_EQ(allocation->getGpuBaseAddress(), bindlessHeapHelper->getGlobalHeapsBase());
}
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetDefaultBorderColorOffsetCalledThenCorrectOffsetReturned) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress();
EXPECT_EQ(bindlessHeapHelper->getDefaultBorderColorOffset(), expectedOffset);
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenGetAlphaBorderColorOffsetCalledThenCorrectOffsetReturned) {
auto borderColorSize = 0x40;
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
auto expectedOffset = bindlessHeapHelper->borderColorStates->getGpuAddress() - bindlessHeapHelper->borderColorStates->getGpuBaseAddress() + borderColorSize;
EXPECT_EQ(bindlessHeapHelper->getAlphaBorderColorOffset(), expectedOffset);
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInSpecialHeapThenFirstSlotIsAtOffsetZero) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
MockGraphicsAllocation alloc;
size_t size = 0x40;
auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::specialSsh);
@@ -216,7 +223,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInSpecialH
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInGlobalHeapThenOffsetLessThanHeapSize) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
MockGraphicsAllocation alloc;
size_t size = 0x40;
auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::globalSsh);
@@ -225,7 +232,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInGlobalHe
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInGlobalDshThenOffsetLessThanHeapSize) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
MockGraphicsAllocation alloc;
size_t size = 0x40;
auto ssInHeapInfo = bindlessHeapHelper->allocateSSInHeap(size, &alloc, BindlessHeapsHelper::BindlesHeapType::globalDsh);
@@ -236,9 +243,9 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocateSsInGlobalDs
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenFreeGraphicsMemoryIsCalledThenSSinHeapInfoShouldBePlacedInReuseVector) {
DebugManagerStateRestore dbgRestorer;
debugManager.flags.UseBindlessMode.set(1);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
MockBindlesHeapsHelper *bindlessHeapHelperPtr = bindlessHeapHelper.get();
memManager->mockExecutionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
memManager->peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
MockGraphicsAllocation *alloc = new MockGraphicsAllocation;
memManager->allocateBindlessSlot(alloc);
@@ -269,8 +276,8 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenFreeGraphicsMemoryIs
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocatingBindlessSlotTwiceThenNewSlotIsNotAllocatedAndTrueIsReturned) {
DebugManagerStateRestore dbgRestorer;
debugManager.flags.UseBindlessMode.set(1);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
memManager->mockExecutionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
memManager->peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
MockGraphicsAllocation *alloc = new MockGraphicsAllocation;
EXPECT_TRUE(memManager->allocateBindlessSlot(alloc));
auto ssInHeapInfo = alloc->getBindlessInfo();
@@ -286,10 +293,10 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenAllocatingBindlessSl
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperPreviousAllocationThenItShouldNotBeReusedIfThresholdNotReached) {
DebugManagerStateRestore dbgRestorer;
debugManager.flags.UseBindlessMode.set(1);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
MockBindlesHeapsHelper *bindlessHeapHelperPtr = bindlessHeapHelper.get();
MockGraphicsAllocation *alloc = new MockGraphicsAllocation;
memManager->mockExecutionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
memManager->peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->bindlessHeapsHelper.reset(bindlessHeapHelper.release());
memManager->allocateBindlessSlot(alloc);
auto ssInHeapInfo = alloc->getBindlessInfo();
@@ -312,13 +319,12 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperPreviousAllocationThenIt
TEST_F(BindlessHeapsHelperTests, givenDeviceWhenBindlessHeapHelperInitializedThenCorrectDeviceBitFieldIsUsed) {
DebugManagerStateRestore dbgRestorer;
debugManager.flags.UseBindlessMode.set(1);
DeviceBitfield deviceBitfield = 7;
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, deviceBitfield);
EXPECT_EQ(reinterpret_cast<MockMemoryManager *>(getMemoryManager())->recentlyPassedDeviceBitfield, deviceBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
EXPECT_EQ(reinterpret_cast<MockMemoryManager *>(getMemoryManager())->recentlyPassedDeviceBitfield, getDevice()->getDeviceBitfield());
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenCreatedThenAllocateAndReleasePoolIndicesAreInitializedToZero) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
EXPECT_FALSE(bindlessHeapHelper->allocateFromReusePool);
EXPECT_EQ(0u, bindlessHeapHelper->allocatePoolIndex);
@@ -328,7 +334,7 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenCreatedThenAllocateA
}
TEST_F(BindlessHeapsHelperTests, givenFreeSlotsExceedingThresholdInResuePoolWhenNewSlotsAllocatedThenSlotsAreAllocatedFromReusePool) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
bindlessHeapHelper->reuseSlotCountThreshold = 4;
size_t size = bindlessHeapHelper->surfaceStateSize;
@@ -359,7 +365,7 @@ TEST_F(BindlessHeapsHelperTests, givenFreeSlotsExceedingThresholdInResuePoolWhen
}
TEST_F(BindlessHeapsHelperTests, givenReusePoolExhaustedWhenNewSlotsAllocatedThenSlotsAreNotResuedAndStateCacheDirtyFlagsAreNotSet) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
bindlessHeapHelper->reuseSlotCountThreshold = 4;
size_t size = bindlessHeapHelper->surfaceStateSize;
@@ -411,7 +417,7 @@ TEST_F(BindlessHeapsHelperTests, givenReusePoolExhaustedWhenNewSlotsAllocatedThe
}
TEST_F(BindlessHeapsHelperTests, givenReleasedSlotsToSecondPoolWhenThresholdReachedThenPoolsAreSwitchedAndSlotsAllocatedFromReusePool) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
bindlessHeapHelper->reuseSlotCountThreshold = 4;
size_t size = bindlessHeapHelper->surfaceStateSize;
@@ -500,7 +506,7 @@ TEST_F(BindlessHeapsHelperTests, givenReleasedSlotsToSecondPoolWhenThresholdReac
}
TEST_F(BindlessHeapsHelperTests, givenFreeSlotsInReusePoolForONeSizeWhenAllocatingDifferentSizeThenNewSlotFromHeapIsAllocated) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
bindlessHeapHelper->reuseSlotCountThreshold = 4;
size_t size = bindlessHeapHelper->surfaceStateSize;
@@ -532,7 +538,7 @@ TEST_F(BindlessHeapsHelperTests, givenFreeSlotsInReusePoolForONeSizeWhenAllocati
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHelperWhenGettingAndClearingDirstyStateForContextThenCorrectFlagIsReturnedAdCleard) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getMemoryManager(), false, rootDeviceIndex, devBitfield);
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
EXPECT_FALSE(bindlessHeapHelper->getStateDirtyForContext(1));
bindlessHeapHelper->stateCacheDirtyForContext.set(3);
@@ -540,4 +546,14 @@ TEST_F(BindlessHeapsHelperTests, givenBindlessHelperWhenGettingAndClearingDirsty
bindlessHeapHelper->clearStateDirtyForContext(3);
EXPECT_FALSE(bindlessHeapHelper->getStateDirtyForContext(3));
}
}
TEST_F(BindlessHeapsHelperTests, givenBindlessHeapHelperWhenItsCreatedThenSshAllocationsAreResident) {
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(getDevice(), false);
MemoryOperationsHandler *memoryOperationsIface = getDevice()->getRootDeviceEnvironmentRef().memoryOperationsInterface.get();
for (int heapType = 0; heapType < BindlessHeapsHelper::BindlesHeapType::numHeapTypes; heapType++) {
auto *allocation = bindlessHeapHelper->getHeap(static_cast<BindlessHeapsHelper::BindlesHeapType>(heapType))->getGraphicsAllocation();
EXPECT_EQ(memoryOperationsIface->isResident(getDevice(), *allocation), MemoryOperationsStatus::success);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -36,7 +36,7 @@ using DrmGlobalBindlessAllocatorTests = Test<GlobalBindlessDrmMemManagerFixture>
TEST_F(DrmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSurfaceStatesAllocationCreatedThenGpuBaseAddressIsSetToCorrectBaseAddress) {
MockAllocationProperties properties(rootDeviceIndex, true, MemoryConstants::pageSize64k, AllocationType::linearStream);
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->createBindlessHeapsHelper(memoryManager.get(), false, rootDeviceIndex, 1);
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->createBindlessHeapsHelper(device.get(), false);
auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(properties, nullptr);
ASSERT_NE(nullptr, allocation);
auto gmmHelper = memoryManager->getGmmHelper(rootDeviceIndex);
@@ -55,7 +55,7 @@ TEST_F(DrmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSurfaceStatesAllocat
allocData.type = AllocationType::linearStream;
allocData.size = MemoryConstants::pageSize64k;
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->createBindlessHeapsHelper(memoryManager.get(), false, rootDeviceIndex, 1);
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->createBindlessHeapsHelper(device.get(), false);
MemoryManager::AllocationStatus status;
auto allocation = memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status);
ASSERT_NE(nullptr, allocation);
@@ -75,7 +75,7 @@ TEST_F(DrmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSpecialSshHeapCreate
allocData.type = AllocationType::linearStream;
allocData.size = MemoryConstants::pageSize64k;
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->createBindlessHeapsHelper(memoryManager.get(), false, rootDeviceIndex, 1);
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->createBindlessHeapsHelper(device.get(), false);
auto gmmHelper = memoryManager->getGmmHelper(rootDeviceIndex);
EXPECT_EQ(gmmHelper->canonize(memoryManager->getExternalHeapBaseAddress(rootDeviceIndex, true)),
@@ -92,7 +92,7 @@ TEST_F(DrmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSurfaceStatesAllocat
allocData.type = AllocationType::linearStream;
allocData.size = MemoryConstants::pageSize64k;
executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(memoryManager.get(), false, rootDeviceIndex, 1);
executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(device.get(), false);
AllocationProperties properties = {rootDeviceIndex, MemoryConstants::pageSize64k, AllocationType::linearStream, {}};
auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(properties, nullptr);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,6 +14,7 @@
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_wddm.h"
#include "shared/test/common/os_interface/windows/mock_wddm_memory_manager.h"
#include "shared/test/common/test_macros/hw_test.h"
@@ -32,7 +33,7 @@ class GlobalBindlessWddmMemManagerFixture {
void setUp() {
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(true);
executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment = new ExecutionEnvironment{};
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
@@ -40,13 +41,16 @@ class GlobalBindlessWddmMemManagerFixture {
DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
auto wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Wddm>());
wddm->callBaseMapGpuVa = false;
memManager = std::unique_ptr<FrontWindowMemManagerMock>(new FrontWindowMemManagerMock(*executionEnvironment));
memManager = new FrontWindowMemManagerMock(*executionEnvironment);
executionEnvironment->memoryManager.reset(memManager);
device.reset(Device::create<MockDevice>(executionEnvironment, 0u));
}
void tearDown() {
}
std::unique_ptr<ExecutionEnvironment> executionEnvironment;
std::unique_ptr<FrontWindowMemManagerMock> memManager;
std::unique_ptr<MockDevice> device;
ExecutionEnvironment *executionEnvironment = nullptr;
FrontWindowMemManagerMock *memManager = nullptr;
DebugManagerStateRestore dbgRestorer;
};
@@ -77,9 +81,10 @@ TEST_F(WddmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSurfaceStatesAlloca
MockAllocationProperties properties(0, true, MemoryConstants::pageSize64k, AllocationType::linearStream);
properties.flags.use32BitFrontWindow = true;
memManager.reset(new FrontWindowMemManagerMock(true, true, *executionEnvironment));
memManager = new FrontWindowMemManagerMock(true, true, *executionEnvironment);
executionEnvironment->memoryManager.reset(memManager);
executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(memManager.get(), false, 0, 1);
executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(device.get(), false);
auto allocation = memManager->allocateGraphicsMemoryInPreferredPool(properties, nullptr);
ASSERT_NE(nullptr, allocation);
@@ -102,9 +107,10 @@ TEST_F(WddmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSurfaceStatesAlloca
auto wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Wddm>());
wddm->callBaseMapGpuVa = true;
memManager.reset(new FrontWindowMemManagerMock(true, true, *executionEnvironment));
memManager = new FrontWindowMemManagerMock(true, true, *executionEnvironment);
executionEnvironment->memoryManager.reset(memManager);
executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(memManager.get(), false, 0, 1);
executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(device.get(), false);
MemoryManager::AllocationStatus status;
auto allocation = memManager->allocateGraphicsMemoryInDevicePool(allocData, status);
@@ -128,9 +134,10 @@ TEST_F(WddmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSpecialSshHeapCreat
auto wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Wddm>());
wddm->callBaseMapGpuVa = true;
memManager.reset(new FrontWindowMemManagerMock(true, true, *executionEnvironment));
memManager = new FrontWindowMemManagerMock(true, true, *executionEnvironment);
executionEnvironment->memoryManager.reset(memManager);
executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(memManager.get(), false, 0, 1);
executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(device.get(), false);
auto gmmHelper = memManager->getGmmHelper(0);
EXPECT_EQ(gmmHelper->canonize(memManager->getExternalHeapBaseAddress(0, true)),
@@ -147,9 +154,10 @@ TEST_F(WddmGlobalBindlessAllocatorTests, givenLocalMemoryWhenSurfaceStatesAlloca
allocData.type = AllocationType::linearStream;
allocData.size = MemoryConstants::pageSize64k;
memManager.reset(new FrontWindowMemManagerMock(true, true, *executionEnvironment));
memManager = new FrontWindowMemManagerMock(true, true, *executionEnvironment);
executionEnvironment->memoryManager.reset(memManager);
executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(memManager.get(), false, 0, 1);
executionEnvironment->rootDeviceEnvironments[0]->createBindlessHeapsHelper(device.get(), false);
AllocationProperties properties = {0, MemoryConstants::pageSize64k, AllocationType::linearStream, {}};
auto allocation = memManager->allocateGraphicsMemoryInPreferredPool(properties, nullptr);

View File

@@ -63,7 +63,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ScratchControllerTests, givenDirtyScratchAllocation
std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(),
*execEnv,
*csr.getInternalAllocationStorage());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice, pDevice->getNumGenericSubDevices() > 1);
bool gsbaStateDirty = false;
bool frontEndStateDirty = false;
scratchController->scratchDirty = true;
@@ -83,7 +83,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ScratchControllerTests, givenNotDirtyScratchAllocat
std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(),
*execEnv,
*csr.getInternalAllocationStorage());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice, pDevice->getNumGenericSubDevices() > 1);
bool gsbaStateDirty = false;
bool frontEndStateDirty = false;
scratchController->scratchDirty = false;
@@ -105,7 +105,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ScratchControllerTests, givenNoBindlessSSWhenProgra
std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(),
*execEnv,
*csr.getInternalAllocationStorage());
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto bindlessHeapHelper = std::make_unique<MockBindlesHeapsHelper>(pDevice, pDevice->getNumGenericSubDevices() > 1);
bool gsbaStateDirty = false;
bool frontEndStateDirty = false;
scratchController->scratchDirty = false;
@@ -128,7 +128,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ScratchControllerTests, givenPrivateScratchEnabledW
std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(),
*execEnv,
*csr.getInternalAllocationStorage());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice, pDevice->getNumGenericSubDevices() > 1);
bool gsbaStateDirty = false;
bool frontEndStateDirty = false;
scratchController->scratchDirty = true;
@@ -150,7 +150,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ScratchControllerTests, givenPrivateScratchDisabled
std::unique_ptr<MockScratchSpaceControllerXeHPAndLater> scratchController = std::make_unique<MockScratchSpaceControllerXeHPAndLater>(pDevice->getRootDeviceIndex(),
*execEnv,
*csr.getInternalAllocationStorage());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice->getMemoryManager(), pDevice->getNumGenericSubDevices() > 1, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
auto bindlessHeapHelper = std::make_unique<BindlessHeapsHelper>(pDevice, pDevice->getNumGenericSubDevices() > 1);
bool gsbaStateDirty = false;
bool frontEndStateDirty = false;
scratchController->scratchDirty = true;