Add initial support for KernelArgsBuffer allocation

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2022-08-03 11:54:08 +00:00
committed by Compute-Runtime-Automation
parent d3796b2b2d
commit 98d776867f
42 changed files with 147 additions and 40 deletions

View File

@ -504,7 +504,7 @@ HWTEST_F(EnqueueKernelTest, WhenEnqueingKernelThenTaskLevelIsIncremented) {
}
HWTEST_F(EnqueueKernelTest, WhenEnqueingKernelThenCsrTaskLevelIsIncremented) {
//this test case assumes IOQ
// this test case assumes IOQ
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
csr.taskCount = pCmdQ->taskCount + 100;
csr.taskLevel = pCmdQ->taskLevel + 50;
@ -771,9 +771,10 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenEnqueueK
auto cmdBuffer = mockedSubmissionsAggregator->peekCmdBufferList().peekHead();
//Three more surfaces from preemptionAllocation, SipKernel and clearColorAllocation
// Three more surfaces from preemptionAllocation, SipKernel and clearColorAllocation
size_t csrSurfaceCount = (pDevice->getPreemptionMode() == PreemptionMode::MidThread) ? 2 : 0;
csrSurfaceCount -= pDevice->getHardwareInfo().capabilityTable.supportsImages ? 0 : 1;
csrSurfaceCount += mockCsr->getKernelArgsBufferAllocation() ? 1 : 0;
size_t timestampPacketSurfacesCount = mockCsr->peekTimestampPacketWriteEnabled() ? 1 : 0;
size_t fenceSurfaceCount = mockCsr->globalFenceAllocation ? 1 : 0;
size_t clearColorSize = mockCsr->clearColorAllocation ? 1 : 0;
@ -926,7 +927,7 @@ HWTEST_F(EnqueueKernelTest, givenCommandStreamReceiverInBatchingModeWhenKernelIs
MockKernelWithInternals mockKernel(*pClDevice, context);
size_t gws[3] = {1, 0, 0};
//make sure csr emits something
// make sure csr emits something
mockCsrmockCsr.mediaVfeStateDirty = true;
pCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
mockCsrmockCsr.mediaVfeStateDirty = true;

View File

@ -984,6 +984,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBothCsWhenFlushingTaskThenFlu
CommandStreamReceiverHwLog<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
commandStreamReceiver.setupContext(*pDevice->getDefaultEngine().osContext);
commandStreamReceiver.initializeTagAllocation();
commandStreamReceiver.createKernelArgsBufferAllocation();
commandStreamReceiver.createPreemptionAllocation();
commandStream.getSpace(sizeof(typename FamilyType::MI_NOOP));

View File

@ -1229,8 +1229,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrWhenGen
false,
MemoryCompressionState::NotApplicable,
false,
1u,
nullptr);
1u);
EXPECT_NE(generalStateBaseAddress, sbaCmd.getGeneralStateBaseAddress());
EXPECT_EQ(gmmHelper->decanonize(generalStateBaseAddress), sbaCmd.getGeneralStateBaseAddress());
@ -1256,8 +1255,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenNonZeroGeneralStateBaseAddres
false,
MemoryCompressionState::NotApplicable,
false,
1u,
nullptr);
1u);
EXPECT_EQ(0ull, sbaCmd.getGeneralStateBaseAddress());
EXPECT_EQ(0u, sbaCmd.getGeneralStateBufferSize());
@ -1285,8 +1283,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenNonZeroInternalHeapBaseAddres
false,
MemoryCompressionState::NotApplicable,
false,
1u,
nullptr);
1u);
EXPECT_FALSE(sbaCmd.getInstructionBaseAddressModifyEnable());
EXPECT_EQ(0ull, sbaCmd.getInstructionBaseAddress());
@ -1319,8 +1316,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenSbaProgram
false,
MemoryCompressionState::NotApplicable,
false,
1u,
nullptr);
1u);
EXPECT_FALSE(sbaCmd.getDynamicStateBaseAddressModifyEnable());
EXPECT_FALSE(sbaCmd.getDynamicStateBufferSizeModifyEnable());

View File

@ -74,6 +74,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenFlushTas
csrSurfaceCount -= pDevice->getHardwareInfo().capabilityTable.supportsImages ? 0 : 1;
csrSurfaceCount += mockCsr->globalFenceAllocation ? 1 : 0;
csrSurfaceCount += mockCsr->clearColorAllocation ? 1 : 0;
csrSurfaceCount += mockCsr->getKernelArgsBufferAllocation() ? 1 : 0;
//we should have 3 heaps, tag allocation and csr command stream + cq
EXPECT_EQ(5u + csrSurfaceCount, cmdBuffer->surfaces.size());
@ -809,6 +810,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTotalRes
}
mockCsr->initializeTagAllocation();
mockCsr->createKernelArgsBufferAllocation();
mockCsr->useNewResourceImplicitFlush = false;
mockCsr->useGpuIdleImplicitFlush = false;
mockCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);

View File

@ -341,8 +341,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterTests, gi
false,
MemoryCompressionState::NotApplicable,
false,
1u,
nullptr);
1u);
EXPECT_FALSE(sbaCmd.getDynamicStateBaseAddressModifyEnable());
EXPECT_FALSE(sbaCmd.getDynamicStateBufferSizeModifyEnable());
@ -810,6 +809,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterTests, gi
csrSurfaceCount -= pDevice->getHardwareInfo().capabilityTable.supportsImages ? 0 : 1;
csrSurfaceCount += mockCsr->globalFenceAllocation ? 1 : 0;
csrSurfaceCount += mockCsr->clearColorAllocation ? 1 : 0;
csrSurfaceCount += mockCsr->getKernelArgsBufferAllocation() ? 1 : 0;
EXPECT_EQ(4u + csrSurfaceCount, cmdBuffer->surfaces.size());

View File

@ -12,6 +12,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/logical_state_helper.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/libult/ult_command_stream_receiver.h"
@ -152,6 +153,16 @@ struct UltCommandStreamReceiverTest
commandStreamReceiver.lastSentUseGlobalAtomics = false;
commandStreamReceiver.streamProperties.stateComputeMode.setProperties(0, GrfConfig::DefaultGrfNumber,
hwHelper.getDefaultThreadArbitrationPolicy(), pDevice->getPreemptionMode(), *defaultHwInfo);
auto logicalStateHelper = commandStreamReceiver.getLogicalStateHelper();
if (logicalStateHelper) {
uint8_t buffer[512] = {};
LinearStream tempStream(buffer, sizeof(buffer));
EncodeKernelArgsBuffer<GfxFamily>::encodeKernelArgsBufferCmds(commandStreamReceiver.getKernelArgsBufferAllocation(), logicalStateHelper);
logicalStateHelper->writeStreamInline(tempStream, false);
}
}
template <typename GfxFamily>

View File

@ -507,6 +507,7 @@ class CommandStreamReceiverMock : public CommandStreamReceiver {
void flushTagUpdate() override{};
void updateTagFromWait() override{};
bool isUpdateTagFromWaitEnabled() override { return false; };
void createKernelArgsBufferAllocation() override {}
bool isMultiOsContextCapable() const override { return false; }

View File

@ -496,6 +496,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSe
size_t csrSurfaceCount = (device->getPreemptionMode() == PreemptionMode::MidThread) ? 2 : 0;
csrSurfaceCount += testedCsr->globalFenceAllocation ? 1 : 0;
csrSurfaceCount += testedCsr->clearColorAllocation ? 1 : 0;
csrSurfaceCount += testedCsr->getKernelArgsBufferAllocation() ? 1 : 0;
auto recordedCmdBuffer = cmdBuffers.peekHead();
EXPECT_EQ(3u + csrSurfaceCount, recordedCmdBuffer->surfaces.size());
@ -570,6 +571,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhen
size_t csrSurfaceCount = (device->getPreemptionMode() == PreemptionMode::MidThread) ? 2 : 0;
csrSurfaceCount += testedCsr->globalFenceAllocation ? 1 : 0;
csrSurfaceCount += testedCsr->clearColorAllocation ? 1 : 0;
csrSurfaceCount += testedCsr->getKernelArgsBufferAllocation() ? 1 : 0;
//validate that submited command buffer has what we want
EXPECT_EQ(3u + csrSurfaceCount, this->mock->execBuffer.getBufferCount());