Add method to increase stream size when appending new commands

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga 2021-08-03 01:31:12 +00:00 committed by Compute-Runtime-Automation
parent 1ddc83d0d5
commit 79a2607c63
3 changed files with 14 additions and 16 deletions

View File

@ -156,6 +156,7 @@ struct CommandListCoreFamily : CommandListImp {
ze_result_t reset() override;
ze_result_t executeCommandListImmediate(bool performMigration) override;
size_t getReserveSshSize();
void increaseCommandStreamSpace(size_t commandSize);
protected:
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyKernelWithGA(void *dstPtr, NEO::GraphicsAllocation *dstPtrAlloc,

View File

@ -283,13 +283,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendEventReset(ze_event_hand
}
auto &hwInfo = device->getNEODevice()->getHardwareInfo();
size_t estimatedSizeRequired =
NEO::MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(hwInfo) * packetsToReset + sizeof(MI_BATCH_BUFFER_END);
if (commandContainer.getCommandStream()->getAvailableSpace() < estimatedSizeRequired) {
auto bbEnd = commandContainer.getCommandStream()->template getSpaceForCmd<MI_BATCH_BUFFER_END>();
*bbEnd = GfxFamily::cmdInitBatchBufferEnd;
commandContainer.allocateNextCommandBuffer();
}
increaseCommandStreamSpace(NEO::MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(hwInfo) * packetsToReset);
for (uint32_t i = 0u; i < packetsToReset; i++) {
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncOperation(
@ -1973,6 +1967,17 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::reserveSpace(size_t size, void
return ZE_RESULT_SUCCESS;
}
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandListCoreFamily<gfxCoreFamily>::increaseCommandStreamSpace(size_t commandSize) {
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
size_t estimatedSizeRequired = commandSize + sizeof(MI_BATCH_BUFFER_END);
if (commandContainer.getCommandStream()->getAvailableSpace() < estimatedSizeRequired) {
auto bbEnd = commandContainer.getCommandStream()->template getSpaceForCmd<MI_BATCH_BUFFER_END>();
*bbEnd = GfxFamily::cmdInitBatchBufferEnd;
commandContainer.allocateNextCommandBuffer();
}
}
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamily<gfxCoreFamily>::prepareIndirectParams(const ze_group_count_t *pThreadGroupDimensions) {
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;

View File

@ -122,15 +122,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(z
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
if (NEO::DebugManager.flags.ForcePipeControlPriorToWalker.get()) {
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
size_t estimatedSizeRequired =
NEO::MemorySynchronizationCommands<GfxFamily>::getSizeForSinglePipeControl() + sizeof(MI_BATCH_BUFFER_END);
if (commandContainer.getCommandStream()->getAvailableSpace() < estimatedSizeRequired) {
auto bbEnd = commandContainer.getCommandStream()->template getSpaceForCmd<MI_BATCH_BUFFER_END>();
*bbEnd = GfxFamily::cmdInitBatchBufferEnd;
commandContainer.allocateNextCommandBuffer();
}
increaseCommandStreamSpace(NEO::MemorySynchronizationCommands<GfxFamily>::getSizeForSinglePipeControl());
NEO::PipeControlArgs args = {};
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControl(*commandContainer.getCommandStream(), args);