Use correct heap for GSBA programming

Change-Id: I85d3b478e8c3749501ca6eb76224d95b4dbbb86c
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2020-07-02 17:23:41 +02:00 committed by sys_ocldev
parent 5734d0df70
commit d712a015b4
6 changed files with 17 additions and 11 deletions

View File

@ -35,7 +35,7 @@ struct CommandQueueHw : public CommandQueueImp {
void dispatchTaskCountWrite(NEO::LinearStream &commandStream, bool flushDataCache) override;
void programGeneralStateBaseAddress(uint64_t gsba, NEO::LinearStream &commandStream);
void programGeneralStateBaseAddress(uint64_t gsba, bool useLocalMemoryForIndirectHeap, NEO::LinearStream &commandStream);
size_t estimateStateBaseAddressCmdSize();
void programFrontEnd(uint64_t scratchAddress, NEO::LinearStream &commandStream);

View File

@ -210,7 +210,8 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
programFrontEnd(scratchSpaceController->getScratchPatchAddress(), child);
}
if (gsbaStateDirty) {
programGeneralStateBaseAddress(scratchSpaceController->calculateNewGSH(), child);
auto indirectHeap = CommandList::fromHandle(phCommandLists[0])->commandContainer.getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT);
programGeneralStateBaseAddress(scratchSpaceController->calculateNewGSH(), indirectHeap->getGraphicsAllocation()->isAllocatedInLocalMemoryPool(), child);
}
if (commandQueuePreemptionMode == NEO::PreemptionMode::Initial) {

View File

@ -29,7 +29,7 @@
namespace L0 {
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandQueueHw<gfxCoreFamily>::programGeneralStateBaseAddress(uint64_t gsba, NEO::LinearStream &commandStream) {
void CommandQueueHw<gfxCoreFamily>::programGeneralStateBaseAddress(uint64_t gsba, bool useLocalMemoryForIndirectHeap, NEO::LinearStream &commandStream) {
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
@ -53,7 +53,7 @@ void CommandQueueHw<gfxCoreFamily>::programGeneralStateBaseAddress(uint64_t gsba
gsba,
true,
(device->getMOCS(true, false) >> 1),
neoDevice->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), true),
neoDevice->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), useLocalMemoryForIndirectHeap),
true,
neoDevice->getGmmHelper(),
false);

View File

@ -172,7 +172,12 @@ HWTEST2_F(CommandQueueProgramSBATest, whenCreatingCommandQueueThenItIsInitialize
EXPECT_CALL(*memoryManager, getInternalHeapBaseAddress(rootDeviceIndex, true))
.Times(1);
commandQueue->programGeneralStateBaseAddress(0u, child);
commandQueue->programGeneralStateBaseAddress(0u, true, child);
EXPECT_CALL(*memoryManager, getInternalHeapBaseAddress(rootDeviceIndex, false))
.Times(1);
commandQueue->programGeneralStateBaseAddress(0u, false, child);
commandQueue->destroy();
}

View File

@ -82,7 +82,7 @@ bool CommandContainer::initialize(Device *device) {
indirectHeaps[i] = std::make_unique<IndirectHeap>(allocationIndirectHeaps[i], requireInternalHeap);
}
instructionHeapBaseAddress = device->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), true);
instructionHeapBaseAddress = device->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), allocationIndirectHeaps[IndirectHeap::Type::INDIRECT_OBJECT]->isAllocatedInLocalMemoryPool());
iddBlock = nullptr;
nextIddInBlock = this->getNumIddPerBlock();

View File

@ -115,7 +115,7 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenInitializeThenEverythingIs
EXPECT_EQ(indirectHeap->getGraphicsAllocation(), heapAllocation);
}
EXPECT_EQ(cmdContainer.getInstructionHeapBaseAddress(),
pDevice->getMemoryManager()->getInternalHeapBaseAddress(0, true));
pDevice->getMemoryManager()->getInternalHeapBaseAddress(0, cmdContainer.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->isAllocatedInLocalMemoryPool()));
}
TEST_F(CommandContainerTest, givenCommandContainerWhenInitializeWithoutDeviceThenReturnedFalse) {
@ -446,14 +446,14 @@ TEST_F(CommandContainerHeaps, givenCommandContainerForDifferentRootDevicesThenIn
CommandContainer cmdContainer0;
cmdContainer0.initialize(device0.get());
uint64_t baseAddressHeapDevice0 = device0.get()->getMemoryManager()->getInternalHeapBaseAddress(device0->getRootDeviceIndex(), true);
bool useLocalMemory0 = cmdContainer0.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->isAllocatedInLocalMemoryPool();
uint64_t baseAddressHeapDevice0 = device0.get()->getMemoryManager()->getInternalHeapBaseAddress(device0->getRootDeviceIndex(), useLocalMemory0);
EXPECT_EQ(cmdContainer0.getInstructionHeapBaseAddress(), baseAddressHeapDevice0);
CommandContainer cmdContainer1;
cmdContainer1.initialize(device1.get());
uint64_t baseAddressHeapDevice1 = device1.get()->getMemoryManager()->getInternalHeapBaseAddress(device1->getRootDeviceIndex(), true);
bool useLocalMemory1 = cmdContainer0.getIndirectHeap(HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->isAllocatedInLocalMemoryPool();
uint64_t baseAddressHeapDevice1 = device1.get()->getMemoryManager()->getInternalHeapBaseAddress(device1->getRootDeviceIndex(), useLocalMemory1);
EXPECT_EQ(cmdContainer1.getInstructionHeapBaseAddress(), baseAddressHeapDevice1);
}