mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 00:58:39 +08:00
fix: allow scratch to be optional
Related-To: NEO-14130 Signed-off-by: Naklicki, Mateusz <mateusz.naklicki@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
408556dcd8
commit
bd80531dea
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user