fix: adjust tests to enabled global allocator 3/n

Related-To: NEO-7063
Signed-off-by: Fabian Zwoliński <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwoliński
2024-07-16 16:32:50 +00:00
committed by Compute-Runtime-Automation
parent 7209af3f73
commit cbb112ef6d
9 changed files with 78 additions and 19 deletions

View File

@@ -199,10 +199,12 @@ void CommandListCoreFamilyImmediate<gfxCoreFamily>::handleHeapsAndResidencyForIm
}
}
ssh = this->commandContainer.getIndirectHeap(NEO::IndirectHeap::Type::surfaceState);
csr->makeResident(*ssh->getGraphicsAllocation());
if constexpr (streamStatesSupported) {
this->requiredStreamState.stateBaseAddress.setPropertiesBindingTableSurfaceState(ssh->getHeapGpuBase(), ssh->getHeapSizeInPages(),
ssh->getHeapGpuBase(), ssh->getHeapSizeInPages());
if (ssh) {
csr->makeResident(*ssh->getGraphicsAllocation());
if constexpr (streamStatesSupported) {
this->requiredStreamState.stateBaseAddress.setPropertiesBindingTableSurfaceState(ssh->getHeapGpuBase(), ssh->getHeapSizeInPages(),
ssh->getHeapGpuBase(), ssh->getHeapSizeInPages());
}
}
}
@@ -214,9 +216,10 @@ void CommandListCoreFamilyImmediate<gfxCoreFamily>::handleHeapsAndResidencyForIm
}
}
UNRECOVERABLE_IF(ssh == nullptr);
sshCpuBaseAddress = ssh->getCpuBase();
handleDebugSurfaceStateUpdate(ssh);
if (ssh) {
sshCpuBaseAddress = ssh->getCpuBase();
handleDebugSurfaceStateUpdate(ssh);
}
csr->setRequiredScratchSizes(this->getCommandListPerThreadScratchSize(0u), this->getCommandListPerThreadScratchSize(1u));
}

View File

@@ -220,6 +220,10 @@ void CommandListGlobalHeapsFixtureInit::setUp() {
}
void CommandListGlobalHeapsFixtureInit::setUpParams(int32_t globalHeapMode) {
if (globalHeapMode == static_cast<int32_t>(NEO::HeapAddressModel::globalStateless)) {
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(0);
}
debugManager.flags.SelectCmdListHeapAddressModel.set(globalHeapMode);
debugManager.flags.UseImmediateFlushTask.set(0);
CommandListStateBaseAddressFixture::setUp();

View File

@@ -102,8 +102,10 @@ void MultiDeviceFixture::setUp() {
debugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
debugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
auto executionEnvironment = new NEO::ExecutionEnvironment;
executionEnvironment->prepareRootDeviceEnvironments(1u);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
for (size_t i = 0; i < numRootDevices; ++i) {
executionEnvironment->rootDeviceEnvironments[i]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
}
auto devices = NEO::DeviceFactory::createDevices(*executionEnvironment);
driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
ze_result_t res = driverHandle->initialize(std::move(devices));
@@ -124,6 +126,10 @@ void MultiDeviceFixtureHierarchy::setUp() {
debugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
debugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
auto executionEnvironment = new NEO::ExecutionEnvironment;
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
for (size_t i = 0; i < numRootDevices; ++i) {
executionEnvironment->rootDeviceEnvironments[i]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
}
executionEnvironment->setExposeSubDevicesAsDevices(exposeSubDevices);
auto devices = NEO::DeviceFactory::createDevices(*executionEnvironment);
driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
@@ -141,6 +147,10 @@ void MultiDeviceFixtureCombinedHierarchy::setUp() {
debugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
debugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
auto executionEnvironment = new NEO::ExecutionEnvironment;
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
for (size_t i = 0; i < numRootDevices; ++i) {
executionEnvironment->rootDeviceEnvironments[i]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
}
executionEnvironment->setExposeSubDevicesAsDevices(exposeSubDevices);
executionEnvironment->setCombinedDeviceHierarchy(combinedHierarchy);
auto devices = NEO::DeviceFactory::createDevices(*executionEnvironment);

View File

@@ -1324,6 +1324,9 @@ HWTEST2_F(HostPointerManagerCommandListTest, givenDebugModeToRegisterAllHostPoin
HWTEST2_F(CommandListCreate, givenStateBaseAddressTrackingStateWhenCommandListCreatedThenPlatformSurfaceHeapSizeUsed, IsAtLeastSkl) {
DebugManagerStateRestore restorer;
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(0);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset();
debugManager.flags.SelectCmdListHeapAddressModel.set(0);
ze_result_t returnValue;

View File

@@ -7,6 +7,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/bindless_heaps_helper.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/preamble.h"
#include "shared/source/helpers/register_offsets.h"
@@ -830,6 +831,8 @@ HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithPrintfAndEventAppendedToI
HWTEST_F(CommandListAppendLaunchKernel, WhenAppendingMultipleTimesThenSshIsNotDepletedButReallocated) {
DebugManagerStateRestore dbgRestorer;
debugManager.flags.UseBindlessMode.set(0);
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(0);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset();
createKernel();
ze_result_t returnValue;

View File

@@ -45,6 +45,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListTests, whenCommandListIsCreatedThenPCAnd
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
auto bindlessHeapsHelper = device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getNEODevice()->getRootDeviceIndex()]->bindlessHeapsHelper.get();
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::compute, 0u, returnValue, false));
auto &commandContainer = commandList->getCmdContainer();
@@ -80,16 +82,26 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListTests, whenCommandListIsCreatedThenPCAnd
auto dsh = commandContainer.getIndirectHeap(NEO::HeapType::dynamicState);
EXPECT_TRUE(cmdSba->getDynamicStateBaseAddressModifyEnable());
EXPECT_TRUE(cmdSba->getDynamicStateBufferSizeModifyEnable());
EXPECT_EQ(dsh->getHeapGpuBase(), cmdSba->getDynamicStateBaseAddress());
EXPECT_EQ(dsh->getHeapSizeInPages(), cmdSba->getDynamicStateBufferSize());
if (bindlessHeapsHelper) {
EXPECT_EQ(bindlessHeapsHelper->getGlobalHeapsBase(), cmdSba->getDynamicStateBaseAddress());
EXPECT_EQ(MemoryConstants::sizeOf4GBinPageEntities, cmdSba->getDynamicStateBufferSize());
} else {
EXPECT_EQ(dsh->getHeapGpuBase(), cmdSba->getDynamicStateBaseAddress());
EXPECT_EQ(dsh->getHeapSizeInPages(), cmdSba->getDynamicStateBufferSize());
}
} else {
EXPECT_FALSE(cmdSba->getDynamicStateBaseAddressModifyEnable());
EXPECT_FALSE(cmdSba->getDynamicStateBufferSizeModifyEnable());
}
auto ssh = commandContainer.getIndirectHeap(NEO::HeapType::surfaceState);
EXPECT_TRUE(cmdSba->getSurfaceStateBaseAddressModifyEnable());
EXPECT_EQ(ssh->getHeapGpuBase(), cmdSba->getSurfaceStateBaseAddress());
if (bindlessHeapsHelper) {
EXPECT_TRUE(cmdSba->getBindlessSurfaceStateBaseAddressModifyEnable());
EXPECT_EQ(bindlessHeapsHelper->getGlobalHeapsBase(), cmdSba->getBindlessSurfaceStateBaseAddress());
} else {
auto ssh = commandContainer.getIndirectHeap(NEO::HeapType::surfaceState);
EXPECT_TRUE(cmdSba->getSurfaceStateBaseAddressModifyEnable());
EXPECT_EQ(ssh->getHeapGpuBase(), cmdSba->getSurfaceStateBaseAddress());
}
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST), cmdSba->getStatelessDataPortAccessMemoryObjectControlState());
@@ -107,6 +119,8 @@ HWTEST2_F(CommandListTests, whenCommandListIsCreatedAndProgramExtendedPipeContro
debugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0);
debugManager.flags.SelectCmdListHeapAddressModel.set(0);
auto bindlessHeapsHelper = device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getNEODevice()->getRootDeviceIndex()]->bindlessHeapsHelper.get();
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::compute, 0u, returnValue, false));
auto &commandContainer = commandList->getCmdContainer();
@@ -152,15 +166,26 @@ HWTEST2_F(CommandListTests, whenCommandListIsCreatedAndProgramExtendedPipeContro
auto dsh = commandContainer.getIndirectHeap(NEO::HeapType::dynamicState);
EXPECT_TRUE(cmdSba->getDynamicStateBaseAddressModifyEnable());
EXPECT_TRUE(cmdSba->getDynamicStateBufferSizeModifyEnable());
EXPECT_EQ(dsh->getHeapGpuBase(), cmdSba->getDynamicStateBaseAddress());
EXPECT_EQ(dsh->getHeapSizeInPages(), cmdSba->getDynamicStateBufferSize());
if (bindlessHeapsHelper) {
EXPECT_EQ(bindlessHeapsHelper->getGlobalHeapsBase(), cmdSba->getDynamicStateBaseAddress());
EXPECT_EQ(MemoryConstants::sizeOf4GBinPageEntities, cmdSba->getDynamicStateBufferSize());
} else {
EXPECT_EQ(dsh->getHeapGpuBase(), cmdSba->getDynamicStateBaseAddress());
EXPECT_EQ(dsh->getHeapSizeInPages(), cmdSba->getDynamicStateBufferSize());
}
} else {
EXPECT_FALSE(cmdSba->getDynamicStateBaseAddressModifyEnable());
EXPECT_FALSE(cmdSba->getDynamicStateBufferSizeModifyEnable());
}
auto ssh = commandContainer.getIndirectHeap(NEO::HeapType::surfaceState);
EXPECT_TRUE(cmdSba->getSurfaceStateBaseAddressModifyEnable());
EXPECT_EQ(ssh->getHeapGpuBase(), cmdSba->getSurfaceStateBaseAddress());
if (bindlessHeapsHelper) {
EXPECT_TRUE(cmdSba->getBindlessSurfaceStateBaseAddressModifyEnable());
EXPECT_EQ(bindlessHeapsHelper->getGlobalHeapsBase(), cmdSba->getBindlessSurfaceStateBaseAddress());
} else {
auto ssh = commandContainer.getIndirectHeap(NEO::HeapType::surfaceState);
EXPECT_TRUE(cmdSba->getSurfaceStateBaseAddressModifyEnable());
EXPECT_EQ(ssh->getHeapGpuBase(), cmdSba->getSurfaceStateBaseAddress());
}
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST), cmdSba->getStatelessDataPortAccessMemoryObjectControlState());

View File

@@ -384,6 +384,10 @@ struct ContextHostAllocTests : public ::testing::Test {
debugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
auto executionEnvironment = new NEO::ExecutionEnvironment;
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
for (size_t i = 0; i < numRootDevices; ++i) {
executionEnvironment->rootDeviceEnvironments[i]->memoryOperationsInterface = std::make_unique<MockMemoryOperations>();
}
auto devices = NEO::DeviceFactory::createDevices(*executionEnvironment);
driverHandle = std::make_unique<DriverHandleImp>();
ze_result_t res = driverHandle->initialize(std::move(devices));

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/gen_common/reg_configs_common.h"
#include "shared/source/helpers/bindless_heaps_helper.h"
#include "shared/source/helpers/register_offsets.h"
#include "shared/source/indirect_heap/indirect_heap.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
@@ -285,6 +286,8 @@ HWTEST2_F(L0DebuggerTest, givenDebuggingEnabledWhenNonCopyCommandListIsInititali
debugManager.flags.EnableStateBaseAddressTracking.set(0);
debugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0);
debugManager.flags.SelectCmdListHeapAddressModel.set(0);
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(0);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->bindlessHeapsHelper.reset();
size_t usedSpaceBefore = 0;
ze_result_t returnValue;

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/bindless_heaps_helper.h"
#include "shared/source/helpers/l3_range.h"
#include "shared/source/helpers/register_offsets.h"
#include "shared/source/helpers/state_base_address.h"
@@ -35,6 +36,9 @@ HWTEST2_F(CommandListCreate, WhenCreatingCommandListThenBindingTablePoolAllocAdd
debugManager.flags.EnableStateBaseAddressTracking.set(0);
debugManager.flags.DispatchCmdlistCmdBufferPrimary.set(0);
debugManager.flags.UseExternalAllocatorForSshAndDsh.set(0);
device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getNEODevice()->getRootDeviceIndex()]->bindlessHeapsHelper.reset();
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::compute, 0u, returnValue, false));
auto &commandContainer = commandList->getCmdContainer();