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

@@ -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());