wa: add dummy blits before command MI_FLUSH_DW

to guarantee that all subblt got complete for previous copy
affect xe hpg

temporary changes under flag ForceDummyBlitWa

Related-To: NEO-7450

Signed-off-by: Cencelewska, Katarzyna <katarzyna.cencelewska@intel.com>
This commit is contained in:
Cencelewska, Katarzyna
2023-03-06 12:42:09 +00:00
committed by Compute-Runtime-Automation
parent f0c7eef667
commit c274309d7b
42 changed files with 370 additions and 323 deletions

View File

@@ -15,7 +15,7 @@
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/blit_commands_helper.h"
#include "shared/source/helpers/blit_properties.h"
#include "shared/source/helpers/definitions/mi_flush_args.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/logical_state_helper.h"
#include "shared/source/helpers/pipe_control_args.h"
@@ -1866,8 +1866,9 @@ void CommandListCoreFamily<gfxCoreFamily>::appendEventForProfilingCopyCommand(Ev
event->resetKernelCountAndPacketUsedCount();
} else {
NEO::MiFlushArgs args;
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), 0, 0, args, productHelper);
args.waArgs.isBcs = isCopyOnly();
args.waArgs.rootDeviceEnvironment = &(this->device->getNEODevice()->getRootDeviceEnvironmentRef());
NEO::EncodeMiFlushDW<GfxFamily>::programWithWa(*commandContainer.getCommandStream(), 0, 0, args);
dispatchEventPostSyncOperation(event, Event::STATE_SIGNALED, true, false, false);
}
appendWriteKernelTimestamp(event, beforeWalker, false, false);
@@ -2046,8 +2047,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnEvents(uint32_t nu
if (dcFlushRequired) {
if (isCopyOnly()) {
NEO::MiFlushArgs args;
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), 0, 0, args, productHelper);
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = &(this->device->getNEODevice()->getRootDeviceEnvironmentRef());
NEO::EncodeMiFlushDW<GfxFamily>::programWithWa(*commandContainer.getCommandStream(), 0, 0, args);
} else {
NEO::PipeControlArgs args;
args.dcFlushEnable = true;
@@ -2087,8 +2089,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnEvents(uint32_t nu
if (this->cmdListType == TYPE_IMMEDIATE && isCopyOnly() && trackDependencies) {
NEO::MiFlushArgs args;
args.commandWithPostSync = true;
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), this->csr->getBarrierCountGpuAddress(), this->csr->getNextBarrierCount() + 1, args, productHelper);
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = &(this->device->getNEODevice()->getRootDeviceEnvironmentRef());
NEO::EncodeMiFlushDW<GfxFamily>::programWithWa(*commandContainer.getCommandStream(), this->csr->getBarrierCountGpuAddress(), this->csr->getNextBarrierCount() + 1, args);
commandContainer.addToResidencyContainer(this->csr->getTagAllocation());
}
@@ -2207,12 +2210,12 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWriteGlobalTimestamp(
NEO::MiFlushArgs args;
args.timeStampOperation = true;
args.commandWithPostSync = true;
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(),
reinterpret_cast<uint64_t>(dstptr),
0,
args,
productHelper);
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = &(this->device->getNEODevice()->getRootDeviceEnvironmentRef());
NEO::EncodeMiFlushDW<GfxFamily>::programWithWa(*commandContainer.getCommandStream(),
reinterpret_cast<uint64_t>(dstptr),
0,
args);
} else {
NEO::PipeControlArgs args;
@@ -2698,6 +2701,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendBarrier(ze_event_handle_
NEO::MiFlushArgs args;
uint64_t gpuAddress = 0u;
TaskCountType value = 0u;
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = &(this->device->getNEODevice()->getRootDeviceEnvironmentRef());
if (this->cmdListType == TYPE_IMMEDIATE) {
args.commandWithPostSync = true;
@@ -2706,8 +2711,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendBarrier(ze_event_handle_
commandContainer.addToResidencyContainer(this->csr->getTagAllocation());
}
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), gpuAddress, value, args, productHelper);
NEO::EncodeMiFlushDW<GfxFamily>::programWithWa(*commandContainer.getCommandStream(), gpuAddress, value, args);
} else {
appendComputeBarrierCommand();
}
@@ -2870,9 +2874,10 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWriteToMemory(void *desc
if (isCopyOnly()) {
NEO::MiFlushArgs args;
args.commandWithPostSync = true;
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), gpuAddress,
data, args, productHelper);
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = &(this->device->getNEODevice()->getRootDeviceEnvironmentRef());
NEO::EncodeMiFlushDW<GfxFamily>::programWithWa(*commandContainer.getCommandStream(), gpuAddress,
data, args);
} else {
NEO::PipeControlArgs args;
args.dcFlushEnable = getDcFlushRequired(!!descriptor->writeScope);
@@ -2918,13 +2923,13 @@ void CommandListCoreFamily<gfxCoreFamily>::dispatchPostSyncCopy(uint64_t gpuAddr
NEO::MiFlushArgs miFlushArgs;
miFlushArgs.commandWithPostSync = true;
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(
miFlushArgs.waArgs.isBcs = isCopyOnly();
miFlushArgs.waArgs.rootDeviceEnvironment = &(this->device->getNEODevice()->getRootDeviceEnvironmentRef());
NEO::EncodeMiFlushDW<GfxFamily>::programWithWa(
*commandContainer.getCommandStream(),
gpuAddress,
value,
miFlushArgs,
productHelper);
miFlushArgs);
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@@ -18,7 +18,7 @@
#include "shared/source/debugger/debugger_l0.h"
#include "shared/source/device/device.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/definitions/mi_flush_args.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/heap_base_address_model.h"
#include "shared/source/helpers/logical_state_helper.h"
@@ -220,8 +220,9 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandListsCopyOnly(
size_t linearStreamSizeEstimate = this->estimateLinearStreamSizeInitial(ctx, phCommandLists, numCommandLists);
this->csr->getResidencyAllocations().reserve(ctx.spaceForResidency);
linearStreamSizeEstimate += NEO::EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite();
auto isBcs = NEO::EngineHelpers::isBcs(this->csr->getOsContext().getEngineType());
NEO::EncodeDummyBlitWaArgs waArgs{isBcs, &(this->device->getNEODevice()->getRootDeviceEnvironmentRef())};
linearStreamSizeEstimate += NEO::EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs);
NEO::LinearStream child(nullptr);
if (const auto ret = this->makeAlignedChildStreamAndSetGpuBase(child, linearStreamSizeEstimate); ret != ZE_RESULT_SUCCESS) {
@@ -992,8 +993,9 @@ void CommandQueueHw<gfxCoreFamily>::dispatchTaskCountPostSyncByMiFlushDw(
NEO::MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = this->csr->isUsedNotifyEnableForPostSync();
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(cmdStream, postSyncAddress, postSyncData, args, productHelper);
args.waArgs.isBcs = NEO::EngineHelpers::isBcs(this->csr->getOsContext().getEngineType());
args.waArgs.rootDeviceEnvironment = &(this->device->getNEODevice()->getRootDeviceEnvironmentRef());
NEO::EncodeMiFlushDW<GfxFamily>::programWithWa(cmdStream, postSyncAddress, postSyncData, args);
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@@ -6,11 +6,12 @@
*/
#include "shared/source/built_ins/sip.h"
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_container/encode_surface_state.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/mocks/mock_command_encoder.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "level_zero/core/source/event/event.h"
@@ -723,7 +724,8 @@ HWTEST2_F(CommandListCreate, givenImmediateCopyOnlyCmdListWhenAppendBarrierThenI
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed()));
auto itor = find<MI_FLUSH_DW *>(cmdList.begin(), cmdList.end());
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize()) {
NEO::EncodeDummyBlitWaArgs waArgs{true, &(device->getNEODevice()->getRootDeviceEnvironmentRef())};
if (MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs)) {
itor++;
}
EXPECT_NE(cmdList.end(), itor);
@@ -764,7 +766,8 @@ HWTEST2_F(CommandListCreate, givenImmediateCopyOnlyCmdListWhenAppendWaitOnEvents
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed()));
auto itor = find<MI_FLUSH_DW *>(cmdList.begin(), cmdList.end());
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize()) {
NEO::EncodeDummyBlitWaArgs waArgs{true, &(device->getNEODevice()->getRootDeviceEnvironmentRef())};
if (MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs)) {
itor++;
}
EXPECT_NE(cmdList.end(), itor);

View File

@@ -5,10 +5,11 @@
*
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/mocks/mock_command_encoder.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "level_zero/core/source/cmdlist/cmdlist_hw_immediate.h"
@@ -462,7 +463,8 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent,
EXPECT_EQ(2u, event->getPacketsInUse());
size_t usedAfterSize = cmdStream->getUsed();
size_t expectedSize = NEO::EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() * packets;
NEO::EncodeDummyBlitWaArgs waArgs{false, const_cast<RootDeviceEnvironment *>(&device->getNEODevice()->getRootDeviceEnvironment())};
size_t expectedSize = NEO::EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) * packets;
EXPECT_EQ(expectedSize, (usedAfterSize - usedBeforeSize));
auto gpuAddress = event->getGpuAddress(device) + event->getContextEndOffset();
@@ -474,7 +476,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent,
expectedSize));
uint32_t miFlushCountFactor = 1;
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize() > 0) {
if (MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs) > 0) {
miFlushCountFactor = 2;
}
auto expectedMiFlushCount = packets * miFlushCountFactor;

View File

@@ -5,10 +5,11 @@
*
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/mocks/mock_command_encoder.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "level_zero/core/source/cmdlist/cmdlist_hw_immediate.h"
@@ -447,7 +448,8 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent,
usedAfterSize));
uint32_t expectedMiFlushCount = 1;
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize() > 0) {
NEO::EncodeDummyBlitWaArgs waArgs{true, &(device->getNEODevice()->getRootDeviceEnvironmentRef())};
if (MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs) > 0) {
expectedMiFlushCount = 2;
}
@@ -488,7 +490,8 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent,
usedAfterSize));
uint32_t expectedMiFlushCount = 1;
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize() > 0) {
NEO::EncodeDummyBlitWaArgs waArgs{true, &(device->getNEODevice()->getRootDeviceEnvironmentRef())};
if (MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs) > 0) {
expectedMiFlushCount = 2;
}
@@ -531,7 +534,8 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent,
usedAfterSize));
uint32_t expectedMiFlushCount = 1;
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize() > 0) {
NEO::EncodeDummyBlitWaArgs waArgs{true, &(device->getNEODevice()->getRootDeviceEnvironmentRef())};
if (MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs) > 0) {
expectedMiFlushCount = 2;
}

View File

@@ -8,11 +8,13 @@
#include "shared/source/command_container/implicit_scaling.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/preamble.h"
#include "shared/source/indirect_heap/indirect_heap.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/mocks/mock_command_encoder.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "level_zero/core/source/cmdlist/cmdlist_hw.h"
@@ -706,7 +708,8 @@ struct CommandListSignalAllEventPacketFixture : public ModuleFixture {
if constexpr (copyOnly == 1) {
uint32_t flushCmdWaFactor = 1;
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize() > 0) {
NEO::EncodeDummyBlitWaArgs waArgs{true, &(device->getNEODevice()->getRootDeviceEnvironmentRef())};
if (MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs) > 0) {
flushCmdWaFactor++;
}
@@ -926,7 +929,8 @@ struct CommandListSignalAllEventPacketFixture : public ModuleFixture {
auto itorFlushDw = findAll<MI_FLUSH_DW *>(cmdList.begin(), cmdList.end());
uint32_t flushCmdWaFactor = 1;
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize() > 0) {
NEO::EncodeDummyBlitWaArgs waArgs{true, &(device->getNEODevice()->getRootDeviceEnvironmentRef())};
if (MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs) > 0) {
flushCmdWaFactor++;
}
@@ -1134,7 +1138,8 @@ struct CommandListSignalAllEventPacketFixture : public ModuleFixture {
if constexpr (copyOnly == 1) {
uint32_t flushCmdWaFactor = 1;
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize() > 0) {
NEO::EncodeDummyBlitWaArgs waArgs{true, &(device->getNEODevice()->getRootDeviceEnvironmentRef())};
if (MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs) > 0) {
flushCmdWaFactor++;
}

View File

@@ -5,17 +5,18 @@
*
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_stream/scratch_space_controller.h"
#include "shared/source/command_stream/scratch_space_controller_base.h"
#include "shared/source/command_stream/wait_status.h"
#include "shared/source/helpers/blit_commands_helper.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/logical_state_helper.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/mocks/mock_command_encoder.h"
#include "shared/test/common/mocks/mock_command_stream_receiver.h"
#include "shared/test/common/mocks/mock_csr.h"
#include "shared/test/common/mocks/mock_device.h"
@@ -716,8 +717,10 @@ HWTEST_F(BcsTests, WhenGetNumberOfBlitsForCopyPerRowIsCalledThenCorrectValuesAre
}
HWTEST_F(BcsTests, whenAskingForCmdSizeForMiFlushDwWithMemoryWriteThenReturnCorrectValue) {
size_t waSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize();
size_t totalSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
DebugManager.flags.ForceDummyBlitWa.set(0);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t waSize = MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs);
size_t totalSize = EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
constexpr size_t miFlushDwSize = sizeof(typename FamilyType::MI_FLUSH_DW);
size_t additionalSize = UnitTestHelper<FamilyType>::additionalMiFlushDwRequired ? miFlushDwSize : 0;
@@ -732,18 +735,19 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenEstimatingCommandsSizeThenCal
const size_t bltSize = (3 * max2DBlitSize);
const uint32_t numberOfBlitOperations = 4;
auto baseSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() + sizeof(typename FamilyType::MI_BATCH_BUFFER_END);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
auto baseSize = EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) + sizeof(typename FamilyType::MI_BATCH_BUFFER_END);
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto expectedBlitInstructionsSize = cmdsSizePerBlit * numberOfBlts;
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedBlitInstructionsSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedBlitInstructionsSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto expectedAlignedSize = baseSize + (2 * MemorySynchronizationCommands<FamilyType>::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment()));
@@ -773,18 +777,18 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenDirectsubmissionEnabledEstima
const size_t bltSize = (3 * max2DBlitSize);
const uint32_t numberOfBlitOperations = 4;
auto baseSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() + sizeof(typename FamilyType::MI_BATCH_BUFFER_START);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
auto baseSize = EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) + sizeof(typename FamilyType::MI_BATCH_BUFFER_START);
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto expectedBlitInstructionsSize = cmdsSizePerBlit * numberOfBlts;
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedBlitInstructionsSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedBlitInstructionsSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto expectedAlignedSize = baseSize + (2 * MemorySynchronizationCommands<FamilyType>::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment()));
@@ -817,14 +821,14 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenEstimatingCommandsSizeForWrit
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto baseSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() + sizeof(typename FamilyType::MI_BATCH_BUFFER_END);
auto baseSize = EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) + sizeof(typename FamilyType::MI_BATCH_BUFFER_END);
auto expectedBlitInstructionsSize = cmdsSizePerBlit * numberOfBlts;
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedBlitInstructionsSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedBlitInstructionsSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto expectedAlignedSize = baseSize + (2 * MemorySynchronizationCommands<FamilyType>::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment()));
@@ -857,14 +861,14 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenDirectSubmissionEnabledEstima
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto baseSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() + sizeof(typename FamilyType::MI_BATCH_BUFFER_START);
auto baseSize = EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) + sizeof(typename FamilyType::MI_BATCH_BUFFER_START);
auto expectedBlitInstructionsSize = cmdsSizePerBlit * numberOfBlts;
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedBlitInstructionsSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedBlitInstructionsSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto expectedAlignedSize = baseSize + (2 * MemorySynchronizationCommands<FamilyType>::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment()));
@@ -893,13 +897,13 @@ HWTEST_F(BcsTests, givenTimestampPacketWriteRequestWhenEstimatingSizeForCommands
size_t expectedBaseSize = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto expectedSizeWithTimestampPacketWrite = expectedBaseSize + EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
auto expectedSizeWithTimestampPacketWrite = expectedBaseSize + EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
auto expectedSizeWithoutTimestampPacketWrite = expectedBaseSize;
auto estimatedSizeWithTimestampPacketWrite = BlitCommandsHelper<FamilyType>::estimateBlitCommandSize(
@@ -914,14 +918,14 @@ HWTEST_F(BcsTests, givenTimestampPacketWriteRequestWhenEstimatingSizeForCommands
HWTEST_F(BcsTests, givenTimestampPacketWriteRequestWhenEstimatingSizeForCommandsWithProfilingThenAddMiFlushDw) {
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t expectedBaseSize = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs) +
EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto expectedSizeWithTimestampPacketWriteAndProfiling = expectedBaseSize + BlitCommandsHelper<FamilyType>::getProfilingMmioCmdsSize();
@@ -949,14 +953,14 @@ HWTEST_F(BcsTests, givenBltSizeAndCsrDependenciesWhenEstimatingCommandSizeThenAd
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
size_t expectedSize = (cmdsSizePerBlit * numberOfBlts) +
TimestampPacketHelper::getRequiredCmdStreamSize<FamilyType>(csrDependencies);
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto estimatedSize = BlitCommandsHelper<FamilyType>::estimateBlitCommandSize(
@@ -973,10 +977,10 @@ HWTEST_F(BcsTests, givenImageAndBufferWhenEstimateBlitCommandSizeThenReturnCorre
expectedSize += isImage ? sizeof(typename FamilyType::XY_BLOCK_COPY_BLT) : sizeof(typename FamilyType::XY_COPY_BLT);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
expectedSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto estimatedSize = BlitCommandsHelper<FamilyType>::estimateBlitCommandSize(
@@ -1000,7 +1004,24 @@ HWTEST_F(BcsTests, givenImageAndBufferBlitDirectionsWhenIsImageOperationIsCalled
EXPECT_EQ(isImageDirection, blitProperties.isImageOperation());
}
}
template <typename FamilyType>
void verifyDummyBlitWa(const RootDeviceEnvironment *rootDeviceEnvironment, GenCmdList::iterator &cmdIterator) {
const auto &productHelper = rootDeviceEnvironment->getProductHelper();
if (productHelper.isDummyBlitWaRequired()) {
auto dummyBltCmd = genCmdCast<typename FamilyType::XY_COLOR_BLT *>(*(cmdIterator++));
EXPECT_NE(nullptr, dummyBltCmd);
auto expectedX2 = 1u;
auto expectedY2 = 4u;
uint32_t expectedPitch = 4096u;
auto expectedDestinationBaseAddress = rootDeviceEnvironment->getDummyAllocation()->getGpuAddress();
EXPECT_EQ(expectedDestinationBaseAddress, dummyBltCmd->getDestinationBaseAddress());
EXPECT_EQ(expectedX2, dummyBltCmd->getDestinationX2CoordinateRight());
EXPECT_EQ(expectedY2, dummyBltCmd->getDestinationY2CoordinateBottom());
EXPECT_EQ(expectedPitch, dummyBltCmd->getDestinationPitch());
}
}
HWTEST_F(BcsTests, givenBltSizeWithLeftoverWhenDispatchedThenProgramAllRequiredCommands) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
@@ -1065,28 +1086,17 @@ HWTEST_F(BcsTests, givenBltSizeWithLeftoverWhenDispatchedThenProgramAllRequiredC
EXPECT_EQ(expectedWidth, bltCmd->getSourcePitch());
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
verifyDummyBlitWa<FamilyType>(&(pDevice->getRootDeviceEnvironmentRef()), cmdIterator);
auto miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() == 2 * sizeof(typename FamilyType::MI_FLUSH_DW)) {
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
if (EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) - BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgs) == 2 * sizeof(typename FamilyType::MI_FLUSH_DW)) {
miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
}
}
const auto &productHelper = pDevice->getProductHelper();
if (productHelper.isDummyBlitWaRequired()) {
auto dummyBltCmd = genCmdCast<typename FamilyType::XY_COLOR_BLT *>(*(cmdIterator++));
EXPECT_NE(nullptr, dummyBltCmd);
auto expectedX2 = 1u;
auto expectedY2 = 4u;
uint32_t expectedPitch = 4096u;
auto expectedDestinationBaseAddress = pDevice->getRootDeviceEnvironment().getDummyAllocation()->getGpuAddress();
EXPECT_EQ(expectedDestinationBaseAddress, dummyBltCmd->getDestinationBaseAddress());
EXPECT_EQ(expectedX2, dummyBltCmd->getDestinationX2CoordinateRight());
EXPECT_EQ(expectedY2, dummyBltCmd->getDestinationY2CoordinateBottom());
EXPECT_EQ(expectedPitch, dummyBltCmd->getDestinationPitch());
}
verifyDummyBlitWa<FamilyType>(&(pDevice->getRootDeviceEnvironmentRef()), cmdIterator);
auto miArbCheckCmd = genCmdCast<typename FamilyType::MI_ARB_CHECK *>(*(cmdIterator++));
EXPECT_NE(nullptr, miArbCheckCmd);
EXPECT_TRUE(memcmp(&FamilyType::cmdInitArbCheck, miArbCheckCmd, sizeof(typename FamilyType::MI_ARB_CHECK)) == 0);
@@ -1101,7 +1111,7 @@ HWTEST_F(BcsTests, givenBltSizeWithLeftoverWhenDispatchedThenProgramAllRequiredC
cmdIterator++;
}
}
verifyDummyBlitWa<FamilyType>(&(pDevice->getRootDeviceEnvironmentRef()), cmdIterator);
auto miFlushCmd = genCmdCast<MI_FLUSH_DW *>(*(cmdIterator++));
if (UnitTestHelper<FamilyType>::additionalMiFlushDwRequired) {
@@ -1311,28 +1321,17 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP
offset += (expectedWidth * expectedHeight);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
verifyDummyBlitWa<FamilyType>(&(pDevice->getRootDeviceEnvironmentRef()), cmdIterator);
auto miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() == 2 * sizeof(typename FamilyType::MI_FLUSH_DW)) {
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
if (EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) - BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgs) == 2 * sizeof(typename FamilyType::MI_FLUSH_DW)) {
miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
}
}
const auto &productHelper = pDevice->getProductHelper();
if (productHelper.isDummyBlitWaRequired()) {
auto dummyBltCmd = genCmdCast<typename FamilyType::XY_COLOR_BLT *>(*(cmdIterator++));
EXPECT_NE(nullptr, dummyBltCmd);
auto expectedX2 = 1u;
auto expectedY2 = 4u;
uint32_t expectedPitch = 4096u;
auto expectedDestinationBaseAddress = pDevice->getRootDeviceEnvironment().getDummyAllocation()->getGpuAddress();
EXPECT_EQ(expectedDestinationBaseAddress, dummyBltCmd->getDestinationBaseAddress());
EXPECT_EQ(expectedX2, dummyBltCmd->getDestinationX2CoordinateRight());
EXPECT_EQ(expectedY2, dummyBltCmd->getDestinationY2CoordinateBottom());
EXPECT_EQ(expectedPitch, dummyBltCmd->getDestinationPitch());
}
verifyDummyBlitWa<FamilyType>(&(pDevice->getRootDeviceEnvironmentRef()), cmdIterator);
auto miArbCheckCmd = genCmdCast<typename FamilyType::MI_ARB_CHECK *>(*(cmdIterator++));
EXPECT_NE(nullptr, miArbCheckCmd);
EXPECT_TRUE(memcmp(&FamilyType::cmdInitArbCheck, miArbCheckCmd, sizeof(typename FamilyType::MI_ARB_CHECK)) == 0);
@@ -1424,19 +1423,17 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP
offset += (expectedWidth * expectedHeight);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
verifyDummyBlitWa<FamilyType>(&(pDevice->getRootDeviceEnvironmentRef()), cmdIterator);
auto miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() == 2 * sizeof(typename FamilyType::MI_FLUSH_DW)) {
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
if (EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) - BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgs) == 2 * sizeof(typename FamilyType::MI_FLUSH_DW)) {
miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
}
}
const auto &productHelper = pDevice->getProductHelper();
if (productHelper.isDummyBlitWaRequired()) {
auto dummyBltCmd = genCmdCast<typename FamilyType::XY_COLOR_BLT *>(*(cmdIterator++));
EXPECT_NE(nullptr, dummyBltCmd);
}
verifyDummyBlitWa<FamilyType>(&(pDevice->getRootDeviceEnvironmentRef()), cmdIterator);
auto miArbCheckCmd = genCmdCast<typename FamilyType::MI_ARB_CHECK *>(*(cmdIterator++));
EXPECT_NE(nullptr, miArbCheckCmd);
EXPECT_TRUE(memcmp(&FamilyType::cmdInitArbCheck, miArbCheckCmd, sizeof(typename FamilyType::MI_ARB_CHECK)) == 0);
@@ -1520,28 +1517,17 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP
offset += (expectedWidth * expectedHeight);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
verifyDummyBlitWa<FamilyType>(&(pDevice->getRootDeviceEnvironmentRef()), cmdIterator);
auto miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() == 2 * sizeof(typename FamilyType::MI_FLUSH_DW)) {
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
if (EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) - BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgs) == 2 * sizeof(typename FamilyType::MI_FLUSH_DW)) {
miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
}
}
const auto &productHelper = pDevice->getProductHelper();
if (productHelper.isDummyBlitWaRequired()) {
auto dummyBltCmd = genCmdCast<typename FamilyType::XY_COLOR_BLT *>(*(cmdIterator++));
EXPECT_NE(nullptr, dummyBltCmd);
auto expectedX2 = 1u;
auto expectedY2 = 4u;
uint32_t expectedPitch = 4096u;
auto expectedDestinationBaseAddress = pDevice->getRootDeviceEnvironment().getDummyAllocation()->getGpuAddress();
EXPECT_EQ(expectedDestinationBaseAddress, dummyBltCmd->getDestinationBaseAddress());
EXPECT_EQ(expectedX2, dummyBltCmd->getDestinationX2CoordinateRight());
EXPECT_EQ(expectedY2, dummyBltCmd->getDestinationY2CoordinateBottom());
EXPECT_EQ(expectedPitch, dummyBltCmd->getDestinationPitch());
}
verifyDummyBlitWa<FamilyType>(&(pDevice->getRootDeviceEnvironmentRef()), cmdIterator);
auto miArbCheckCmd = genCmdCast<typename FamilyType::MI_ARB_CHECK *>(*(cmdIterator++));
EXPECT_NE(nullptr, miArbCheckCmd);
EXPECT_TRUE(memcmp(&FamilyType::cmdInitArbCheck, miArbCheckCmd, sizeof(typename FamilyType::MI_ARB_CHECK)) == 0);

View File

@@ -9,6 +9,7 @@
#include "shared/source/command_stream/wait_status.h"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.h"
#include "shared/source/helpers/blit_commands_helper.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/flush_stamp.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
@@ -41,7 +42,7 @@ HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeThenAddAllRequiredComman
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
size_t notAlignedBltSize = (3 * max2DBlitSize) + 1;
@@ -53,8 +54,8 @@ HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeThenAddAllRequiredComman
auto expectedNotAlignedSize = cmdsSizePerBlit * notAlignedNumberOfBlts;
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedAlignedSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedNotAlignedSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedAlignedSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
expectedNotAlignedSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto alignedCopySize = Vec3<size_t>{alignedBltSize, 1, 1};
@@ -77,16 +78,16 @@ HWTEST_F(BcsTests, givenDebugCapabilityWhenEstimatingCommandSizeThenAddAllRequir
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
const size_t debugCommandsSize = (EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() + EncodeSempahore<FamilyType>::getSizeMiSemaphoreWait()) * 2;
const size_t debugCommandsSize = (EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) + EncodeSempahore<FamilyType>::getSizeMiSemaphoreWait()) * 2;
constexpr uint32_t numberOfBlts = 3;
constexpr size_t bltSize = (numberOfBlts * max2DBlitSize);
auto expectedSize = (cmdsSizePerBlit * numberOfBlts) + debugCommandsSize + (2 * MemorySynchronizationCommands<FamilyType>::getSizeForAdditonalSynchronization(pDevice->getRootDeviceEnvironment())) +
EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() + sizeof(typename FamilyType::MI_BATCH_BUFFER_END);
EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) + sizeof(typename FamilyType::MI_BATCH_BUFFER_END);
expectedSize = alignUp(expectedSize, MemoryConstants::cacheLineSize);
BlitProperties blitProperties{};
@@ -107,7 +108,7 @@ HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeForReadBufferRectThenAdd
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
Vec3<size_t> notAlignedBltSize = {(3 * max2DBlitSize) + 1, 4, 2};
@@ -119,8 +120,8 @@ HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeForReadBufferRectThenAdd
auto expectedNotAlignedSize = cmdsSizePerBlit * notAlignedNumberOfBlts;
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedAlignedSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedNotAlignedSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedAlignedSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
expectedNotAlignedSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto alignedEstimatedSize = BlitCommandsHelper<FamilyType>::estimateBlitCommandSize(
@@ -143,7 +144,7 @@ HWTEST_F(BcsTests, givenBltWithBigCopySizeWhenEstimatingCommandSizeForReadBuffer
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
Vec3<size_t> alignedBltSize = {(3 * maxWidthToCopy), (4 * maxHeightToCopy), 2};
@@ -158,8 +159,8 @@ HWTEST_F(BcsTests, givenBltWithBigCopySizeWhenEstimatingCommandSizeForReadBuffer
auto expectedNotAlignedSize = cmdsSizePerBlit * notAlignedNumberOfBlts;
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
expectedAlignedSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedNotAlignedSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedAlignedSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
expectedNotAlignedSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto alignedEstimatedSize = BlitCommandsHelper<FamilyType>::estimateBlitCommandSize(

View File

@@ -780,7 +780,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBufferOperationWithoutKernelWhenEstimati
EXPECT_EQ(expectedSize, copyBufferCmdsSize);
}
HWTEST_TEMPLATED_F(BcsBufferTests, givenOutputTimestampPacketWhenBlitCalledThenProgramMiFlushDwWithDataWrite) {
HWTEST_TEMPLATED_F(BcsBufferTests, givenOutputTimestampPacketWhenBlitCalledThenprogramWithWaWithDataWrite) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(this->bcsCsr);

View File

@@ -35,6 +35,7 @@ struct HardwareInfo;
struct KernelDescriptor;
struct KernelInfo;
struct MiFlushArgs;
struct EncodeDummyBlitWaArgs;
struct PipeControlArgs;
struct PipelineSelectArgs;
struct RootDeviceEnvironment;
@@ -463,12 +464,15 @@ struct EncodeBatchBufferStartOrEnd {
template <typename GfxFamily>
struct EncodeMiFlushDW {
using MI_FLUSH_DW = typename GfxFamily::MI_FLUSH_DW;
static void programMiFlushDw(LinearStream &commandStream, uint64_t immediateDataGpuAddress, uint64_t immediateData,
MiFlushArgs &args, const ProductHelper &productHelper);
static void programMiFlushDwWA(LinearStream &commandStream);
static void appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper);
static size_t getMiFlushDwCmdSizeForDataWrite();
static size_t getMiFlushDwWaSize();
static void programWithWa(LinearStream &commandStream, uint64_t immediateDataGpuAddress, uint64_t immediateData,
MiFlushArgs &args);
static size_t getCommandSizeWithWa(const EncodeDummyBlitWaArgs &waArgs);
protected:
static size_t getWaSize(const EncodeDummyBlitWaArgs &waArgs);
static void appendWa(LinearStream &commandStream, MiFlushArgs &args);
static void adjust(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper);
};
template <typename GfxFamily>
@@ -477,11 +481,6 @@ struct EncodeMemoryPrefetch {
static size_t getSizeForMemoryPrefetch(size_t size, const RootDeviceEnvironment &rootDeviceEnvironment);
};
struct EncodeDummyBlitWaArgs {
bool isBcs = false;
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
};
template <typename GfxFamily>
struct EncodeMiArbCheck {
using MI_ARB_CHECK = typename GfxFamily::MI_ARB_CHECK;

View File

@@ -16,7 +16,7 @@
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/bindless_heaps_helper.h"
#include "shared/source/helpers/blit_commands_helper.h"
#include "shared/source/helpers/definitions/mi_flush_args.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/local_id_gen.h"
#include "shared/source/helpers/preamble.h"
@@ -954,10 +954,15 @@ void EncodeBatchBufferStartOrEnd<Family>::programBatchBufferEnd(CommandContainer
programBatchBufferEnd(*container.getCommandStream());
}
template <typename GfxFamily>
void EncodeMiFlushDW<GfxFamily>::appendWa(LinearStream &commandStream, MiFlushArgs &args) {
BlitCommandsHelper<GfxFamily>::dispatchDummyBlit(commandStream, args.waArgs);
}
template <typename Family>
void EncodeMiFlushDW<Family>::programMiFlushDw(LinearStream &commandStream, uint64_t immediateDataGpuAddress, uint64_t immediateData,
MiFlushArgs &args, const ProductHelper &productHelper) {
programMiFlushDwWA(commandStream);
void EncodeMiFlushDW<Family>::programWithWa(LinearStream &commandStream, uint64_t immediateDataGpuAddress, uint64_t immediateData,
MiFlushArgs &args) {
appendWa(commandStream, args);
auto miFlushDwCmd = commandStream.getSpaceForCmd<MI_FLUSH_DW>();
MI_FLUSH_DW miFlush = Family::cmdInitMiFlushDw;
@@ -969,13 +974,18 @@ void EncodeMiFlushDW<Family>::programMiFlushDw(LinearStream &commandStream, uint
}
miFlush.setNotifyEnable(args.notifyEnable);
miFlush.setTlbInvalidate(args.tlbFlush);
appendMiFlushDw(&miFlush, productHelper);
adjust(&miFlush, args.waArgs.rootDeviceEnvironment->getProductHelper());
*miFlushDwCmd = miFlush;
}
template <typename Family>
size_t EncodeMiFlushDW<Family>::getMiFlushDwCmdSizeForDataWrite() {
return sizeof(typename Family::MI_FLUSH_DW) + EncodeMiFlushDW<Family>::getMiFlushDwWaSize();
size_t EncodeMiFlushDW<Family>::getWaSize(const EncodeDummyBlitWaArgs &waArgs) {
return BlitCommandsHelper<Family>::getDummyBlitSize(waArgs);
}
template <typename Family>
size_t EncodeMiFlushDW<Family>::getCommandSizeWithWa(const EncodeDummyBlitWaArgs &waArgs) {
return sizeof(typename Family::MI_FLUSH_DW) + EncodeMiFlushDW<Family>::getWaSize(waArgs);
}
template <typename Family>

View File

@@ -478,15 +478,7 @@ void EncodeL3State<Family>::encode(CommandContainer &container, bool enableSLM)
}
template <typename GfxFamily>
void EncodeMiFlushDW<GfxFamily>::appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper) {}
template <typename GfxFamily>
void EncodeMiFlushDW<GfxFamily>::programMiFlushDwWA(LinearStream &commandStream) {}
template <typename GfxFamily>
size_t EncodeMiFlushDW<GfxFamily>::getMiFlushDwWaSize() {
return 0;
}
void EncodeMiFlushDW<GfxFamily>::adjust(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper) {}
template <typename GfxFamily>
inline void EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(LinearStream &stream, const PipelineSelectArgs &args, bool is3DPipeline,

View File

@@ -641,22 +641,11 @@ inline void EncodeMediaInterfaceDescriptorLoad<Family>::encode(CommandContainer
}
template <typename Family>
void EncodeMiFlushDW<Family>::appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper) {
void EncodeMiFlushDW<Family>::adjust(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper) {
miFlushDwCmd->setFlushCcs(1);
miFlushDwCmd->setFlushLlc(1);
}
template <typename Family>
void EncodeMiFlushDW<Family>::programMiFlushDwWA(LinearStream &commandStream) {
auto miFlushDwCmd = commandStream.getSpaceForCmd<MI_FLUSH_DW>();
*miFlushDwCmd = Family::cmdInitMiFlushDw;
}
template <typename Family>
size_t EncodeMiFlushDW<Family>::getMiFlushDwWaSize() {
return sizeof(typename Family::MI_FLUSH_DW);
}
template <typename Family>
bool EncodeSurfaceState<Family>::isBindingTablePrefetchPreferred() {
return false;

View File

@@ -26,7 +26,7 @@
#include "shared/source/gmm_helper/page_table_mngr.h"
#include "shared/source/helpers/blit_commands_helper.h"
#include "shared/source/helpers/blit_properties.h"
#include "shared/source/helpers/definitions/mi_flush_args.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/engine_node_helper.h"
#include "shared/source/helpers/flat_batch_buffer_helper_hw.h"
#include "shared/source/helpers/flush_stamp.h"
@@ -199,9 +199,9 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushBcsTask(LinearStream &c
NEO::MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = isUsedNotifyEnableForPostSync();
auto &productHelper = this->peekRootDeviceEnvironment().template getHelper<ProductHelper>();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStreamTask, postSyncAddress, postSyncData, args, productHelper);
args.waArgs.isBcs = NEO::EngineHelpers::isBcs(getOsContext().getEngineType());
args.waArgs.rootDeviceEnvironment = const_cast<RootDeviceEnvironment *>(&(this->peekRootDeviceEnvironment()));
NEO::EncodeMiFlushDW<GfxFamily>::programWithWa(commandStreamTask, postSyncAddress, postSyncData, args);
}
auto &commandStreamCSR = getCS(getRequiredCmdStreamSizeAligned(dispatchBcsFlags));
@@ -1184,7 +1184,6 @@ inline void CommandStreamReceiverHw<GfxFamily>::unregisterDirectSubmissionFromCo
template <typename GfxFamily>
TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropertiesContainer &blitPropertiesContainer, bool blocking, bool profilingEnabled, Device &device) {
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
using MI_FLUSH_DW = typename GfxFamily::MI_FLUSH_DW;
auto lock = obtainUniqueOwnership();
bool blitterDirectSubmission = this->isBlitterDirectSubmissionEnabled();
@@ -1199,11 +1198,10 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
this->initializeResources();
this->initDirectSubmission();
auto &productHelper = this->peekRootDeviceEnvironment().template getHelper<ProductHelper>();
if (PauseOnGpuProperties::pauseModeAllowed(DebugManager.flags.PauseOnBlitCopy.get(), taskCount, PauseOnGpuProperties::PauseMode::BeforeWorkload)) {
BlitCommandsHelper<GfxFamily>::dispatchDebugPauseCommands(commandStream, getDebugPauseStateGPUAddress(),
DebugPauseState::waitingForUserStartConfirmation,
DebugPauseState::hasUserStartConfirmation, productHelper);
DebugPauseState::hasUserStartConfirmation, *rootDeviceEnvironment.get());
}
programEnginePrologue(commandStream);
@@ -1215,7 +1213,9 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
if (logicalStateHelper) {
logicalStateHelper->writeStreamInline(commandStream, false);
}
MiFlushArgs args;
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = rootDeviceEnvironment.get();
for (auto &blitProperties : blitPropertiesContainer) {
TimestampPacketHelper::programCsrDependenciesForTimestampPacketContainer<GfxFamily>(commandStream, blitProperties.csrDependencies);
TimestampPacketHelper::programCsrDependenciesForForMultiRootDeviceSyncContainer<GfxFamily>(commandStream, blitProperties.csrDependencies);
@@ -1231,19 +1231,16 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
if (dummyAllocation) {
makeResident(*dummyAllocation);
}
if (blitProperties.outputTimestampPacket) {
if (profilingEnabled) {
MiFlushArgs args;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, 0llu, newTaskCount, args, productHelper);
EncodeMiFlushDW<GfxFamily>::programWithWa(commandStream, 0llu, newTaskCount, args);
BlitCommandsHelper<GfxFamily>::encodeProfilingEndMmios(commandStream, *blitProperties.outputTimestampPacket);
} else {
auto timestampPacketGpuAddress = TimestampPacketHelper::getContextEndGpuAddress(*blitProperties.outputTimestampPacket);
MiFlushArgs args;
args.commandWithPostSync = true;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, timestampPacketGpuAddress, 0, args, productHelper);
EncodeMiFlushDW<GfxFamily>::programWithWa(commandStream, timestampPacketGpuAddress, 0, args);
}
makeResident(*blitProperties.outputTimestampPacket->getBaseGraphicsAllocation());
}
@@ -1257,10 +1254,9 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
makeResident(*blitProperties.clearColorAllocation);
}
if (blitProperties.multiRootDeviceEventSync != nullptr) {
MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = isUsedNotifyEnableForPostSync();
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, blitProperties.multiRootDeviceEventSync->getGpuAddress() + blitProperties.multiRootDeviceEventSync->getContextEndOffset(), std::numeric_limits<uint64_t>::max(), args, productHelper);
EncodeMiFlushDW<GfxFamily>::programWithWa(commandStream, blitProperties.multiRootDeviceEventSync->getGpuAddress() + blitProperties.multiRootDeviceEventSync->getContextEndOffset(), std::numeric_limits<uint64_t>::max(), args);
}
}
@@ -1270,18 +1266,16 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
updateTag |= blocking;
if (updateTag) {
MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(commandStream, tagAllocation->getGpuAddress(), false, peekRootDeviceEnvironment());
MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = isUsedNotifyEnableForPostSync();
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, tagAllocation->getGpuAddress(), newTaskCount, args, productHelper);
EncodeMiFlushDW<GfxFamily>::programWithWa(commandStream, tagAllocation->getGpuAddress(), newTaskCount, args);
MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(commandStream, tagAllocation->getGpuAddress(), false, peekRootDeviceEnvironment());
}
if (PauseOnGpuProperties::pauseModeAllowed(DebugManager.flags.PauseOnBlitCopy.get(), taskCount, PauseOnGpuProperties::PauseMode::AfterWorkload)) {
BlitCommandsHelper<GfxFamily>::dispatchDebugPauseCommands(commandStream, getDebugPauseStateGPUAddress(),
DebugPauseState::waitingForUserEndConfirmation,
DebugPauseState::hasUserEndConfirmation, productHelper);
DebugPauseState::hasUserEndConfirmation, *rootDeviceEnvironment.get());
}
void *endingCmdPtr = nullptr;
@@ -1344,14 +1338,17 @@ template <typename GfxFamily>
inline SubmissionStatus CommandStreamReceiverHw<GfxFamily>::flushMiFlushDW() {
auto lock = obtainUniqueOwnership();
auto &commandStream = getCS(EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite());
auto commandStreamStart = commandStream.getUsed();
MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = isUsedNotifyEnableForPostSync();
auto &productHelper = this->peekRootDeviceEnvironment().template getHelper<ProductHelper>();
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, tagAllocation->getGpuAddress(), taskCount + 1, args, productHelper);
args.waArgs.isBcs = EngineHelpers::isBcs(getOsContext().getEngineType());
args.waArgs.rootDeviceEnvironment = const_cast<RootDeviceEnvironment *>(&peekRootDeviceEnvironment());
auto &commandStream = getCS(EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(args.waArgs));
auto commandStreamStart = commandStream.getUsed();
EncodeMiFlushDW<GfxFamily>::programWithWa(commandStream, tagAllocation->getGpuAddress(), taskCount + 1, args);
makeResident(*tagAllocation);

View File

@@ -5,11 +5,13 @@
*
*/
#include "shared/source/helpers/definitions/command_encoder_args.h"
namespace NEO {
template <typename GfxFamily>
size_t DebuggerL0Hw<GfxFamily>::getSbaTrackingCommandsSize(size_t trackedAddressCount) {
if (singleAddressSpaceSbaTracking) {
EncodeDummyBlitWaArgs waArgs{false};
NEO::EncodeDummyBlitWaArgs waArgs{false};
constexpr uint32_t aluCmdSize = sizeof(typename GfxFamily::MI_MATH) + sizeof(typename GfxFamily::MI_MATH_ALU_INST_INLINE) * NUM_ALU_INST_FOR_READ_MODIFY_WRITE;
return 2 * (EncodeMiArbCheck<GfxFamily>::getCommandSizeWithWa(waArgs) + sizeof(typename GfxFamily::MI_BATCH_BUFFER_START)) +
trackedAddressCount * (sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM) + aluCmdSize + 2 * sizeof(typename GfxFamily::MI_STORE_REGISTER_MEM) +

View File

@@ -18,6 +18,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/flush_stamp.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/logical_state_helper.h"
@@ -634,7 +635,7 @@ inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeSwitchRingBuffer
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeEnd(bool relaxedOrderingSchedulerRequired) {
size_t size = Dispatcher::getSizeStopCommandBuffer() +
Dispatcher::getSizeCacheFlush(*hwInfo) +
Dispatcher::getSizeCacheFlush(rootDeviceEnvironment) +
(Dispatcher::getSizeStartCommandBuffer() - Dispatcher::getSizeStopCommandBuffer()) +
MemoryConstants::cacheLineSize;
if (disableMonitorFence) {
@@ -660,7 +661,7 @@ inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeDispatch(bool re
// mode 2 does not dispatch any commands
if (!disableCacheFlush) {
size += Dispatcher::getSizeCacheFlush(*hwInfo);
size += Dispatcher::getSizeCacheFlush(rootDeviceEnvironment);
}
if (!disableMonitorFence) {
size += Dispatcher::getSizeMonitorFence(rootDeviceEnvironment);

View File

@@ -29,9 +29,9 @@ class BlitterDispatcher : public Dispatcher<GfxFamily> {
static size_t getSizeMonitorFence(const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address);
static void dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const ProductHelper &productHelper);
static size_t getSizeCacheFlush(const HardwareInfo &hwInfo);
static size_t getSizeTlbFlush();
static void dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const RootDeviceEnvironment &rootDeviceEnvironment);
static size_t getSizeCacheFlush(const RootDeviceEnvironment &rootDeviceEnvironment);
static size_t getSizeTlbFlush(const RootDeviceEnvironment &rootDeviceEnvironment);
static bool isMultiTileSynchronizationSupported() {
return false;
}

View File

@@ -8,7 +8,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.h"
#include "shared/source/helpers/definitions/mi_flush_args.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/hw_info.h"
namespace NEO {
@@ -34,40 +34,44 @@ inline void BlitterDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmd
MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = useNotifyEnable;
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(cmdBuffer, gpuAddress, immediateData, args, productHelper);
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment);
EncodeMiFlushDW<GfxFamily>::programWithWa(cmdBuffer, gpuAddress, immediateData, args);
}
template <typename GfxFamily>
inline size_t BlitterDispatcher<GfxFamily>::getSizeMonitorFence(const RootDeviceEnvironment &rootDeviceEnvironment) {
size_t size = EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite();
EncodeDummyBlitWaArgs waArgs{true, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
size_t size = EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs);
return size;
}
template <typename GfxFamily>
inline void BlitterDispatcher<GfxFamily>::dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address) {
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
dispatchTlbFlush(cmdBuffer, address, productHelper);
dispatchTlbFlush(cmdBuffer, address, rootDeviceEnvironment);
}
template <typename GfxFamily>
inline void BlitterDispatcher<GfxFamily>::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const ProductHelper &productHelper) {
inline void BlitterDispatcher<GfxFamily>::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const RootDeviceEnvironment &rootDeviceEnvironment) {
MiFlushArgs args;
args.tlbFlush = true;
args.commandWithPostSync = true;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(cmdBuffer, address, 0ull, args, productHelper);
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment);
EncodeMiFlushDW<GfxFamily>::programWithWa(cmdBuffer, address, 0ull, args);
}
template <typename GfxFamily>
inline size_t BlitterDispatcher<GfxFamily>::getSizeCacheFlush(const HardwareInfo &hwInfo) {
size_t size = EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite();
inline size_t BlitterDispatcher<GfxFamily>::getSizeCacheFlush(const RootDeviceEnvironment &rootDeviceEnvironment) {
EncodeDummyBlitWaArgs waArgs{true, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
size_t size = EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs);
return size;
}
template <typename GfxFamily>
inline size_t BlitterDispatcher<GfxFamily>::getSizeTlbFlush() {
size_t size = EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite();
inline size_t BlitterDispatcher<GfxFamily>::getSizeTlbFlush(const RootDeviceEnvironment &rootDeviceEnvironment) {
EncodeDummyBlitWaArgs waArgs{true, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
size_t size = EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs);
return size;
}

View File

@@ -29,9 +29,9 @@ class RenderDispatcher : public Dispatcher<GfxFamily> {
static size_t getSizeMonitorFence(const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address);
static void dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const ProductHelper &productHelper);
static size_t getSizeCacheFlush(const HardwareInfo &hwInfo);
static size_t getSizeTlbFlush();
static void dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const RootDeviceEnvironment &rootDeviceEnvironment);
static size_t getSizeCacheFlush(const RootDeviceEnvironment &rootDeviceEnvironment);
static size_t getSizeTlbFlush(const RootDeviceEnvironment &rootDeviceEnvironment);
static bool isMultiTileSynchronizationSupported() {
return true;
}

View File

@@ -57,7 +57,7 @@ inline void RenderDispatcher<GfxFamily>::dispatchCacheFlush(LinearStream &cmdBuf
}
template <typename GfxFamily>
inline void RenderDispatcher<GfxFamily>::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const ProductHelper &productHelper) {
inline void RenderDispatcher<GfxFamily>::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const RootDeviceEnvironment &rootDeviceEnvironment) {
PipeControlArgs args;
args.tlbInvalidation = true;
args.pipeControlFlushEnable = true;
@@ -67,13 +67,13 @@ inline void RenderDispatcher<GfxFamily>::dispatchTlbFlush(LinearStream &cmdBuffe
}
template <typename GfxFamily>
inline size_t RenderDispatcher<GfxFamily>::getSizeCacheFlush(const HardwareInfo &hwInfo) {
inline size_t RenderDispatcher<GfxFamily>::getSizeCacheFlush(const RootDeviceEnvironment &rootDeviceEnvironment) {
size_t size = MemorySynchronizationCommands<GfxFamily>::getSizeForFullCacheFlush();
return size;
}
template <typename GfxFamily>
inline size_t RenderDispatcher<GfxFamily>::getSizeTlbFlush() {
inline size_t RenderDispatcher<GfxFamily>::getSizeTlbFlush(const RootDeviceEnvironment &rootDeviceEnvironment) {
return MemorySynchronizationCommands<GfxFamily>::getSizeForSingleBarrier(true);
}

View File

@@ -179,8 +179,7 @@ void DrmDirectSubmission<GfxFamily, Dispatcher>::handleNewResourcesSubmission()
auto osContextLinux = static_cast<OsContextLinux *>(&this->osContext);
auto tlbFlushCounter = osContextLinux->peekTlbFlushCounter();
auto &productHelper = this->rootDeviceEnvironment.template getHelper<ProductHelper>();
Dispatcher::dispatchTlbFlush(this->ringCommandStream, this->gpuVaForMiFlush, productHelper);
Dispatcher::dispatchTlbFlush(this->ringCommandStream, this->gpuVaForMiFlush, this->rootDeviceEnvironment);
osContextLinux->setTlbFlushed(tlbFlushCounter);
}
}
@@ -188,7 +187,7 @@ void DrmDirectSubmission<GfxFamily, Dispatcher>::handleNewResourcesSubmission()
template <typename GfxFamily, typename Dispatcher>
size_t DrmDirectSubmission<GfxFamily, Dispatcher>::getSizeNewResourceHandler() {
// Overestimate to avoid race
return Dispatcher::getSizeTlbFlush();
return Dispatcher::getSizeTlbFlush(this->rootDeviceEnvironment);
}
template <typename GfxFamily, typename Dispatcher>

View File

@@ -156,7 +156,7 @@ set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}hw_cmds.h
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}device_ids_configs.h
${CMAKE_CURRENT_SOURCE_DIR}/definitions/engine_group_types.h
${CMAKE_CURRENT_SOURCE_DIR}/definitions/mi_flush_args.h
${CMAKE_CURRENT_SOURCE_DIR}/definitions/command_encoder_args.h
)
if(SUPPORT_XEHP_AND_LATER)

View File

@@ -31,8 +31,8 @@ struct BlitCommandsHelper {
static uint64_t getMaxBlitWidthOverride(const RootDeviceEnvironment &rootDeviceEnvironment);
static uint64_t getMaxBlitHeight(const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed);
static uint64_t getMaxBlitHeightOverride(const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed);
static void dispatchPreBlitCommand(LinearStream &linearStream, const ProductHelper &productHelper);
static size_t estimatePreBlitCommandSize();
static void dispatchPreBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment);
static size_t estimatePreBlitCommandSize(const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchPostBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment);
static size_t estimatePostBlitCommandSize(const RootDeviceEnvironment &rootDeviceEnvironment);
static size_t estimateBlitCommandSize(const Vec3<size_t> &copySize, const CsrDependencies &csrDependencies, bool updateTimestampPacket,
@@ -75,8 +75,8 @@ struct BlitCommandsHelper {
uint32_t &mipTailLod, uint32_t &compressionDetails, uint32_t &compressionType,
const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane);
static void dispatchDebugPauseCommands(LinearStream &commandStream, uint64_t debugPauseStateGPUAddress, DebugPauseState confirmationTrigger,
DebugPauseState waitCondition, const ProductHelper &productHelper);
static size_t getSizeForDebugPauseCommands();
DebugPauseState waitCondition, RootDeviceEnvironment &rootDeviceEnvironment);
static size_t getSizeForDebugPauseCommands(const RootDeviceEnvironment &rootDeviceEnvironment);
static uint32_t getAvailableBytesPerPixel(size_t copySize, uint32_t srcOrigin, uint32_t dstOrigin, size_t srcSize, size_t dstSize);
static bool isCopyRegionPreferred(const Vec3<size_t> &copySize, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed);
static void programGlobalSequencerFlush(LinearStream &commandStream);

View File

@@ -41,17 +41,20 @@ uint64_t BlitCommandsHelper<GfxFamily>::getMaxBlitHeight(const RootDeviceEnviron
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchPreBlitCommand(LinearStream &linearStream, const ProductHelper &productHelper) {
void BlitCommandsHelper<GfxFamily>::dispatchPreBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
if (BlitCommandsHelper<GfxFamily>::preBlitCommandWARequired()) {
MiFlushArgs args;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, productHelper);
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment);
EncodeMiFlushDW<GfxFamily>::programWithWa(linearStream, 0, 0, args);
}
}
template <typename GfxFamily>
size_t BlitCommandsHelper<GfxFamily>::estimatePreBlitCommandSize() {
size_t BlitCommandsHelper<GfxFamily>::estimatePreBlitCommandSize(const RootDeviceEnvironment &rootDeviceEnvironment) {
if (BlitCommandsHelper<GfxFamily>::preBlitCommandWARequired()) {
return EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite();
EncodeDummyBlitWaArgs waArgs{true, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
return EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs);
}
return 0u;
@@ -60,16 +63,16 @@ size_t BlitCommandsHelper<GfxFamily>::estimatePreBlitCommandSize() {
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
MiFlushArgs args;
EncodeDummyBlitWaArgs waArgs{true, &rootDeviceEnvironment};
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = &rootDeviceEnvironment;
auto &productHelper = rootDeviceEnvironment.getProductHelper();
if (DebugManager.flags.PostBlitCommand.get() != BlitterConstants::PostBlitMode::Default) {
switch (DebugManager.flags.PostBlitCommand.get()) {
case BlitterConstants::PostBlitMode::MiArbCheck:
EncodeMiArbCheck<GfxFamily>::programWithWa(linearStream, std::nullopt, waArgs);
EncodeMiArbCheck<GfxFamily>::programWithWa(linearStream, std::nullopt, args.waArgs);
return;
case BlitterConstants::PostBlitMode::MiFlush:
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, productHelper);
EncodeMiFlushDW<GfxFamily>::programWithWa(linearStream, 0, 0, args);
return;
default:
return;
@@ -77,10 +80,10 @@ void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linear
}
if (BlitCommandsHelper<GfxFamily>::miArbCheckWaRequired()) {
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, productHelper);
EncodeMiFlushDW<GfxFamily>::programWithWa(linearStream, 0, 0, args);
}
EncodeMiArbCheck<GfxFamily>::programWithWa(linearStream, std::nullopt, waArgs);
EncodeMiArbCheck<GfxFamily>::programWithWa(linearStream, std::nullopt, args.waArgs);
}
template <typename GfxFamily>
@@ -91,14 +94,14 @@ size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize(const RootDevi
case BlitterConstants::PostBlitMode::MiArbCheck:
return EncodeMiArbCheck<GfxFamily>::getCommandSizeWithWa(waArgs);
case BlitterConstants::PostBlitMode::MiFlush:
return EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite();
return EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs);
default:
return 0;
}
}
if (BlitCommandsHelper<GfxFamily>::miArbCheckWaRequired()) {
return (EncodeMiArbCheck<GfxFamily>::getCommandSizeWithWa(waArgs) + EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite());
return (EncodeMiArbCheck<GfxFamily>::getCommandSizeWithWa(waArgs) + EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs));
}
return EncodeMiArbCheck<GfxFamily>::getCommandSizeWithWa(waArgs);
@@ -109,7 +112,8 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandSize(const Vec3<size_t>
bool updateTimestampPacket, bool profilingEnabled, bool isImage, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed) {
size_t timestampCmdSize = 0;
if (updateTimestampPacket) {
timestampCmdSize += EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite();
EncodeDummyBlitWaArgs waArgs{true, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
timestampCmdSize += EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs);
if (profilingEnabled) {
timestampCmdSize += getProfilingMmioCmdsSize();
}
@@ -132,7 +136,7 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandSize(const Vec3<size_t>
TimestampPacketHelper::getRequiredCmdStreamSizeForMultiRootDeviceSyncNodesContainer<GfxFamily>(csrDependencies) +
(sizePerBlit * nBlits) +
timestampCmdSize +
estimatePreBlitCommandSize();
estimatePreBlitCommandSize(rootDeviceEnvironment);
}
template <typename GfxFamily>
@@ -140,22 +144,23 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(const BlitPropert
bool profilingEnabled, bool debugPauseEnabled,
bool blitterDirectSubmission, const RootDeviceEnvironment &rootDeviceEnvironment) {
size_t size = 0;
EncodeDummyBlitWaArgs waArgs{true, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
for (auto &blitProperties : blitPropertiesContainer) {
auto updateTimestampPacket = blitProperties.outputTimestampPacket != nullptr;
auto isImage = blitProperties.isImageOperation();
size += BlitCommandsHelper<GfxFamily>::estimateBlitCommandSize(blitProperties.copySize, blitProperties.csrDependencies, updateTimestampPacket,
profilingEnabled, isImage, rootDeviceEnvironment, blitProperties.isSystemMemoryPoolUsed);
if (blitProperties.multiRootDeviceEventSync != nullptr) {
size += EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite();
size += EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs);
}
}
size += BlitCommandsHelper<GfxFamily>::getWaCmdsSize(blitPropertiesContainer);
size += 2 * MemorySynchronizationCommands<GfxFamily>::getSizeForAdditonalSynchronization(rootDeviceEnvironment);
size += EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite();
size += EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs);
size += blitterDirectSubmission ? sizeof(typename GfxFamily::MI_BATCH_BUFFER_START) : sizeof(typename GfxFamily::MI_BATCH_BUFFER_END);
if (debugPauseEnabled) {
size += BlitCommandsHelper<GfxFamily>::getSizeForDebugPauseCommands();
size += BlitCommandsHelper<GfxFamily>::getSizeForDebugPauseCommands(rootDeviceEnvironment);
}
size += BlitCommandsHelper<GfxFamily>::getSizeForGlobalSequencerFlush();
@@ -189,8 +194,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
PRINT_DEBUG_STRING(DebugManager.flags.PrintBlitDispatchDetails.get(), stdout,
"\nBlit dispatch with AuxTranslationDirection %u ", static_cast<uint32_t>(blitProperties.auxTranslationDirection));
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
dispatchPreBlitCommand(linearStream, productHelper);
dispatchPreBlitCommand(linearStream, rootDeviceEnvironment);
auto bltCmd = GfxFamily::cmdInitXyCopyBlt;
appendColorDepth(blitProperties, bltCmd);
@@ -279,7 +283,6 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(NEO::GraphicsAllocati
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
auto srcSlicePitch = static_cast<uint32_t>(blitProperties.srcSlicePitch);
auto dstSlicePitch = static_cast<uint32_t>(blitProperties.dstSlicePitch);
@@ -303,7 +306,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const Bli
appendColorDepth(blitProperties, bltCmd);
appendSurfaceType(blitProperties, bltCmd);
dispatchPreBlitCommand(linearStream, productHelper);
dispatchPreBlitCommand(linearStream, rootDeviceEnvironment);
for (uint32_t i = 0; i < blitProperties.copySize.z; i++) {
appendSliceOffsets(blitProperties, bltCmd, i, rootDeviceEnvironment, srcSlicePitch, dstSlicePitch);
@@ -320,20 +323,23 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const Bli
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchDebugPauseCommands(LinearStream &commandStream, uint64_t debugPauseStateGPUAddress,
DebugPauseState confirmationTrigger, DebugPauseState waitCondition,
const ProductHelper &productHelper) {
RootDeviceEnvironment &rootDeviceEnvironment) {
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
MiFlushArgs args;
args.commandWithPostSync = true;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, debugPauseStateGPUAddress, static_cast<uint32_t>(confirmationTrigger),
args, productHelper);
args.waArgs.isBcs = true;
args.waArgs.rootDeviceEnvironment = &rootDeviceEnvironment;
EncodeMiFlushDW<GfxFamily>::programWithWa(commandStream, debugPauseStateGPUAddress, static_cast<uint32_t>(confirmationTrigger),
args);
EncodeSempahore<GfxFamily>::addMiSemaphoreWaitCommand(commandStream, debugPauseStateGPUAddress, static_cast<uint32_t>(waitCondition), COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD);
}
template <typename GfxFamily>
size_t BlitCommandsHelper<GfxFamily>::getSizeForDebugPauseCommands() {
return (EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite() + EncodeSempahore<GfxFamily>::getSizeMiSemaphoreWait()) * 2;
size_t BlitCommandsHelper<GfxFamily>::getSizeForDebugPauseCommands(const RootDeviceEnvironment &rootDeviceEnvironment) {
EncodeDummyBlitWaArgs waArgs{true, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
return (EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs) + EncodeSempahore<GfxFamily>::getSizeMiSemaphoreWait()) * 2;
}
template <typename GfxFamily>
@@ -388,12 +394,11 @@ void BlitCommandsHelper<GfxFamily>::appendBlitCommandsMemCopy(const BlitProperti
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferRegion(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
const auto maxWidthToCopy = getMaxBlitWidth(rootDeviceEnvironment);
const auto maxHeightToCopy = getMaxBlitHeight(rootDeviceEnvironment, blitProperties.isSystemMemoryPoolUsed);
dispatchPreBlitCommand(linearStream, productHelper);
dispatchPreBlitCommand(linearStream, rootDeviceEnvironment);
auto bltCmd = GfxFamily::cmdInitXyCopyBlt;
bltCmd.setSourcePitch(static_cast<uint32_t>(blitProperties.srcRowPitch));

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,12 +8,20 @@
#pragma once
namespace NEO {
struct RootDeviceEnvironment;
struct EncodeDummyBlitWaArgs {
bool isBcs = false;
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
};
struct MiFlushArgs {
bool timeStampOperation = false;
bool commandWithPostSync = false;
bool notifyEnable = false;
bool tlbFlush = false;
EncodeDummyBlitWaArgs waArgs{};
MiFlushArgs() = default;
};
} // namespace NEO

View File

@@ -183,19 +183,10 @@ size_t EncodeMemoryPrefetch<Family>::getSizeForMemoryPrefetch(size_t size, const
}
template <>
inline void EncodeMiFlushDW<Family>::appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper) {
inline void EncodeMiFlushDW<Family>::adjust(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper) {
miFlushDwCmd->setFlushLlc(1);
}
template <>
inline void EncodeMiFlushDW<Family>::programMiFlushDwWA(LinearStream &commandStream) {
}
template <>
size_t EncodeMiFlushDW<Family>::getMiFlushDwWaSize() {
return 0;
}
template <>
void EncodeDispatchKernel<Family>::programBarrierEnable(INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor,
uint32_t value,

View File

@@ -197,6 +197,18 @@ void adjustL3ControlField<Family>(void *l3ControlBuffer) {
l3Control->setUnTypedDataPortCacheFlush(true);
}
template <>
void EncodeMiFlushDW<Family>::appendWa(LinearStream &commandStream, MiFlushArgs &args) {
BlitCommandsHelper<Family>::dispatchDummyBlit(commandStream, args.waArgs);
auto miFlushDwCmd = commandStream.getSpaceForCmd<MI_FLUSH_DW>();
*miFlushDwCmd = Family::cmdInitMiFlushDw;
}
template <>
size_t EncodeMiFlushDW<Family>::getWaSize(const EncodeDummyBlitWaArgs &waArgs) {
return sizeof(typename Family::MI_FLUSH_DW) + BlitCommandsHelper<Family>::getDummyBlitSize(waArgs);
}
template void flushGpuCache<Family>(LinearStream *commandStream, const Range<L3Range> &ranges, uint64_t postSyncAddress, const HardwareInfo &hwInfo);
template struct EncodeDispatchKernel<Family>;

View File

@@ -27,6 +27,7 @@ set(NEO_CORE_tests_mocks
${CMAKE_CURRENT_SOURCE_DIR}/mock_builtinslib.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_cif.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_cif.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_command_encoder.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_command_stream_receiver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_command_stream_receiver.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_compiler_cache.h

View File

@@ -0,0 +1,16 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/command_container/command_encoder.h"
namespace NEO {
template <typename GfxFamily>
struct MockEncodeMiFlushDW : EncodeMiFlushDW<GfxFamily> {
using EncodeMiFlushDW<GfxFamily>::getWaSize;
};
} // namespace NEO

View File

@@ -10,7 +10,7 @@
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/helpers/definitions/mi_flush_args.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/memory_manager.h"
@@ -52,11 +52,11 @@ HWTEST_F(CommandEncoderTests, givenImmDataWriteWhenProgrammingMiFlushDwThenSetAl
uint64_t gpuAddress = 0x1230000;
uint64_t immData = 456;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
MiFlushArgs args;
args.commandWithPostSync = true;
args.waArgs.rootDeviceEnvironment = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, gpuAddress, immData, args, productHelper);
EncodeMiFlushDW<FamilyType>::programWithWa(linearStream, gpuAddress, immData, args);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
unsigned int sizeMultiplier = 1;
@@ -86,10 +86,10 @@ HWTEST2_F(CommandEncoderTests, given57bitVaForDestinationAddressWhenProgrammingM
const uint64_t setGpuAddress = 0xffffffffffffffff;
const uint64_t verifyGpuAddress = 0xfffffffffffffff8;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
MiFlushArgs args;
args.commandWithPostSync = true;
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, setGpuAddress, 0, args, productHelper);
args.waArgs.rootDeviceEnvironment = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
EncodeMiFlushDW<FamilyType>::programWithWa(linearStream, setGpuAddress, 0, args);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
EXPECT_EQ(verifyGpuAddress, miFlushDwCmd->getDestinationAddress());
@@ -129,11 +129,11 @@ HWTEST_F(CommandEncoderTests, givenNotify) {
uint64_t gpuAddress = 0x1230000;
uint64_t immData = 456;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = true;
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, gpuAddress, immData, args, productHelper);
args.waArgs.rootDeviceEnvironment = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
EncodeMiFlushDW<FamilyType>::programWithWa(linearStream, gpuAddress, immData, args);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
unsigned int sizeMultiplier = 1;

View File

@@ -7,6 +7,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"

View File

@@ -490,7 +490,7 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchFlushSectionThen
EXPECT_TRUE(ret);
Dispatcher::dispatchCacheFlush(directSubmission.ringCommandStream, pDevice->getRootDeviceEnvironment(), 0ull);
EXPECT_EQ(Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo), directSubmission.ringCommandStream.getUsed());
EXPECT_EQ(Dispatcher::getSizeCacheFlush(pDevice->getRootDeviceEnvironment()), directSubmission.ringCommandStream.getUsed());
}
HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchTagUpdateSectionThenExpectCorrectSizeUsed) {
@@ -524,7 +524,7 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenGetDispatchSizeThenExpec
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
size_t expectedSize = directSubmission.getSizeStartSection() +
Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
Dispatcher::getSizeCacheFlush(directSubmission.rootDeviceEnvironment) +
Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment) +
directSubmission.getSizeSemaphoreSection(false);
@@ -541,7 +541,7 @@ HWTEST_F(DirectSubmissionTest,
directSubmission.workloadMode = 1;
size_t expectedSize = Dispatcher::getSizeStoreDwordCommand() +
Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
Dispatcher::getSizeCacheFlush(directSubmission.rootDeviceEnvironment) +
Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
@@ -556,7 +556,7 @@ HWTEST_F(DirectSubmissionTest,
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
directSubmission.workloadMode = 2;
size_t expectedSize = Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
size_t expectedSize = Dispatcher::getSizeCacheFlush(directSubmission.rootDeviceEnvironment) +
Dispatcher::getSizeMonitorFence(directSubmission.rootDeviceEnvironment) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
@@ -585,7 +585,7 @@ HWTEST_F(DirectSubmissionTest,
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
directSubmission.disableMonitorFence = true;
size_t expectedSize = directSubmission.getSizeStartSection() +
Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
Dispatcher::getSizeCacheFlush(directSubmission.rootDeviceEnvironment) +
directSubmission.getSizeSemaphoreSection(false);
size_t actualSize = directSubmission.getSizeDispatch(false, false);
@@ -598,7 +598,7 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenGetEndSizeThenExpectCorr
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
size_t expectedSize = Dispatcher::getSizeStopCommandBuffer() +
Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo) +
Dispatcher::getSizeCacheFlush(directSubmission.rootDeviceEnvironment) +
(Dispatcher::getSizeStartCommandBuffer() - Dispatcher::getSizeStopCommandBuffer()) +
MemoryConstants::cacheLineSize;
size_t actualSize = directSubmission.getSizeEnd(false);

View File

@@ -5,7 +5,6 @@
*
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_container/implicit_scaling.h"
#include "shared/source/command_stream/submissions_aggregator.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
@@ -15,6 +14,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/helpers/blit_commands_helper.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/flush_stamp.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/register_offsets.h"
@@ -447,7 +447,7 @@ HWTEST_F(DirectSubmissionDispatchBufferTest,
bool ret = directSubmission.allocateResources();
EXPECT_TRUE(ret);
size_t flushSize = Dispatcher::getSizeCacheFlush(*directSubmission.hwInfo);
size_t flushSize = Dispatcher::getSizeCacheFlush(directSubmission.rootDeviceEnvironment);
size_t disabledSizeDispatch = directSubmission.getSizeDispatch(false, false);
EXPECT_EQ(disabledSizeDispatch, (regularSizeDispatch - flushSize));
@@ -2902,7 +2902,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenRelaxedOrderingSchedulerReq
EXPECT_EQ(expectedBaseSemaphoreSectionSize + EncodeSempahore<FamilyType>::getSizeMiSemaphoreWait(), directSubmission.getSizeSemaphoreSection(false));
size_t expectedBaseEndSize = Dispatcher::getSizeStopCommandBuffer() +
Dispatcher::getSizeCacheFlush(pDevice->getHardwareInfo()) +
Dispatcher::getSizeCacheFlush(directSubmission.rootDeviceEnvironment) +
(Dispatcher::getSizeStartCommandBuffer() - Dispatcher::getSizeStopCommandBuffer()) +
MemoryConstants::cacheLineSize;
if (directSubmission.disableMonitorFence) {

View File

@@ -7,6 +7,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/xe_hp_core/hw_cmds.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"

View File

@@ -5,9 +5,10 @@
*
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/mocks/mock_command_encoder.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "shared/test/unit_test/direct_submission/dispatchers/dispatcher_fixture.h"
@@ -27,13 +28,15 @@ HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingPreemptionCmdThenDispa
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenAskingForMonitorFenceCmdSizeThenReturnExpectedNumberOfMiFlush) {
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
EXPECT_EQ(expectedSize, BlitterDispatcher<FamilyType>::getSizeMonitorFence(pDevice->getRootDeviceEnvironment()));
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingMonitorFenceCmdThenDispatchMiFlushWithPostSync) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
uint64_t expectedGpuAddress = 0x5100ull;
uint64_t expectedValue = 0x1234ull;
@@ -56,13 +59,15 @@ HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingMonitorFenceCmdThenDis
EXPECT_TRUE(foundPostSync);
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenAskingForCacheFlushCmdSizeThenReturnExpetedSize) {
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
EXPECT_EQ(expectedSize, BlitterDispatcher<FamilyType>::getSizeCacheFlush(pDevice->getHardwareInfo()));
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
EXPECT_EQ(expectedSize, BlitterDispatcher<FamilyType>::getSizeCacheFlush(pDevice->getRootDeviceEnvironment()));
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingCacheFlushCmdThenDispatchMiFlushCommand) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
BlitterDispatcher<FamilyType>::dispatchCacheFlush(cmdBuffer, pDevice->getRootDeviceEnvironment(), 0ull);
@@ -76,21 +81,20 @@ HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingCacheFlushCmdThenDispa
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingTlbFlushThenDispatchMiFlushCommandWithproperBits) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
auto &productHelper = this->pDevice->getRootDeviceEnvironment().getHelper<ProductHelper>();
BlitterDispatcher<FamilyType>::dispatchTlbFlush(cmdBuffer, 0ull, productHelper);
BlitterDispatcher<FamilyType>::dispatchTlbFlush(cmdBuffer, 0ull, pDevice->getRootDeviceEnvironment());
EXPECT_EQ(expectedSize, cmdBuffer.getUsed());
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer, EncodeMiFlushDW<FamilyType>::getMiFlushDwWaSize());
hwParse.parseCommands<FamilyType>(cmdBuffer, MockEncodeMiFlushDW<FamilyType>::getWaSize(waArgs));
auto miFlushDw = hwParse.getCommand<MI_FLUSH_DW>();
EXPECT_TRUE(miFlushDw->getTlbInvalidate());
EXPECT_EQ(miFlushDw->getPostSyncOperation(), MI_FLUSH_DW::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA_QWORD);
EXPECT_EQ(BlitterDispatcher<FamilyType>::getSizeTlbFlush(), EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite());
EXPECT_EQ(BlitterDispatcher<FamilyType>::getSizeTlbFlush(pDevice->getRootDeviceEnvironment()), EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs));
}
HWTEST_F(BlitterDispatcheTest, givenBlitterWhenCheckingForMultiTileSynchronizationSupportThenExpectFalse) {

View File

@@ -89,7 +89,7 @@ HWTEST_F(RenderDispatcherTest, givenRenderWhenAddingMonitorFenceCmdThenExpectPip
HWTEST_F(RenderDispatcherTest, givenRenderWhenAskingForCacheFlushCmdSizeThenReturnSetRequiredPipeControls) {
size_t expectedSize = MemorySynchronizationCommands<FamilyType>::getSizeForFullCacheFlush();
size_t actualSize = RenderDispatcher<FamilyType>::getSizeCacheFlush(hardwareInfo);
size_t actualSize = RenderDispatcher<FamilyType>::getSizeCacheFlush(pDevice->getRootDeviceEnvironment());
EXPECT_EQ(expectedSize, actualSize);
}

View File

@@ -8,7 +8,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/helpers/blit_commands_helper.h"
#include "shared/source/helpers/definitions/mi_flush_args.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
@@ -25,9 +25,9 @@ HWTEST_F(EncodeMiFlushDWTest, GivenLinearStreamWhenCllaedEncodeWithNoPostSyncThe
MockGraphicsAllocation gfxAllocation(static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer));
LinearStream stream(&gfxAllocation);
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
MiFlushArgs args;
EncodeMiFlushDW<FamilyType>::programMiFlushDw(stream, 0, 0, args, productHelper);
args.waArgs.rootDeviceEnvironment = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
EncodeMiFlushDW<FamilyType>::programWithWa(stream, 0, 0, args);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, stream.getCpuBase(), stream.getUsed());
@@ -48,10 +48,10 @@ HWTEST_F(EncodeMiFlushDWTest, GivenLinearStreamWhenCllaedEncodeWithPostSyncDataT
uint64_t address = 0x1000;
uint64_t data = 0x4321;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
MiFlushArgs args;
args.commandWithPostSync = true;
EncodeMiFlushDW<FamilyType>::programMiFlushDw(stream, address, data, args, productHelper);
args.waArgs.rootDeviceEnvironment = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
EncodeMiFlushDW<FamilyType>::programWithWa(stream, address, data, args);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, stream.getCpuBase(), stream.getUsed());
@@ -81,10 +81,10 @@ HWTEST_F(EncodeMiFlushDWTest, GivenLinearStreamWhenCllaedEncodeWithTimestampFasl
uint64_t address = 0x1000;
uint64_t data = 0x4321;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
MiFlushArgs args;
args.commandWithPostSync = true;
EncodeMiFlushDW<FamilyType>::programMiFlushDw(stream, address, data, args, productHelper);
args.waArgs.rootDeviceEnvironment = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
EncodeMiFlushDW<FamilyType>::programWithWa(stream, address, data, args);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, stream.getCpuBase(), stream.getUsed());
@@ -113,11 +113,11 @@ HWTEST_F(EncodeMiFlushDWTest, GivenLinearStreamWhenCllaedEncodeWithTimestampTrue
uint64_t address = 0x1000;
uint64_t data = 0x4321;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
MiFlushArgs args;
args.timeStampOperation = true;
args.commandWithPostSync = true;
EncodeMiFlushDW<FamilyType>::programMiFlushDw(stream, address, data, args, productHelper);
args.waArgs.rootDeviceEnvironment = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
EncodeMiFlushDW<FamilyType>::programWithWa(stream, address, data, args);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, stream.getCpuBase(), stream.getUsed());

View File

@@ -6,7 +6,7 @@
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/helpers/definitions/mi_flush_args.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/hw_test.h"
@@ -21,10 +21,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterEncodeMiFlushDWTest, whenMiFlushDwIsPro
uint8_t buffer[2 * sizeof(MI_FLUSH_DW)] = {};
LinearStream linearStream(buffer, sizeof(buffer));
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
MiFlushArgs args;
args.commandWithPostSync = true;
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, 0x1230000, 456, args, productHelper);
args.waArgs.rootDeviceEnvironment = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
EncodeMiFlushDW<FamilyType>::programWithWa(linearStream, 0x1230000, 456, args);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
EXPECT_EQ(0u, miFlushDwCmd->getFlushCcs());
EXPECT_EQ(0u, miFlushDwCmd->getFlushLlc());

View File

@@ -10,6 +10,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/helpers/blit_properties.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
@@ -150,14 +151,15 @@ HWTEST_F(BlitTests, givenDebugVariablesWhenGettingMaxBlitSizeThenHonorUseProvide
}
HWTEST_F(BlitTests, givenDebugVariableWhenEstimatingPostBlitsCommandSizeThenReturnCorrectResult) {
size_t arbCheckSize = EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{true, const_cast<RootDeviceEnvironment *>(&(pDevice->getRootDeviceEnvironment()))});
EncodeDummyBlitWaArgs waArgs{true, const_cast<RootDeviceEnvironment *>(&(pDevice->getRootDeviceEnvironment()))};
size_t arbCheckSize = EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
DebugManagerStateRestore restore{};
size_t expectedDefaultSize = arbCheckSize;
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
expectedDefaultSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedDefaultSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
EXPECT_EQ(expectedDefaultSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(pDevice->getRootDeviceEnvironment()));
@@ -166,7 +168,7 @@ HWTEST_F(BlitTests, givenDebugVariableWhenEstimatingPostBlitsCommandSizeThenRetu
EXPECT_EQ(arbCheckSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(pDevice->getRootDeviceEnvironment()));
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::MiFlush);
EXPECT_EQ(EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite(), BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(pDevice->getRootDeviceEnvironment()));
EXPECT_EQ(EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs), BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(pDevice->getRootDeviceEnvironment()));
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::None);
EXPECT_EQ(0u, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(pDevice->getRootDeviceEnvironment()));
@@ -179,11 +181,11 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
uint32_t streamBuffer[100] = {};
LinearStream linearStream{streamBuffer, sizeof(streamBuffer)};
GenCmdList commands{};
size_t expectedDefaultSize = EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{true, const_cast<RootDeviceEnvironment *>(&(pDevice->getRootDeviceEnvironment()))});
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t expectedDefaultSize = EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
expectedDefaultSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
expectedDefaultSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
// -1: default
@@ -196,7 +198,7 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
iterator = find<MI_FLUSH_DW *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), iterator);
if (EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() == 2 * sizeof(MI_FLUSH_DW)) {
if (EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) == 2 * sizeof(MI_FLUSH_DW)) {
iterator = find<MI_FLUSH_DW *>(++iterator, commands.end());
EXPECT_NE(commands.end(), iterator);
}
@@ -655,15 +657,16 @@ HWTEST2_F(BlitTests, givenPlatformWhenCallingPreBlitCommandWARequiredThenReturns
HWTEST2_F(BlitTests, givenPlatformWhenCallingEstimatePreBlitCommandSizeThenZeroIsReturned, WithoutGen12Lp) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
EXPECT_EQ(0u, BlitCommandsHelper<FamilyType>::estimatePreBlitCommandSize());
EXPECT_EQ(0u, BlitCommandsHelper<FamilyType>::estimatePreBlitCommandSize(pDevice->getRootDeviceEnvironmentRef()));
}
HWTEST2_F(BlitTests, givenPlatformWhenCallingDispatchPreBlitCommandThenNoneMiFlushDwIsProgramed, WithoutGen12Lp) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
auto miFlushBuffer = std::make_unique<MI_FLUSH_DW>();
LinearStream linearStream(miFlushBuffer.get(), EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite());
EncodeDummyBlitWaArgs waArgs{true, const_cast<RootDeviceEnvironment *>(&pDevice->getRootDeviceEnvironment())};
LinearStream linearStream(miFlushBuffer.get(), EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs));
BlitCommandsHelper<FamilyType>::dispatchPreBlitCommand(linearStream, this->pDevice->getProductHelper());
BlitCommandsHelper<FamilyType>::dispatchPreBlitCommand(linearStream, *waArgs.rootDeviceEnvironment);
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(linearStream);

View File

@@ -8,6 +8,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/gmm_helper/resource_info.h"
#include "shared/source/helpers/blit_properties.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
@@ -250,15 +251,17 @@ HWTEST2_F(BlitTests, givenGen12LpPlatformWhenPreBlitCommandWARequiredThenReturns
HWTEST2_F(BlitTests, givenGen12LpPlatformWhenEstimatePreBlitCommandSizeThenSizeOfFlushIsReturned, IsGen12LP) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
EXPECT_EQ(EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite(), BlitCommandsHelper<FamilyType>::estimatePreBlitCommandSize());
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
EXPECT_EQ(EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs), BlitCommandsHelper<FamilyType>::estimatePreBlitCommandSize(pDevice->getRootDeviceEnvironmentRef()));
}
HWTEST2_F(BlitTests, givenGen12LpPlatformWhenDispatchPreBlitCommandThenMiFlushDwIsProgramed, IsGen12LP) {
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
auto miFlushBuffer = std::make_unique<MI_FLUSH_DW>();
LinearStream linearStream(miFlushBuffer.get(), EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite());
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
LinearStream linearStream(miFlushBuffer.get(), EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs));
BlitCommandsHelper<FamilyType>::dispatchPreBlitCommand(linearStream, this->pDevice->getProductHelper());
BlitCommandsHelper<FamilyType>::dispatchPreBlitCommand(linearStream, *(&pDevice->getRootDeviceEnvironmentRef()));
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(linearStream);

View File

@@ -10,6 +10,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/resource_info.h"
#include "shared/source/helpers/blit_properties.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/local_memory_access_modes.h"
#include "shared/source/os_interface/hw_info_config.h"

View File

@@ -9,7 +9,7 @@
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/helpers/definitions/mi_flush_args.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/kernel/kernel_descriptor.h"
#include "shared/source/os_interface/hw_info_config.h"
@@ -37,10 +37,10 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, whenMiFlushDwIsProgrammedThenSetAn
uint8_t buffer[2 * sizeof(MI_FLUSH_DW)] = {};
LinearStream linearStream(buffer, sizeof(buffer));
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
MiFlushArgs args;
args.commandWithPostSync = true;
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, 0x1230000, 456, args, productHelper);
args.waArgs.rootDeviceEnvironment = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
EncodeMiFlushDW<FamilyType>::programWithWa(linearStream, 0x1230000, 456, args);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
EXPECT_EQ(0u, miFlushDwCmd->getFlushCcs());
EXPECT_EQ(1u, miFlushDwCmd->getFlushLlc());