Make work partition allocation resident in LevelZero
Related-To: NEO-5546 Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
parent
b07f0e81b7
commit
8df7128901
|
@ -223,6 +223,10 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
||||||
if (globalFenceAllocation) {
|
if (globalFenceAllocation) {
|
||||||
residencyContainer.push_back(globalFenceAllocation);
|
residencyContainer.push_back(globalFenceAllocation);
|
||||||
}
|
}
|
||||||
|
const auto workPartitionAllocation = csr->getWorkPartitionAllocation();
|
||||||
|
if (workPartitionAllocation) {
|
||||||
|
residencyContainer.push_back(workPartitionAllocation);
|
||||||
|
}
|
||||||
|
|
||||||
if (NEO::DebugManager.flags.EnableSWTags.get()) {
|
if (NEO::DebugManager.flags.EnableSWTags.get()) {
|
||||||
NEO::SWTagsManager *tagsManager = neoDevice->getRootDeviceEnvironment().tagsManager.get();
|
NEO::SWTagsManager *tagsManager = neoDevice->getRootDeviceEnvironment().tagsManager.get();
|
||||||
|
|
|
@ -473,10 +473,36 @@ TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingCopyBlitCommand
|
||||||
using CommandQueueDestroySupport = IsAtLeastProduct<IGFX_SKYLAKE>;
|
using CommandQueueDestroySupport = IsAtLeastProduct<IGFX_SKYLAKE>;
|
||||||
using CommandQueueDestroy = Test<DeviceFixture>;
|
using CommandQueueDestroy = Test<DeviceFixture>;
|
||||||
|
|
||||||
using CommandQueueCommands = Test<DeviceFixture>;
|
template <bool multiTile>
|
||||||
HWTEST_F(CommandQueueCommands, givenCommandQueueWhenExecutingCommandListsThenHardwareContextIsProgrammedAndGlobalAllocationResident) {
|
struct CommandQueueCommands : DeviceFixture, ::testing::Test {
|
||||||
const ze_command_queue_desc_t desc = {};
|
void SetUp() override {
|
||||||
|
DebugManager.flags.ForcePreemptionMode.set(static_cast<int>(NEO::PreemptionMode::Disabled));
|
||||||
|
DebugManager.flags.CreateMultipleSubDevices.set(multiTile ? 2 : 1);
|
||||||
|
DeviceFixture::SetUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TearDown() override {
|
||||||
|
DeviceFixture::TearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FamilyType>
|
||||||
|
bool isAllocationInResidencyContainer(MockCsrHw2<FamilyType> &csr, NEO::GraphicsAllocation *graphicsAllocation) {
|
||||||
|
for (auto alloc : csr.copyOfAllocations) {
|
||||||
|
if (alloc == graphicsAllocation) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ze_command_queue_desc_t desc = {};
|
||||||
|
DebugManagerStateRestore restore{};
|
||||||
|
VariableBackup<bool> mockDeviceFlagBackup{&NEO::MockDevice::createSingleDevice, false};
|
||||||
|
};
|
||||||
|
using CommandQueueCommandsSingleTile = CommandQueueCommands<false>;
|
||||||
|
using CommandQueueCommandsMultiTile = CommandQueueCommands<true>;
|
||||||
|
|
||||||
|
HWTEST_F(CommandQueueCommandsSingleTile, givenCommandQueueWhenExecutingCommandListsThenHardwareContextIsProgrammedAndGlobalAllocationResident) {
|
||||||
MockCsrHw2<FamilyType> csr(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield());
|
MockCsrHw2<FamilyType> csr(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield());
|
||||||
csr.initializeTagAllocation();
|
csr.initializeTagAllocation();
|
||||||
csr.setupContext(*neoDevice->getDefaultEngine().osContext);
|
csr.setupContext(*neoDevice->getDefaultEngine().osContext);
|
||||||
|
@ -497,20 +523,41 @@ HWTEST_F(CommandQueueCommands, givenCommandQueueWhenExecutingCommandListsThenHar
|
||||||
|
|
||||||
auto globalFence = csr.getGlobalFenceAllocation();
|
auto globalFence = csr.getGlobalFenceAllocation();
|
||||||
if (globalFence) {
|
if (globalFence) {
|
||||||
bool found = false;
|
EXPECT_TRUE(isAllocationInResidencyContainer(csr, globalFence));
|
||||||
for (auto alloc : csr.copyOfAllocations) {
|
|
||||||
if (alloc == globalFence) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EXPECT_TRUE(found);
|
|
||||||
}
|
}
|
||||||
EXPECT_EQ(status, ZE_RESULT_SUCCESS);
|
EXPECT_EQ(status, ZE_RESULT_SUCCESS);
|
||||||
EXPECT_TRUE(csr.programHardwareContextCalled);
|
EXPECT_TRUE(csr.programHardwareContextCalled);
|
||||||
commandQueue->destroy();
|
commandQueue->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST_F(CommandQueueCommandsMultiTile, givenCommandQueueOnMultiTileWhenExecutingCommandListsThenWorkPartitionAllocationIsMadeResident) {
|
||||||
|
MockCsrHw2<FamilyType> csr(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield());
|
||||||
|
csr.initializeTagAllocation();
|
||||||
|
csr.createWorkPartitionAllocation(*neoDevice);
|
||||||
|
csr.setupContext(*neoDevice->getDefaultEngine().osContext);
|
||||||
|
|
||||||
|
ze_result_t returnValue;
|
||||||
|
L0::CommandQueue *commandQueue = CommandQueue::create(productFamily,
|
||||||
|
device,
|
||||||
|
&csr,
|
||||||
|
&desc,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
returnValue);
|
||||||
|
ASSERT_NE(nullptr, commandQueue);
|
||||||
|
|
||||||
|
std::unique_ptr<L0::CommandList> commandList(CommandList::create(productFamily, device, NEO::EngineGroupType::Compute, returnValue));
|
||||||
|
auto commandListHandle = commandList->toHandle();
|
||||||
|
auto status = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false);
|
||||||
|
EXPECT_EQ(status, ZE_RESULT_SUCCESS);
|
||||||
|
|
||||||
|
auto workPartitionAllocation = csr.getWorkPartitionAllocation();
|
||||||
|
ASSERT_NE(nullptr, workPartitionAllocation);
|
||||||
|
EXPECT_TRUE(isAllocationInResidencyContainer(csr, workPartitionAllocation));
|
||||||
|
|
||||||
|
commandQueue->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
using CommandQueueIndirectAllocations = Test<ModuleFixture>;
|
using CommandQueueIndirectAllocations = Test<ModuleFixture>;
|
||||||
HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandListsThenExpectedIndirectAllocationsAddedToResidencyContainer) {
|
HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandListsThenExpectedIndirectAllocationsAddedToResidencyContainer) {
|
||||||
const ze_command_queue_desc_t desc = {};
|
const ze_command_queue_desc_t desc = {};
|
||||||
|
|
Loading…
Reference in New Issue