refactor: isFlushBetweenBlitsRequired helper

Moved from miArbCheckWaRequired in blit helper to product helper.

Preparation to remove flushes between blits on compatible platforms.

Related-To: NEO-16925

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek
2025-12-09 12:04:45 +00:00
committed by Compute-Runtime-Automation
parent 60376bd98a
commit 1cbfdbf39a
14 changed files with 64 additions and 53 deletions

View File

@@ -678,9 +678,11 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendMemoryCopy(
auto estimatedSize = commonImmediateCommandSize;
if (isCopyOnly(true)) {
auto nBlits = size / (NEO::BlitCommandsHelper<GfxFamily>::getMaxBlitWidth(this->device->getNEODevice()->getRootDeviceEnvironment()) *
NEO::BlitCommandsHelper<GfxFamily>::getMaxBlitHeight(this->device->getNEODevice()->getRootDeviceEnvironment(), true));
auto sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT) + NEO::BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize();
auto &rootDeviceEnvironment = this->device->getNEODevice()->getRootDeviceEnvironment();
auto &productHelper = rootDeviceEnvironment.getProductHelper();
auto nBlits = size / (NEO::BlitCommandsHelper<GfxFamily>::getMaxBlitWidth(rootDeviceEnvironment) *
NEO::BlitCommandsHelper<GfxFamily>::getMaxBlitHeight(rootDeviceEnvironment, true));
auto sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT) + NEO::BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize(productHelper.isFlushBetweenBlitsRequired());
estimatedSize += nBlits * sizePerBlit;
}
checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, estimatedSize, false);
@@ -740,10 +742,12 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendMemoryCopyRegio
auto estimatedSize = commonImmediateCommandSize;
if (isCopyOnly(true)) {
auto &rootDeviceEnvironment = this->device->getNEODevice()->getRootDeviceEnvironment();
auto &productHelper = rootDeviceEnvironment.getProductHelper();
auto xBlits = static_cast<size_t>(std::ceil(srcRegion->width / static_cast<double>(BlitterConstants::maxBlitWidth)));
auto yBlits = static_cast<size_t>(std::ceil(srcRegion->height / static_cast<double>(BlitterConstants::maxBlitHeight)));
auto zBlits = static_cast<size_t>(srcRegion->depth);
auto sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT) + NEO::BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize();
auto sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT) + NEO::BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize(productHelper.isFlushBetweenBlitsRequired());
estimatedSize += xBlits * yBlits * zBlits * sizePerBlit;
}
checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, estimatedSize, false);
@@ -932,9 +936,11 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyRegion
auto estimatedSize = commonImmediateCommandSize;
if (isCopyOnly(false)) {
auto &rootDeviceEnvironment = this->device->getNEODevice()->getRootDeviceEnvironment();
auto &productHelper = rootDeviceEnvironment.getProductHelper();
auto imgSize = L0::Image::fromHandle(hSrcImage)->getImageInfo().size;
auto nBlits = static_cast<size_t>(std::ceil(imgSize / static_cast<double>(BlitterConstants::maxBlitWidth * BlitterConstants::maxBlitHeight)));
auto sizePerBlit = sizeof(typename GfxFamily::XY_BLOCK_COPY_BLT) + NEO::BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize();
auto sizePerBlit = sizeof(typename GfxFamily::XY_BLOCK_COPY_BLT) + NEO::BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize(productHelper.isFlushBetweenBlitsRequired());
estimatedSize += nBlits * sizePerBlit;
}
checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, estimatedSize, false);

View File

@@ -692,12 +692,13 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenEstimatingCommandsSizeThenCal
const uint32_t numberOfBlitOperations = 4;
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment();
auto &productHelper = rootDeviceEnvironment.getProductHelper();
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (productHelper.isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -752,7 +753,7 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenDirectsubmissionEnabledEstima
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -798,7 +799,7 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenEstimatingCommandsSizeForWrit
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -853,7 +854,7 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenDirectSubmissionEnabledEstima
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -906,7 +907,7 @@ HWTEST_F(BcsTests, givenTimestampPacketWriteRequestWhenEstimatingSizeForCommands
waArgs.isWaRequired = false;
size_t expectedBaseSize = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -932,7 +933,7 @@ HWTEST_F(BcsTests, givenTimestampPacketWriteRequestWhenEstimatingSizeForCommands
waArgs.isWaRequired = false;
size_t expectedBaseSize = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize() + dummyBlitWaSize;
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -966,7 +967,7 @@ HWTEST_F(BcsTests, givenBltSizeAndCsrDependenciesWhenEstimatingCommandSizeThenAd
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -996,7 +997,7 @@ HWTEST_F(BcsTests, givenBltSizeWithCsrDependenciesAndRelaxedOrderingWhenEstimati
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -1020,7 +1021,7 @@ HWTEST_F(BcsTests, givenImageAndBufferWhenEstimateBlitCommandSizeThenReturnCorre
auto expectedSize = EncodeMiArbCheck<FamilyType>::getCommandSize();
expectedSize += isImage ? sizeof(typename FamilyType::XY_BLOCK_COPY_BLT) : sizeof(typename FamilyType::XY_COPY_BLT);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
expectedSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
if (BlitCommandsHelper<FamilyType>::preBlitCommandWARequired()) {
@@ -1283,7 +1284,7 @@ HWTEST_F(BcsTests, givenBltSizeWithLeftoverWhenDispatchedThenProgramAllRequiredC
EXPECT_EQ(expectedWidth, bltCmd->getDestinationPitch());
EXPECT_EQ(expectedWidth, bltCmd->getSourcePitch());
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
auto miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
@@ -1522,7 +1523,7 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP
offset += (expectedWidth * expectedHeight);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
auto miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
@@ -1625,7 +1626,7 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP
offset += (expectedWidth * expectedHeight);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
auto miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
@@ -1712,7 +1713,7 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP
offset += (expectedWidth * expectedHeight);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
auto miFlush = genCmdCast<typename FamilyType::MI_FLUSH_DW *>(*(cmdIterator++));
EXPECT_NE(nullptr, miFlush);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};

View File

@@ -46,7 +46,7 @@ HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeThenAddAllRequiredComman
waArgs.isWaRequired = false;
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -82,7 +82,7 @@ HWTEST_F(BcsTests, givenDebugCapabilityWhenEstimatingCommandSizeThenAddAllRequir
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -125,7 +125,7 @@ HWTEST_F(BcsTests, givenRelaxedOrderingEnabledWhenEstimatingCommandSizeThenAddAl
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -161,7 +161,7 @@ HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeForReadBufferRectThenAdd
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -197,7 +197,7 @@ HWTEST_F(BcsTests, givenBltWithBigCopySizeWhenEstimatingCommandSizeForReadBuffer
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (pDevice->getRootDeviceEnvironment().getProductHelper().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}

View File

@@ -198,11 +198,6 @@ size_t BlitCommandsHelper<GfxFamily>::getSizeForGlobalSequencerFlush() {
return 0u;
}
template <typename GfxFamily>
bool BlitCommandsHelper<GfxFamily>::miArbCheckWaRequired() {
return false;
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::appendClearColor(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {
}

View File

@@ -46,4 +46,9 @@ bool ProductHelperHw<gfxProduct>::isBufferPoolAllocatorSupported() const {
return false;
}
template <>
bool ProductHelperHw<gfxProduct>::isFlushBetweenBlitsRequired() const {
return false;
}
} // namespace NEO

View File

@@ -41,7 +41,7 @@ struct BlitCommandsHelper {
static void dispatchPreBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment);
static size_t estimatePreBlitCommandSize();
static void dispatchPostBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment);
static size_t estimatePostBlitCommandSize();
static size_t estimatePostBlitCommandSize(bool withFlush);
static size_t estimateBlitCommandSize(const Vec3<size_t> &copySize, const CsrDependencies &csrDependencies, bool updateTimestampPacket,
bool profilingEnabled, bool isImage, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed, bool relaxedOrderingEnabled);
static size_t estimateBlitCommandsSize(const BlitPropertiesContainer &blitPropertiesContainer, bool profilingEnabled,
@@ -95,7 +95,6 @@ struct BlitCommandsHelper {
static bool isCopyRegionPreferred(const Vec3<size_t> &copySize, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed);
static void programGlobalSequencerFlush(LinearStream &commandStream);
static size_t getSizeForGlobalSequencerFlush();
static bool miArbCheckWaRequired();
static bool preBlitCommandWARequired();
static void appendClearColor(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd);
static void printImageBlitBlockCopyCommand(const typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const uint32_t sliceIndex);

View File

@@ -93,7 +93,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linear
}
}
if (BlitCommandsHelper<GfxFamily>::miArbCheckWaRequired()) {
if (rootDeviceEnvironment.getProductHelper().isFlushBetweenBlitsRequired()) {
EncodeMiFlushDW<GfxFamily>::programWithWa(linearStream, 0, 0, args);
}
@@ -101,7 +101,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linear
}
template <typename GfxFamily>
size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize() {
size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize(bool withFlush) {
EncodeDummyBlitWaArgs waArgs{};
if (debugManager.flags.PostBlitCommand.get() != BlitterConstants::PostBlitMode::defaultMode) {
@@ -115,7 +115,7 @@ size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize() {
}
}
size_t size = 0u;
if (BlitCommandsHelper<GfxFamily>::miArbCheckWaRequired()) {
if (withFlush) {
size += EncodeMiFlushDW<GfxFamily>::getCommandSizeWithWa(waArgs);
}
size += EncodeMiArbCheck<GfxFamily>::getCommandSize();
@@ -146,7 +146,7 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandSize(const Vec3<size_t>
sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT);
}
sizePerBlit += estimatePostBlitCommandSize();
sizePerBlit += estimatePostBlitCommandSize(rootDeviceEnvironment.getProductHelper().isFlushBetweenBlitsRequired());
return TimestampPacketHelper::getRequiredCmdStreamSize<GfxFamily>(csrDependencies, relaxedOrderingEnabled) +
TimestampPacketHelper::getRequiredCmdStreamSizeForMultiRootDeviceSyncNodesContainer<GfxFamily>(csrDependencies) +
(sizePerBlit * nBlits) +

View File

@@ -290,11 +290,6 @@ size_t BlitCommandsHelper<GfxFamily>::getSizeForGlobalSequencerFlush() {
return 0u;
}
template <typename GfxFamily>
bool BlitCommandsHelper<GfxFamily>::miArbCheckWaRequired() {
return true;
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::appendClearColor(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {
}

View File

@@ -272,6 +272,7 @@ class ProductHelper {
virtual bool isCompressionForbidden(const HardwareInfo &hwInfo) const = 0;
virtual bool isExposingSubdevicesAllowed() const = 0;
virtual bool useAdditionalBlitProperties() const = 0;
virtual bool isFlushBetweenBlitsRequired() const = 0;
virtual bool isNonCoherentTimestampsModeEnabled() const = 0;
virtual bool isPackedCopyFormatSupported() const = 0;
virtual bool isPidFdOrSocketForIpcSupported() const = 0;

View File

@@ -1076,6 +1076,11 @@ bool ProductHelperHw<gfxProduct>::useAdditionalBlitProperties() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isFlushBetweenBlitsRequired() const {
return true;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isPackedCopyFormatSupported() const {
return false;

View File

@@ -209,6 +209,7 @@ class ProductHelperHw : public ProductHelper {
bool isCompressionForbidden(const HardwareInfo &hwInfo) const override;
bool isExposingSubdevicesAllowed() const override;
bool useAdditionalBlitProperties() const override;
bool isFlushBetweenBlitsRequired() const override;
bool isNonCoherentTimestampsModeEnabled() const override;
bool getStorageInfoLocalOnlyFlag(LocalMemAllocationMode usmDeviceAllocationMode, bool defaultValue) const override;
bool isPidFdOrSocketForIpcSupported() const override;

View File

@@ -151,10 +151,10 @@ GEN12LPTEST_F(CommandEncoderTest, GivenGen12LpWhenProgrammingL3StateOffThenExpec
EXPECT_EQ(itorLRI, commands.end());
}
using Gen12lpCommandEncodeTest = testing::Test;
GEN12LPTEST_F(Gen12lpCommandEncodeTest, givenBcsCommandsHelperWhenMiArbCheckWaRequiredThenReturnTrue) {
EXPECT_FALSE(BlitCommandsHelper<FamilyType>::miArbCheckWaRequired());
GEN12LPTEST_F(CommandEncoderTest, givenBcsCommandsHelperWhenIsFlushBetweenBlitsRequiredThenReturnFalse) {
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
EXPECT_FALSE(productHelper.isFlushBetweenBlitsRequired());
}
GEN12LPTEST_F(CommandEncodeStatesTest, givenGen12LpPlatformWhenAdjustPipelineSelectIsCalledThenPipelineIsDispatched) {

View File

@@ -251,29 +251,31 @@ HWTEST_F(BlitTests, givenDebugVariablesWhenGettingMaxBlitSetSizeThenHonorUseProv
}
HWTEST_F(BlitTests, givenDebugVariableWhenEstimatingPostBlitsCommandSizeThenReturnCorrectResult) {
const bool isFlushBetweenBlitsRequired = this->getHelper<ProductHelper>().isFlushBetweenBlitsRequired();
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
DebugManagerStateRestore restore{};
size_t arbCheckSize = EncodeMiArbCheck<FamilyType>::getCommandSize();
size_t expectedDefaultSize = arbCheckSize;
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (isFlushBetweenBlitsRequired) {
expectedDefaultSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
EXPECT_EQ(expectedDefaultSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
EXPECT_EQ(expectedDefaultSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(isFlushBetweenBlitsRequired));
debugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::miArbCheck);
EXPECT_EQ(arbCheckSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
EXPECT_EQ(arbCheckSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(isFlushBetweenBlitsRequired));
debugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::miFlush);
EXPECT_EQ(EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs), BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
EXPECT_EQ(EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs), BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(isFlushBetweenBlitsRequired));
debugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::none);
EXPECT_EQ(0u, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
EXPECT_EQ(0u, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(isFlushBetweenBlitsRequired));
}
HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorrectCommands) {
const auto isFlushBetweenBlitsRequired = this->getHelper<ProductHelper>().isFlushBetweenBlitsRequired();
using MI_ARB_CHECK = typename FamilyType::MI_ARB_CHECK;
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
DebugManagerStateRestore restore{};
@@ -284,7 +286,7 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
EncodeDummyBlitWaArgs waArgs{false, &rootDeviceEnvironment};
size_t expectedDefaultSize = EncodeMiArbCheck<FamilyType>::getCommandSize() + BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (isFlushBetweenBlitsRequired) {
expectedDefaultSize += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
@@ -295,7 +297,7 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
auto iterator = commands.begin();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (isFlushBetweenBlitsRequired) {
iterator = find<MI_FLUSH_DW *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), iterator);
if (EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs) == 2 * sizeof(MI_FLUSH_DW)) {
@@ -1086,7 +1088,7 @@ HWTEST_F(BlitTests, givenBlitPropertiesContainerWithNullSrcOrDstAllocationWhenEs
EncodeDummyBlitWaArgs waArgs{false, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSize();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
if (this->getHelper<ProductHelper>().isFlushBetweenBlitsRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getCommandSizeWithWa(waArgs);
}
auto expectedBlitInstructionsSize = cmdsSizePerBlit * numberOfBlts;
@@ -1418,6 +1420,7 @@ HWTEST2_F(BlitTests, givenSystemMemoryPlatformWithBlitSyncPropertiesWithAndWitho
}
HWTEST_F(BlitTests, givenBlitPropertieswithImageOperationWhenCallingEstimateBlitCommandSizeThenBlockCopySizeIsReturned) {
const bool isFlushBetweenBlitsRequired = this->getHelper<ProductHelper>().isFlushBetweenBlitsRequired();
size_t maxBlitWidth = static_cast<size_t>(BlitCommandsHelper<FamilyType>::getMaxBlitWidth(pDevice->getRootDeviceEnvironmentRef()));
Vec3<size_t> copySize{maxBlitWidth - 1, 1, 1};
NEO::CsrDependencies csrDependencies{};
@@ -1425,7 +1428,7 @@ HWTEST_F(BlitTests, givenBlitPropertieswithImageOperationWhenCallingEstimateBlit
size_t totalSize = NEO::BlitCommandsHelper<FamilyType>::estimateBlitCommandSize(copySize, csrDependencies, false, false, true, pDevice->getRootDeviceEnvironmentRef(), false, false);
size_t expectedSize = sizeof(typename FamilyType::XY_BLOCK_COPY_BLT);
expectedSize += NEO::BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize();
expectedSize += NEO::BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(isFlushBetweenBlitsRequired);
expectedSize += NEO::BlitCommandsHelper<FamilyType>::estimatePreBlitCommandSize();
EXPECT_EQ(expectedSize, totalSize);
}

View File

@@ -431,7 +431,7 @@ HWTEST2_F(BlitTests, givenDisabledGlobalCacheInvalidationWhenProgrammingGlobalSe
}
HWTEST2_F(BlitTests, givenBcsCommandsHelperWhenMiArbCheckWaRequiredThenReturnTrue, IsXeHPOrAbove) {
EXPECT_TRUE(BlitCommandsHelper<FamilyType>::miArbCheckWaRequired());
EXPECT_TRUE(this->getHelper<ProductHelper>().isFlushBetweenBlitsRequired());
}
HWTEST2_F(BlitTests, givenDebugVariableWhenDispatchBlitCommandsForImageRegionIsCalledThenCmdDetailsArePrintedToStdOutput, IsXeHPOrAbove) {