refactor: Improve scratch programming in heapless mode

Related-To: NEO-7621
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2024-01-30 01:00:53 +00:00
committed by Compute-Runtime-Automation
parent a104d9199d
commit 6d3a53fe7f
8 changed files with 68 additions and 54 deletions

View File

@@ -107,41 +107,12 @@ inline void HardwareInterface<GfxFamily>::programWalker(
numWorkGroups, walkerArgs.localWorkSizes, simd, dim,
localIdsGenerationByRuntime, inlineDataProgrammingRequired, requiredWalkOrder);
auto requiredScratchSlot0Size = queueCsr.getRequiredScratchSlot0Size();
auto requiredScratchSlot1Size = queueCsr.getRequiredScratchSlot1Size();
uint64_t scratchAddress = 0u;
EncodeDispatchKernel<GfxFamily>::template setScratchAddress<heaplessModeEnabled>(scratchAddress, requiredScratchSlot0Size, requiredScratchSlot1Size, &ssh, queueCsr);
auto interfaceDescriptor = &walkerCmd.getInterfaceDescriptor();
uint64_t scratchAddress = 0;
if constexpr (heaplessModeEnabled) {
auto scratchAllocation = queueCsr.getScratchAllocation();
auto scratchSpaceController = queueCsr.getScratchSpaceController();
if (scratchAllocation) {
scratchAddress = ssh.getGpuBase() + scratchSpaceController->getScratchPatchAddress();
} else {
auto requiredScratchSlot0Size = queueCsr.getRequiredScratchSlot0Size();
auto requiredScratchSlot1Size = queueCsr.getRequiredScratchSlot1Size();
bool stateBaseAddressDirty = false;
bool checkVfeStateDirty = false;
if (requiredScratchSlot0Size || requiredScratchSlot1Size) {
scratchSpaceController->setRequiredScratchSpace(ssh.getCpuBase(),
0u,
requiredScratchSlot0Size,
requiredScratchSlot1Size,
queueCsr.peekTaskCount(), queueCsr.getOsContext(),
stateBaseAddressDirty,
checkVfeStateDirty);
if (scratchSpaceController->getScratchSpaceSlot0Allocation()) {
queueCsr.makeResident(*scratchSpaceController->getScratchSpaceSlot0Allocation());
}
if (scratchSpaceController->getScratchSpaceSlot1Allocation()) {
queueCsr.makeResident(*scratchSpaceController->getScratchSpaceSlot1Allocation());
}
scratchAddress = ssh.getGpuBase() + scratchSpaceController->getScratchPatchAddress();
}
}
}
HardwareCommandsHelper<GfxFamily>::template sendIndirectState<WalkerType, InterfaceDescriptorType>(
commandStream,