Add multi tile support for event reset commands

Related-To: NEO-6262

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2021-12-07 12:09:38 +00:00
committed by Compute-Runtime-Automation
parent b922f7ddb1
commit 882814751f
7 changed files with 148 additions and 21 deletions

View File

@@ -244,6 +244,8 @@ struct CommandListCoreFamily : CommandListImp {
void programThreadArbitrationPolicy(Device *device);
void appendComputeBarrierCommand();
NEO::PipeControlArgs createBarrierFlags();
void appendMultiTileBarrier(NEO::Device &neoDevice);
size_t estimateBufferSizeMultiTileBarrier(const NEO::HardwareInfo &hwInfo);
uint64_t getInputBufferSize(NEO::ImageType imageType, uint64_t bytesPerPixel, const ze_image_region_t *region);
MOCKABLE_VIRTUAL AlignedAllocationData getAlignedAllocation(Device *device, const void *buffer, uint64_t bufferSize, bool hostCopyAllowed);

View File

@@ -295,8 +295,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendEventReset(ze_event_hand
auto event = Event::fromHandle(hEvent);
uint64_t baseAddr = event->getGpuAddress(this->device);
uint32_t packetsToReset = 1;
uint32_t packetsToReset = event->getPacketsInUse();
NEO::Device *neoDevice = device->getNEODevice();
uint32_t callId = 0;
@@ -312,8 +311,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendEventReset(ze_event_hand
if (event->isEventTimestampFlagSet()) {
baseAddr += event->getContextEndOffset();
packetsToReset = EventPacketsCount::eventPackets;
event->resetPackets();
}
event->resetPackets();
commandContainer.addToResidencyContainer(&event->getAllocation(this->device));
if (isCopyOnly()) {
NEO::MiFlushArgs args;
@@ -324,11 +323,15 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendEventReset(ze_event_hand
} else {
NEO::PipeControlArgs args;
if (NEO::MemorySynchronizationCommands<GfxFamily>::isDcFlushAllowed()) {
args.dcFlushEnable = (!event->signalScope) ? false : true;
args.dcFlushEnable = !!event->signalScope;
}
auto &hwInfo = device->getNEODevice()->getHardwareInfo();
increaseCommandStreamSpace(NEO::MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(hwInfo) * packetsToReset);
auto &hwInfo = neoDevice->getHardwareInfo();
size_t estimateSize = NEO::MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(hwInfo) * packetsToReset;
if (this->partitionCount > 1) {
estimateSize += estimateBufferSizeMultiTileBarrier(hwInfo);
}
increaseCommandStreamSpace(estimateSize);
for (uint32_t i = 0u; i < packetsToReset; i++) {
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncOperation(
@@ -340,6 +343,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendEventReset(ze_event_hand
args);
baseAddr += event->getSinglePacketSize();
}
if (this->partitionCount > 1) {
appendMultiTileBarrier(*neoDevice);
}
}
if (NEO::DebugManager.flags.EnableSWTags.get()) {

View File

@@ -191,9 +191,18 @@ void CommandListCoreFamily<gfxCoreFamily>::appendComputeBarrierCommand() {
}
template <GFXCORE_FAMILY gfxCoreFamily>
NEO::PipeControlArgs CommandListCoreFamily<gfxCoreFamily>::createBarrierFlags() {
inline NEO::PipeControlArgs CommandListCoreFamily<gfxCoreFamily>::createBarrierFlags() {
NEO::PipeControlArgs args;
return args;
}
template <GFXCORE_FAMILY gfxCoreFamily>
inline void CommandListCoreFamily<gfxCoreFamily>::appendMultiTileBarrier(NEO::Device &neoDevice) {
}
template <GFXCORE_FAMILY gfxCoreFamily>
inline size_t CommandListCoreFamily<gfxCoreFamily>::estimateBufferSizeMultiTileBarrier(const NEO::HardwareInfo &hwInfo) {
return 0;
}
} // namespace L0

View File

@@ -313,25 +313,14 @@ void CommandListCoreFamily<gfxCoreFamily>::appendMultiPartitionEpilogue() {
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandListCoreFamily<gfxCoreFamily>::appendComputeBarrierCommand() {
NEO::PipeControlArgs args = createBarrierFlags();
if (this->partitionCount > 1) {
auto neoDevice = device->getNEODevice();
auto &hwInfo = neoDevice->getHardwareInfo();
size_t estimatedSizeRequired = NEO::ImplicitScalingDispatch<GfxFamily>::getBarrierSize(hwInfo,
true,
false);
increaseCommandStreamSpace(estimatedSizeRequired);
NEO::ImplicitScalingDispatch<GfxFamily>::dispatchBarrierCommands(*commandContainer.getCommandStream(),
neoDevice->getDeviceBitfield(),
args,
hwInfo,
0,
0,
true,
true);
increaseCommandStreamSpace(estimateBufferSizeMultiTileBarrier(hwInfo));
appendMultiTileBarrier(*neoDevice);
} else {
NEO::PipeControlArgs args = createBarrierFlags();
size_t estimatedSizeRequired = NEO::MemorySynchronizationCommands<GfxFamily>::getSizeForSinglePipeControl();
increaseCommandStreamSpace(estimatedSizeRequired);
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControl(*commandContainer.getCommandStream(), args);
@@ -345,4 +334,25 @@ NEO::PipeControlArgs CommandListCoreFamily<gfxCoreFamily>::createBarrierFlags()
return args;
}
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandListCoreFamily<gfxCoreFamily>::appendMultiTileBarrier(NEO::Device &neoDevice) {
NEO::PipeControlArgs args = createBarrierFlags();
auto &hwInfo = neoDevice.getHardwareInfo();
NEO::ImplicitScalingDispatch<GfxFamily>::dispatchBarrierCommands(*commandContainer.getCommandStream(),
neoDevice.getDeviceBitfield(),
args,
hwInfo,
0,
0,
true,
true);
}
template <GFXCORE_FAMILY gfxCoreFamily>
inline size_t CommandListCoreFamily<gfxCoreFamily>::estimateBufferSizeMultiTileBarrier(const NEO::HardwareInfo &hwInfo) {
return NEO::ImplicitScalingDispatch<GfxFamily>::getBarrierSize(hwInfo,
true,
false);
}
} // namespace L0