Do not allocate surface if not needed.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek 2021-08-03 11:42:37 +00:00 committed by Compute-Runtime-Automation
parent b454bcbfe7
commit d3fd5077e7
2 changed files with 28 additions and 1 deletions

View File

@ -625,6 +625,9 @@ HWTEST_F(CommandQueueCommandsSingleTile, givenCommandQueueWhenExecutingCommandLi
}
HWTEST_F(CommandQueueCommandsMultiTile, givenCommandQueueOnMultiTileWhenExecutingCommandListsThenWorkPartitionAllocationIsMadeResident) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableWalkerPartition.set(1);
class MyCsrMock : public MockCsrHw2<FamilyType> {
using MockCsrHw2<FamilyType>::MockCsrHw2;
@ -665,6 +668,29 @@ HWTEST_F(CommandQueueCommandsMultiTile, givenCommandQueueOnMultiTileWhenExecutin
commandQueue->destroy();
}
HWTEST_F(CommandQueueCommandsMultiTile, givenCommandQueueOnMultiTileWhenWalkerPartitionIsDisabledThenWorkPartitionAllocationIsNotCreated) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableWalkerPartition.set(0);
class MyCsrMock : public MockCsrHw2<FamilyType> {
using MockCsrHw2<FamilyType>::MockCsrHw2;
public:
void makeResident(GraphicsAllocation &graphicsAllocation) override {
if (expectedGa == &graphicsAllocation) {
expectedGAWasMadeResident = true;
}
}
GraphicsAllocation *expectedGa = nullptr;
bool expectedGAWasMadeResident = false;
};
MyCsrMock csr(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield());
csr.initializeTagAllocation();
csr.createWorkPartitionAllocation(*neoDevice);
auto workPartitionAllocation = csr.getWorkPartitionAllocation();
EXPECT_EQ(nullptr, workPartitionAllocation);
}
using CommandQueueIndirectAllocations = Test<ModuleFixture>;
HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandListsThenExpectedIndirectAllocationsAddedToResidencyContainer) {
const ze_command_queue_desc_t desc = {};

View File

@ -8,6 +8,7 @@
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/built_ins/built_ins.h"
#include "shared/source/command_container/implicit_scaling.h"
#include "shared/source/command_stream/experimental_command_buffer.h"
#include "shared/source/command_stream/preemption.h"
#include "shared/source/command_stream/scratch_space_controller.h"
@ -51,7 +52,7 @@ CommandStreamReceiver::CommandStreamReceiver(ExecutionEnvironment &executionEnvi
}
internalAllocationStorage = std::make_unique<InternalAllocationStorage>(*this);
if (deviceBitfield.count() > 1 && DebugManager.flags.EnableStaticPartitioning.get() != 0) {
if (deviceBitfield.count() > 1 && DebugManager.flags.EnableStaticPartitioning.get() != 0 && NEO::ImplicitScalingHelper::isImplicitScalingEnabled(deviceBitfield, true)) {
this->staticWorkPartitioningEnabled = true;
}
}