fix: allow scratch to be optional

Related-To: NEO-14130

Signed-off-by: Naklicki, Mateusz <mateusz.naklicki@intel.com>
This commit is contained in:
Naklicki, Mateusz
2025-06-23 18:31:54 +00:00
committed by Compute-Runtime-Automation
parent 408556dcd8
commit bd80531dea
15 changed files with 108 additions and 58 deletions

View File

@@ -243,14 +243,6 @@ struct CommandList : _ze_command_list_handle_t {
commandListPerThreadScratchSize[slotId] = size;
}
uint64_t getCurrentScratchPatchAddress() const {
return currentScratchPatchAddress;
}
void setCurrentScratchPatchAddress(uint64_t scratchPatchAddress) {
currentScratchPatchAddress = scratchPatchAddress;
}
NEO::ScratchSpaceController *getCommandListUsedScratchController() const {
return usedScratchController;
}

View File

@@ -3667,7 +3667,9 @@ void CommandListCoreFamily<gfxCoreFamily>::appendVfeStateCmdToPatch() {
auto frontEndStateAddress = NEO::PreambleHelper<GfxFamily>::getSpaceForVfeState(commandContainer.getCommandStream(), device->getHwInfo(), engineGroupType);
auto frontEndStateCmd = new FrontEndStateCommand;
NEO::PreambleHelper<GfxFamily>::programVfeState(frontEndStateCmd, rootDeviceEnvironment, 0, 0, device->getMaxNumHwThreads(), finalStreamState);
commandsToPatch.push_back({frontEndStateAddress, frontEndStateCmd, 0, CommandToPatch::FrontEndState});
commandsToPatch.push_back({.pDestination = frontEndStateAddress,
.pCommand = frontEndStateCmd,
.type = CommandToPatch::FrontEndState});
}
}

View File

@@ -282,16 +282,16 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
}
if (NEO::PauseOnGpuProperties::pauseModeAllowed(NEO::debugManager.flags.PauseOnEnqueue.get(), neoDevice->debugExecutionCounter.load(), NEO::PauseOnGpuProperties::PauseMode::BeforeWorkload)) {
commandsToPatch.push_back({0x0, additionalCommands.front(), 0, CommandToPatch::PauseOnEnqueuePipeControlStart});
commandsToPatch.push_back({.pCommand = additionalCommands.front(), .type = CommandToPatch::PauseOnEnqueuePipeControlStart});
additionalCommands.pop_front();
commandsToPatch.push_back({0x0, additionalCommands.front(), 0, CommandToPatch::PauseOnEnqueueSemaphoreStart});
commandsToPatch.push_back({.pCommand = additionalCommands.front(), .type = CommandToPatch::PauseOnEnqueueSemaphoreStart});
additionalCommands.pop_front();
}
if (NEO::PauseOnGpuProperties::pauseModeAllowed(NEO::debugManager.flags.PauseOnEnqueue.get(), neoDevice->debugExecutionCounter.load(), NEO::PauseOnGpuProperties::PauseMode::AfterWorkload)) {
commandsToPatch.push_back({0x0, additionalCommands.front(), 0, CommandToPatch::PauseOnEnqueuePipeControlEnd});
commandsToPatch.push_back({.pCommand = additionalCommands.front(), .type = CommandToPatch::PauseOnEnqueuePipeControlEnd});
additionalCommands.pop_front();
commandsToPatch.push_back({0x0, additionalCommands.front(), 0, CommandToPatch::PauseOnEnqueueSemaphoreEnd});
commandsToPatch.push_back({.pCommand = additionalCommands.front(), .type = CommandToPatch::PauseOnEnqueueSemaphoreEnd});
additionalCommands.pop_front();
}

View File

@@ -433,21 +433,27 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
NEO::EncodeDispatchKernel<GfxFamily>::encodeCommon(commandContainer, dispatchKernelArgs);
launchParams.outWalker = dispatchKernelArgs.outWalkerPtr;
auto &scratchPointerAddress = kernelDescriptor.payloadMappings.implicitArgs.scratchPointerAddress;
if (this->heaplessModeEnabled && this->scratchAddressPatchingEnabled && kernelNeedsScratchSpace && NEO::isDefined(scratchPointerAddress.pointerSize) && NEO::isValidOffset(scratchPointerAddress.offset)) {
if (this->heaplessModeEnabled && this->scratchAddressPatchingEnabled && kernelNeedsScratchSpace) {
auto &scratchPointerAddress = kernelDescriptor.payloadMappings.implicitArgs.scratchPointerAddress;
launchParams.scratchAddressPatchIndex = commandsToPatch.size();
CommandToPatch scratchInlineData;
scratchInlineData.pDestination = dispatchKernelArgs.outWalkerPtr;
scratchInlineData.pCommand = nullptr;
scratchInlineData.scratchAddressAfterPatch = 0;
scratchInlineData.type = CommandToPatch::CommandType::ComputeWalkerInlineDataScratch;
scratchInlineData.offset = NEO::EncodeDispatchKernel<GfxFamily>::getInlineDataOffset(dispatchKernelArgs) + scratchPointerAddress.offset;
scratchInlineData.patchSize = scratchPointerAddress.pointerSize;
scratchInlineData.offset = NEO::isDefined(scratchPointerAddress.offset) ? NEO::EncodeDispatchKernel<GfxFamily>::getInlineDataOffset(dispatchKernelArgs) + scratchPointerAddress.offset : NEO::undefined<size_t>;
scratchInlineData.patchSize = NEO::isDefined(scratchPointerAddress.pointerSize) ? scratchPointerAddress.pointerSize : NEO::undefined<size_t>;
auto ssh = commandContainer.getIndirectHeap(NEO::HeapType::surfaceState);
if (ssh != nullptr) {
scratchInlineData.baseAddress = ssh->getGpuBase();
}
commandsToPatch.push_back(scratchInlineData);
addPatchScratchAddressInImplicitArgs(commandsToPatch, dispatchKernelArgs, kernelDescriptor, kernelNeedsImplicitArgs);
if (NEO::isDefined(scratchPointerAddress.pointerSize) && NEO::isValidOffset(scratchPointerAddress.offset)) {
addPatchScratchAddressInImplicitArgs(commandsToPatch, dispatchKernelArgs, kernelDescriptor, kernelNeedsImplicitArgs);
}
}
if (!isImmediateType()) {
@@ -575,16 +581,16 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
}
if (NEO::PauseOnGpuProperties::pauseModeAllowed(NEO::debugManager.flags.PauseOnEnqueue.get(), neoDevice->debugExecutionCounter.load(), NEO::PauseOnGpuProperties::PauseMode::BeforeWorkload)) {
commandsToPatch.push_back({0x0, additionalCommands.front(), 0, CommandToPatch::PauseOnEnqueuePipeControlStart});
commandsToPatch.push_back({.pCommand = additionalCommands.front(), .type = CommandToPatch::PauseOnEnqueuePipeControlStart});
additionalCommands.pop_front();
commandsToPatch.push_back({0x0, additionalCommands.front(), 0, CommandToPatch::PauseOnEnqueueSemaphoreStart});
commandsToPatch.push_back({.pCommand = additionalCommands.front(), .type = CommandToPatch::PauseOnEnqueueSemaphoreStart});
additionalCommands.pop_front();
}
if (NEO::PauseOnGpuProperties::pauseModeAllowed(NEO::debugManager.flags.PauseOnEnqueue.get(), neoDevice->debugExecutionCounter.load(), NEO::PauseOnGpuProperties::PauseMode::AfterWorkload)) {
commandsToPatch.push_back({0x0, additionalCommands.front(), 0, CommandToPatch::PauseOnEnqueuePipeControlEnd});
commandsToPatch.push_back({.pCommand = additionalCommands.front(), .type = CommandToPatch::PauseOnEnqueuePipeControlEnd});
additionalCommands.pop_front();
commandsToPatch.push_back({0x0, additionalCommands.front(), 0, CommandToPatch::PauseOnEnqueueSemaphoreEnd});
commandsToPatch.push_back({.pCommand = additionalCommands.front(), .type = CommandToPatch::PauseOnEnqueueSemaphoreEnd});
additionalCommands.pop_front();
}

View File

@@ -27,6 +27,7 @@ struct CmdListKernelLaunchParams {
CmdListKernelLaunchParamsExt launchParamsExt{};
size_t syncBufferPatchIndex = std::numeric_limits<size_t>::max();
size_t regionBarrierPatchIndex = std::numeric_limits<size_t>::max();
size_t scratchAddressPatchIndex = std::numeric_limits<size_t>::max();
uint32_t externalPerThreadScratchSize[2] = {0U, 0U};
NEO::RequiredPartitionDim requiredPartitionDim = NEO::RequiredPartitionDim::none;
NEO::RequiredDispatchWalkOrder requiredDispatchWalkOrder = NEO::RequiredDispatchWalkOrder::none;

View File

@@ -35,7 +35,10 @@ struct CommandToPatch {
Invalid
};
void *pDestination = nullptr;
void *pCommand = nullptr;
union {
void *pCommand;
mutable uint64_t scratchAddressAfterPatch;
};
size_t offset = 0;
CommandType type = Invalid;
size_t inOrderPatchListIndex = 0;

View File

@@ -54,7 +54,7 @@ struct CommandQueueHw : public CommandQueueImp {
uint32_t perThreadScratchSpaceSlot1Size);
bool getPreemptionCmdProgramming() override;
void patchCommands(CommandList &commandList, uint64_t scratchAddress, bool patchNewScratchAddress);
void patchCommands(CommandList &commandList, uint64_t scratchAddress, bool patchNewScratchController);
protected:
struct CommandListExecutionContext {

View File

@@ -1805,7 +1805,7 @@ size_t CommandQueueHw<gfxCoreFamily>::estimateStateBaseAddressDebugTracking() {
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandQueueHw<gfxCoreFamily>::patchCommands(CommandList &commandList, CommandListExecutionContext &ctx) {
bool patchNewScratchAddress = false;
bool patchNewScratchController = false;
uint64_t scratchAddress = ctx.scratchSpaceController->getScratchPatchAddress();
if (this->heaplessModeEnabled) {
@@ -1813,16 +1813,14 @@ void CommandQueueHw<gfxCoreFamily>::patchCommands(CommandList &commandList, Comm
scratchAddress += ctx.globalStatelessAllocation->getGpuAddress();
}
if (commandList.getCurrentScratchPatchAddress() != scratchAddress ||
commandList.getCommandListUsedScratchController() != ctx.scratchSpaceController) {
patchNewScratchAddress = true;
if (commandList.getCommandListUsedScratchController() != ctx.scratchSpaceController) {
patchNewScratchController = true;
}
}
patchCommands(commandList, scratchAddress, patchNewScratchAddress);
patchCommands(commandList, scratchAddress, patchNewScratchController);
if (patchNewScratchAddress) {
commandList.setCurrentScratchPatchAddress(scratchAddress);
if (patchNewScratchController) {
commandList.setCommandListUsedScratchController(ctx.scratchSpaceController);
}
}

View File

@@ -132,7 +132,7 @@ void CommandQueueHw<gfxCoreFamily>::handleScratchSpace(NEO::HeapContainer &heapC
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandQueueHw<gfxCoreFamily>::patchCommands(CommandList &commandList, uint64_t scratchAddress,
bool patchNewScratchAddress) {
bool patchNewScratchController) {
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;

View File

@@ -164,7 +164,7 @@ void CommandQueueHw<gfxCoreFamily>::handleScratchSpace(NEO::HeapContainer &sshHe
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandQueueHw<gfxCoreFamily>::patchCommands(CommandList &commandList, uint64_t scratchAddress,
bool patchNewScratchAddress) {
bool patchNewScratchController) {
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
@@ -235,21 +235,27 @@ void CommandQueueHw<gfxCoreFamily>::patchCommands(CommandList &commandList, uint
break;
}
case CommandToPatch::ComputeWalkerInlineDataScratch: {
if (!patchNewScratchAddress) {
if (NEO::isUndefined(commandToPatch.patchSize) || NEO::isUndefinedOffset(commandToPatch.offset)) {
continue;
}
if (!patchNewScratchController && commandToPatch.scratchAddressAfterPatch == scratchAddress) {
continue;
}
uint64_t fullScratchAddress = scratchAddress + commandToPatch.baseAddress;
void *scratchAddressPatch = ptrOffset(commandToPatch.pDestination, commandToPatch.offset);
std::memcpy(scratchAddressPatch, &fullScratchAddress, commandToPatch.patchSize);
commandToPatch.scratchAddressAfterPatch = scratchAddress;
break;
}
case CommandToPatch::ComputeWalkerImplicitArgsScratch: {
if (!patchNewScratchAddress) {
if (!patchNewScratchController && commandToPatch.scratchAddressAfterPatch == scratchAddress) {
continue;
}
uint64_t fullScratchAddress = scratchAddress + commandToPatch.baseAddress;
void *scratchAddressPatch = ptrOffset(commandToPatch.pDestination, commandToPatch.offset);
std::memcpy(scratchAddressPatch, &fullScratchAddress, commandToPatch.patchSize);
commandToPatch.scratchAddressAfterPatch = scratchAddress;
break;
}
case CommandToPatch::NoopSpace: {

View File

@@ -408,7 +408,7 @@ struct CommandListScratchPatchFixtureInit : public ModuleMutableCommandListFixtu
void testExternalScratchPatching();
template <typename FamilyType>
void testScratchUndefinedNoPatching();
void testScratchUndefinedPatching();
int32_t fixtureGlobalStatelessMode = 0;
uint32_t scratchInlineOffset = 8;

View File

@@ -1559,9 +1559,6 @@ void CommandListScratchPatchFixtureInit::testScratchGrowingPatching() {
auto scratchAddress = scratchController->getScratchPatchAddress();
auto fullScratchAddress = surfaceHeapGpuBase + scratchAddress;
auto expectedScratchPatchAddress = getExpectedScratchPatchAddress(scratchAddress);
EXPECT_EQ(expectedScratchPatchAddress, commandList->getCurrentScratchPatchAddress());
EXPECT_EQ(scratchController, commandList->getCommandListUsedScratchController());
uint64_t scratchInlineValue = 0;
@@ -1572,7 +1569,6 @@ void CommandListScratchPatchFixtureInit::testScratchGrowingPatching() {
commandList->reset();
EXPECT_EQ(0u, commandList->getCurrentScratchPatchAddress());
EXPECT_EQ(nullptr, commandList->getCommandListUsedScratchController());
mockKernelImmData->kernelDescriptor->kernelAttributes.perThreadScratchSize[1] = 0x40;
@@ -1601,9 +1597,6 @@ void CommandListScratchPatchFixtureInit::testScratchGrowingPatching() {
scratchAddress = scratchController->getScratchPatchAddress();
auto fullScratchSlot1Address = surfaceHeapGpuBase + scratchAddress;
expectedScratchPatchAddress = getExpectedScratchPatchAddress(scratchAddress);
EXPECT_EQ(expectedScratchPatchAddress, commandList->getCurrentScratchPatchAddress());
EXPECT_EQ(scratchController, commandList->getCommandListUsedScratchController());
scratchInlinePtr = ptrOffset(walkerPtrWithSlot1Scratch, (inlineOffset + scratchInlineOffset));
@@ -1771,9 +1764,11 @@ void CommandListScratchPatchFixtureInit::testScratchChangedControllerPatching()
auto scratchAddress = scratchControllerInitial->getScratchPatchAddress();
auto fullScratchAddress = surfaceHeapGpuBase + scratchAddress;
auto patchIndex = launchParams.scratchAddressPatchIndex;
auto currentScratchPatchAddress = commandList->commandsToPatch[patchIndex].scratchAddressAfterPatch;
auto expectedScratchPatchAddress = getExpectedScratchPatchAddress(scratchAddress);
EXPECT_EQ(expectedScratchPatchAddress, commandList->getCurrentScratchPatchAddress());
EXPECT_EQ(expectedScratchPatchAddress, currentScratchPatchAddress);
EXPECT_EQ(scratchControllerInitial, commandList->getCommandListUsedScratchController());
uint64_t scratchInlineValue = 0;
@@ -1795,8 +1790,9 @@ void CommandListScratchPatchFixtureInit::testScratchChangedControllerPatching()
fullScratchAddress = surfaceHeapGpuBase + scratchAddress;
expectedScratchPatchAddress = getExpectedScratchPatchAddress(scratchAddress);
currentScratchPatchAddress = commandList->commandsToPatch[patchIndex].scratchAddressAfterPatch;
EXPECT_EQ(expectedScratchPatchAddress, commandList->getCurrentScratchPatchAddress());
EXPECT_EQ(expectedScratchPatchAddress, currentScratchPatchAddress);
EXPECT_EQ(scratchControllerSecond, commandList->getCommandListUsedScratchController());
scratchInlinePtr = ptrOffset(walkerPtrWithScratch, (inlineOffset + scratchInlineOffset));
@@ -1896,9 +1892,6 @@ void CommandListScratchPatchFixtureInit::testExternalScratchPatching() {
auto scratchAddress = scratchController->getScratchPatchAddress();
auto fullScratchAddress = surfaceHeapGpuBase + scratchAddress;
auto expectedScratchPatchAddress = getExpectedScratchPatchAddress(scratchAddress);
EXPECT_EQ(expectedScratchPatchAddress, commandList->getCurrentScratchPatchAddress());
EXPECT_EQ(scratchController, commandList->getCommandListUsedScratchController());
uint64_t scratchInlineValue = 0;
@@ -1909,7 +1902,7 @@ void CommandListScratchPatchFixtureInit::testExternalScratchPatching() {
}
template <typename FamilyType>
void CommandListScratchPatchFixtureInit::testScratchUndefinedNoPatching() {
void CommandListScratchPatchFixtureInit::testScratchUndefinedPatching() {
const ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
auto result = ZE_RESULT_SUCCESS;
@@ -1930,16 +1923,21 @@ void CommandListScratchPatchFixtureInit::testScratchUndefinedNoPatching() {
result = commandList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
const auto &cmdsToPatch = commandList->getCommandsToPatch();
bool foundScratchPatchCmd = false;
const auto &cmdsToPatch = commandList->getCommandsToPatch();
for (const auto &cmdToPatch : cmdsToPatch) {
if (cmdToPatch.type == CommandToPatch::CommandType::ComputeWalkerInlineDataScratch) {
foundScratchPatchCmd = true;
if (isUndefined(testParam.pointerSize)) {
EXPECT_TRUE(isUndefined(cmdToPatch.patchSize));
}
if (isUndefined(testParam.offset)) {
EXPECT_TRUE(isUndefined(cmdToPatch.offset));
}
break;
}
}
EXPECT_FALSE(foundScratchPatchCmd);
EXPECT_TRUE(foundScratchPatchCmd);
result = commandList->reset();
ASSERT_EQ(ZE_RESULT_SUCCESS, result);

View File

@@ -1320,7 +1320,7 @@ HWTEST2_F(CommandListScratchPatchPrivateHeapsTest,
HWTEST2_F(CommandListScratchPatchPrivateHeapsTest,
givenHeaplessWithScratchPatchEnabledOnRegularCmdListWhenAppendingKernelWithUndefinedScratchAddressThenScratchIsNotStoredToPatch, IsHeapfulSupportedAndAtLeastXeHpcCore) {
testScratchUndefinedNoPatching<FamilyType>();
testScratchUndefinedPatching<FamilyType>();
}
HWTEST2_F(CommandListScratchPatchGlobalStatelessHeapsTest,
@@ -1350,7 +1350,7 @@ HWTEST2_F(CommandListScratchPatchGlobalStatelessHeapsTest,
HWTEST2_F(CommandListScratchPatchGlobalStatelessHeapsTest,
givenHeaplessWithScratchPatchEnabledOnRegularCmdListWhenAppendingKernelWithUndefinedScratchAddressThenScratchIsNotStoredToPatch, IsAtLeastXeHpcCore) {
testScratchUndefinedNoPatching<FamilyType>();
testScratchUndefinedPatching<FamilyType>();
}
HWTEST2_F(CommandListScratchPatchPrivateHeapsStateInitTest,
@@ -1380,7 +1380,7 @@ HWTEST2_F(CommandListScratchPatchPrivateHeapsStateInitTest,
HWTEST2_F(CommandListScratchPatchPrivateHeapsStateInitTest,
givenHeaplessWithScratchPatchEnabledOnRegularCmdListWhenAppendingKernelWithUndefinedScratchAddressThenScratchIsNotStoredToPatch, IsHeapfulSupportedAndAtLeastXeHpcCore) {
testScratchUndefinedNoPatching<FamilyType>();
testScratchUndefinedPatching<FamilyType>();
}
HWTEST2_F(CommandListScratchPatchGlobalStatelessHeapsStateInitTest,
@@ -1410,7 +1410,7 @@ HWTEST2_F(CommandListScratchPatchGlobalStatelessHeapsStateInitTest,
HWTEST2_F(CommandListScratchPatchGlobalStatelessHeapsStateInitTest,
givenHeaplessWithScratchPatchEnabledOnRegularCmdListWhenAppendingKernelWithUndefinedScratchAddressThenScratchIsNotStoredToPatch, IsAtLeastXeHpcCore) {
testScratchUndefinedNoPatching<FamilyType>();
testScratchUndefinedPatching<FamilyType>();
}
HWTEST_F(ImmediateCommandListTest, givenImmediateCmdListWhenAppendingRegularThenImmediateStreamIsSelected) {

View File

@@ -1048,6 +1048,50 @@ HWTEST2_F(CommandQueueScratchTests, givenCommandsToPatchToNotSupportedPlatformWh
commandList->commandsToPatch.clear();
}
HWTEST2_F(CommandQueueScratchTests, givenInlineDataScratchWhenPatchCommandsIsCalledThenCommandsAreCorrectlyPatched, IsAtLeastXeCore) {
ze_command_queue_desc_t desc = {};
NEO::CommandStreamReceiver *csr = nullptr;
device->getCsrForOrdinalAndIndex(&csr, 0u, 0u, ZE_COMMAND_QUEUE_PRIORITY_NORMAL, 0, false);
auto commandQueue = std::make_unique<MockCommandQueueHw<FamilyType::gfxCoreFamily>>(device, csr, &desc);
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
constexpr uint64_t dummyScratchAddress = 0xdeadu;
constexpr uint64_t baseAddress = 0x1234u;
constexpr uint64_t scratchAddress = 0x5000u;
struct TestCase {
const char *name;
bool undefinedPatchSize;
bool undefinedOffset;
bool scratchAlreadyPatched;
uint64_t expectedValue;
};
const TestCase testCases[] = {
{"Valid patchSize and offset - should patch", false, false, false, scratchAddress + baseAddress},
{"Undefined patchSize - should not patch", true, false, false, dummyScratchAddress},
{"Undefined offset - should not patch", false, true, false, dummyScratchAddress},
{"scratchAddressAfterPatch==scratchAddress - should not patch", false, false, true, dummyScratchAddress}};
for (const auto &testCase : testCases) {
uint64_t scratchBuffer = dummyScratchAddress;
commandList->commandsToPatch.clear();
CommandToPatch cmd;
cmd.type = CommandToPatch::ComputeWalkerInlineDataScratch;
cmd.pDestination = &scratchBuffer;
cmd.offset = testCase.undefinedOffset ? NEO::undefined<size_t> : 0;
cmd.patchSize = testCase.undefinedPatchSize ? NEO::undefined<size_t> : sizeof(uint64_t);
cmd.baseAddress = baseAddress;
cmd.scratchAddressAfterPatch = testCase.scratchAlreadyPatched ? scratchAddress : 0;
commandList->commandsToPatch.push_back(cmd);
commandQueue->patchCommands(*commandList, scratchAddress, false);
EXPECT_EQ(testCase.expectedValue, scratchBuffer);
}
}
using CommandQueueCreate = Test<DeviceFixture>;
HWTEST_F(CommandQueueCreate, givenCommandsToPatchWithNoopSpacePatchWhenPatchCommandsIsCalledThenSpaceIsNooped) {

View File

@@ -66,7 +66,7 @@ uint64_t ScratchSpaceControllerBase::getScratchPatchAddress() {
if (scratchSlot0Allocation) {
scratchAddress = scratchSlot0Allocation->getGpuAddressToPatch();
if (is64bit && !getMemoryManager()->peekForce32BitAllocations()) {
// this is to avoid scractch allocation offset "0"
// this is to avoid scratch allocation offset "0"
scratchAddress = ScratchSpaceConstants::scratchSpaceOffsetFor64Bit;
}
}