mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 16:45:25 +08:00
Move clean leftover memory logic to separate function
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8eaa9d690e
commit
b694a639a3
@@ -157,6 +157,9 @@ struct CommandQueueHw : public CommandQueueImp {
|
||||
inline void dispatchTaskCountPostSyncRegular(bool isDispatchTaskCountPostSyncRequired, NEO::LinearStream &commandStream);
|
||||
inline void dispatchTaskCountPostSyncByMiFlushDw(bool isDispatchTaskCountPostSyncRequired, NEO::LinearStream &commandStream);
|
||||
NEO::SubmissionStatus prepareAndSubmitBatchBuffer(CommandListExecutionContext &ctx, NEO::LinearStream &innerCommandStream);
|
||||
|
||||
inline bool isCleanLeftoverMemoryRequired();
|
||||
inline void cleanLeftoverMemory(NEO::LinearStream &outerCommandStream, NEO::LinearStream &innerCommandStream);
|
||||
inline void updateTaskCountAndPostSync(bool isDispatchTaskCountPostSyncRequired);
|
||||
inline ze_result_t waitForCommandQueueCompletionAndCleanHeapContainer();
|
||||
inline ze_result_t handleSubmissionAndCompletionResults(NEO::SubmissionStatus submitRet, ze_result_t completionRet);
|
||||
|
||||
@@ -1018,14 +1018,8 @@ NEO::SubmissionStatus CommandQueueHw<gfxCoreFamily>::prepareAndSubmitBatchBuffer
|
||||
*(MI_BATCH_BUFFER_END *)buffer = GfxFamily::cmdInitBatchBufferEnd;
|
||||
}
|
||||
|
||||
if (ctx.isNEODebuggerActive(this->device) || NEO::DebugManager.flags.EnableSWTags.get()) {
|
||||
auto leftoverSpace = outerCommandStream.getUsed() - innerCommandStream.getUsed();
|
||||
leftoverSpace -= ptrDiff(innerCommandStream.getCpuBase(), outerCommandStream.getCpuBase());
|
||||
|
||||
if (leftoverSpace > 0) {
|
||||
auto memory = innerCommandStream.getSpace(leftoverSpace);
|
||||
memset(memory, 0, leftoverSpace);
|
||||
}
|
||||
if (ctx.isNEODebuggerActive(this->device) || NEO::DebugManager.flags.EnableSWTags.get() || isCleanLeftoverMemoryRequired()) {
|
||||
cleanLeftoverMemory(outerCommandStream, innerCommandStream);
|
||||
} else if (this->alignedChildStreamPadding) {
|
||||
void *paddingPtr = innerCommandStream.getSpace(this->alignedChildStreamPadding);
|
||||
memset(paddingPtr, 0, this->alignedChildStreamPadding);
|
||||
@@ -1037,6 +1031,22 @@ NEO::SubmissionStatus CommandQueueHw<gfxCoreFamily>::prepareAndSubmitBatchBuffer
|
||||
ctx.anyCommandListWithCooperativeKernels);
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
bool CommandQueueHw<gfxCoreFamily>::isCleanLeftoverMemoryRequired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
void CommandQueueHw<gfxCoreFamily>::cleanLeftoverMemory(NEO::LinearStream &outerCommandStream, NEO::LinearStream &innerCommandStream) {
|
||||
|
||||
auto leftoverSpace = outerCommandStream.getUsed() - innerCommandStream.getUsed();
|
||||
leftoverSpace -= ptrDiff(innerCommandStream.getCpuBase(), outerCommandStream.getCpuBase());
|
||||
if (leftoverSpace > 0) {
|
||||
auto memory = innerCommandStream.getSpace(leftoverSpace);
|
||||
memset(memory, 0, leftoverSpace);
|
||||
}
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
void CommandQueueHw<gfxCoreFamily>::updateTaskCountAndPostSync(bool isDispatchTaskCountPostSyncRequired) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user