wa: add dummy blits before command MI_ARB_CHECK

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

Related-To: NEO-7450

Signed-off-by: Cencelewska, Katarzyna <katarzyna.cencelewska@intel.com>
This commit is contained in:
Cencelewska, Katarzyna 2023-02-28 21:08:09 +00:00 committed by Compute-Runtime-Automation
parent 5dda2dba61
commit 50da32ffb1
49 changed files with 592 additions and 158 deletions

View File

@ -1026,7 +1026,10 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyBlit(uintptr_t
NEO::BlitPropertiesContainer blitPropertiesContainer{blitProperties};
NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(blitProperties, *commandContainer.getCommandStream(), *device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]);
auto &rootDeviceEnvironment = device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()];
NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(blitProperties, *commandContainer.getCommandStream(), *rootDeviceEnvironment);
auto dummyAllocation = rootDeviceEnvironment->getDummyAllocation();
commandContainer.addToResidencyContainer(dummyAllocation);
return ZE_RESULT_SUCCESS;
}
@ -1069,12 +1072,16 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyBlitRegion(NEO
NEO::BlitPropertiesContainer blitPropertiesContainer{blitProperties};
appendEventForProfiling(signalEvent, true);
bool copyRegionPreferred = NEO::BlitCommandsHelper<GfxFamily>::isCopyRegionPreferred(copySizeModified, *device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()], blitProperties.isSystemMemoryPoolUsed);
auto &rootDeviceEnvironment = device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()];
bool copyRegionPreferred = NEO::BlitCommandsHelper<GfxFamily>::isCopyRegionPreferred(copySizeModified, *rootDeviceEnvironment, blitProperties.isSystemMemoryPoolUsed);
if (copyRegionPreferred) {
NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferRegion(blitProperties, *commandContainer.getCommandStream(), *device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]);
NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferRegion(blitProperties, *commandContainer.getCommandStream(), *rootDeviceEnvironment);
} else {
NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(blitProperties, *commandContainer.getCommandStream(), *device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]);
NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(blitProperties, *commandContainer.getCommandStream(), *rootDeviceEnvironment);
}
auto dummyAllocation = rootDeviceEnvironment->getDummyAllocation();
commandContainer.addToResidencyContainer(dummyAllocation);
appendSignalEventPostWalker(signalEvent);
return ZE_RESULT_SUCCESS;
}
@ -1101,7 +1108,11 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendCopyImageBlit(NEO::Graph
commandContainer.addToResidencyContainer(clearColorAllocation);
appendEventForProfiling(signalEvent, true);
NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(blitProperties, *commandContainer.getCommandStream(), *device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]);
auto &rootDeviceEnvironment = device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()];
NEO::BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(blitProperties, *commandContainer.getCommandStream(), *rootDeviceEnvironment);
auto dummyAllocation = rootDeviceEnvironment->getDummyAllocation();
commandContainer.addToResidencyContainer(dummyAllocation);
appendSignalEventPostWalker(signalEvent);
return ZE_RESULT_SUCCESS;
}

View File

@ -733,7 +733,8 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenEstimatingCommandsSizeThenCal
const uint32_t numberOfBlitOperations = 4;
auto baseSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() + sizeof(typename FamilyType::MI_BATCH_BUFFER_END);
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
@ -773,7 +774,8 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenDirectsubmissionEnabledEstima
const uint32_t numberOfBlitOperations = 4;
auto baseSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite() + sizeof(typename FamilyType::MI_BATCH_BUFFER_START);
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
@ -811,7 +813,8 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenEstimatingCommandsSizeForWrit
const Vec3<size_t> bltSize = {(3 * max2DBlitSize), 4, 2};
const size_t numberOfBlts = 3 * bltSize.y * bltSize.z;
const size_t numberOfBlitOperations = 4 * bltSize.y * bltSize.z;
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
@ -850,7 +853,8 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenDirectSubmissionEnabledEstima
const Vec3<size_t> bltSize = {(3 * max2DBlitSize), 4, 2};
const size_t numberOfBlts = 3 * bltSize.y * bltSize.z;
const size_t numberOfBlitOperations = 4 * bltSize.y * bltSize.z;
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
@ -885,7 +889,8 @@ HWTEST_F(BcsTests, givenBlitPropertiesContainerWhenDirectSubmissionEnabledEstima
}
HWTEST_F(BcsTests, givenTimestampPacketWriteRequestWhenEstimatingSizeForCommandsThenAddMiFlushDw) {
size_t expectedBaseSize = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t expectedBaseSize = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
expectedBaseSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
@ -907,7 +912,8 @@ HWTEST_F(BcsTests, givenTimestampPacketWriteRequestWhenEstimatingSizeForCommands
}
HWTEST_F(BcsTests, givenTimestampPacketWriteRequestWhenEstimatingSizeForCommandsWithProfilingThenAddMiFlushDw) {
size_t expectedBaseSize = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK) +
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t expectedBaseSize = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs) +
EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
@ -939,7 +945,8 @@ HWTEST_F(BcsTests, givenBltSizeAndCsrDependenciesWhenEstimatingCommandSizeThenAd
csrDependencies.timestampPacketContainer.push_back(&timestamp0);
csrDependencies.timestampPacketContainer.push_back(&timestamp1);
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
@ -961,7 +968,8 @@ HWTEST_F(BcsTests, givenBltSizeAndCsrDependenciesWhenEstimatingCommandSizeThenAd
HWTEST_F(BcsTests, givenImageAndBufferWhenEstimateBlitCommandSizeThenReturnCorrectCommandSize) {
for (auto isImage : {false, true}) {
auto expectedSize = sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
auto expectedSize = EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
expectedSize += isImage ? sizeof(typename FamilyType::XY_BLOCK_COPY_BLT) : sizeof(typename FamilyType::XY_COPY_BLT);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
@ -979,7 +987,6 @@ HWTEST_F(BcsTests, givenImageAndBufferWhenEstimateBlitCommandSizeThenReturnCorre
}
HWTEST_F(BcsTests, givenImageAndBufferBlitDirectionsWhenIsImageOperationIsCalledThenReturnCorrectValue) {
BlitProperties blitProperties{};
std::pair<bool, BlitterConstants::BlitDirection> params[] = {{false, BlitterConstants::BlitDirection::HostPtrToBuffer},
{false, BlitterConstants::BlitDirection::BufferToHostPtr},
@ -1065,7 +1072,21 @@ HWTEST_F(BcsTests, givenBltSizeWithLeftoverWhenDispatchedThenProgramAllRequiredC
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());
}
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);
@ -1203,6 +1224,7 @@ struct BcsDetaliedTests : public BcsTests,
using BcsDetaliedTestsWithParams = BcsDetaliedTests<std::tuple<BcsTestParam, BlitterConstants::BlitDirection>>;
HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenProgramAddresseForWriteReadBufferRect) {
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
static_cast<OsAgnosticMemoryManager *>(csr.getMemoryManager())->turnOnFakingBigAllocations();
@ -1296,7 +1318,21 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP
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());
}
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);
@ -1395,6 +1431,11 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP
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 miArbCheckCmd = genCmdCast<typename FamilyType::MI_ARB_CHECK *>(*(cmdIterator++));
EXPECT_NE(nullptr, miArbCheckCmd);
@ -1486,7 +1527,21 @@ HWTEST_P(BcsDetaliedTestsWithParams, givenBltSizeWithLeftoverWhenDispatchedThenP
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());
}
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

@ -37,7 +37,8 @@ using namespace NEO;
HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeThenAddAllRequiredCommands) {
constexpr auto max2DBlitSize = BlitterConstants::maxBlitWidth * BlitterConstants::maxBlitHeight;
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
@ -72,7 +73,8 @@ HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeThenAddAllRequiredComman
HWTEST_F(BcsTests, givenDebugCapabilityWhenEstimatingCommandSizeThenAddAllRequiredCommands) {
constexpr auto max2DBlitSize = BlitterConstants::maxBlitWidth * BlitterConstants::maxBlitHeight;
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
@ -101,7 +103,8 @@ HWTEST_F(BcsTests, givenDebugCapabilityWhenEstimatingCommandSizeThenAddAllRequir
HWTEST_F(BcsTests, givenBltSizeWhenEstimatingCommandSizeForReadBufferRectThenAddAllRequiredCommands) {
constexpr auto max2DBlitSize = BlitterConstants::maxBlitWidth * BlitterConstants::maxBlitHeight;
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
@ -136,7 +139,8 @@ HWTEST_F(BcsTests, givenBltWithBigCopySizeWhenEstimatingCommandSizeForReadBuffer
auto maxWidthToCopy = static_cast<size_t>(BlitCommandsHelper<FamilyType>::getMaxBlitWidth(rootDeviceEnvironment));
auto maxHeightToCopy = static_cast<size_t>(BlitCommandsHelper<FamilyType>::getMaxBlitHeight(rootDeviceEnvironment, false));
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + sizeof(typename FamilyType::MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{true, &(pDevice->getRootDeviceEnvironmentRef())};
size_t cmdsSizePerBlit = sizeof(typename FamilyType::XY_COPY_BLT) + EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(waArgs);
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
cmdsSizePerBlit += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
@ -501,7 +505,13 @@ HWTEST_F(BcsTests, givenInputAllocationsWhenBlitDispatchedThenMakeAllAllocations
EXPECT_TRUE(csr.isMadeResident(graphicsAllocation1));
EXPECT_TRUE(csr.isMadeResident(graphicsAllocation2));
EXPECT_TRUE(csr.isMadeResident(csr.getTagAllocation()));
EXPECT_TRUE(csr.isMadeResident(csr.getTagAllocation()));
EXPECT_EQ(1u, csr.makeSurfacePackNonResidentCalled);
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironmentRef();
if (getHelper<ProductHelper>().isDummyBlitWaRequired()) {
residentAllocationsNum++;
EXPECT_TRUE(csr.isMadeResident(rootDeviceEnvironment.getDummyAllocation()));
}
if (csr.clearColorAllocation) {
EXPECT_TRUE(csr.isMadeResident(csr.clearColorAllocation));
residentAllocationsNum++;
@ -561,6 +571,11 @@ HWTEST_F(BcsTests, givenFenceAllocationIsRequiredWhenBlitDispatchedThenMakeAllAl
EXPECT_TRUE(bcsCsr->isMadeResident(graphicsAllocation2));
EXPECT_TRUE(bcsCsr->isMadeResident(bcsCsr->getTagAllocation()));
EXPECT_TRUE(bcsCsr->isMadeResident(bcsCsr->globalFenceAllocation));
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironmentRef();
if (getHelper<ProductHelper>().isDummyBlitWaRequired()) {
EXPECT_TRUE(bcsCsr->isMadeResident(rootDeviceEnvironment.getDummyAllocation()));
residentAllocationsNum++;
}
if (bcsCsr->clearColorAllocation) {
EXPECT_TRUE(bcsCsr->isMadeResident(bcsCsr->clearColorAllocation));
residentAllocationsNum++;

View File

@ -7,6 +7,7 @@
#pragma once
#include "shared/source/helpers/timestamp_packet_container.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
@ -15,6 +16,7 @@
using namespace NEO;
struct BcsTests : public Test<ClDeviceFixture> {
void SetUp() override {
DebugManager.flags.ForceDummyBlitWa.set(-1);
Test<ClDeviceFixture>::SetUp();
context = std::make_unique<MockContext>(pClDevice);
}
@ -34,4 +36,5 @@ struct BcsTests : public Test<ClDeviceFixture> {
TimestampPacketContainer timestampPacketContainer;
CsrDependencies csrDependencies;
std::unique_ptr<MockContext> context;
DebugManagerStateRestore dbgRestore;
};

View File

@ -508,14 +508,9 @@ HWTEST_F(DeviceHwTest, givenGfxCoreHelperInputWhenInitializingCsrThenCreatePageT
localHwInfo.capabilityTable.ftrRenderCompressedBuffers = false;
localHwInfo.capabilityTable.ftrRenderCompressedImages = false;
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(3);
MockExecutionEnvironment executionEnvironment(&localHwInfo, true, 3u);
executionEnvironment.incRefInternal();
for (auto i = 0u; i < executionEnvironment.rootDeviceEnvironments.size(); i++) {
executionEnvironment.rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(&localHwInfo);
executionEnvironment.rootDeviceEnvironments[i]->initGmm();
}
executionEnvironment.initializeMemoryManager();
std::unique_ptr<MockDevice> device;
device.reset(MockDevice::createWithExecutionEnvironment<MockDevice>(&localHwInfo, &executionEnvironment, 0));
auto &csr0 = device->getUltCommandStreamReceiver<FamilyType>();

View File

@ -16,6 +16,7 @@
#include "shared/source/kernel/kernel_execution_type.h"
#include <list>
#include <optional>
namespace NEO {
enum class SlmPolicy;
@ -472,13 +473,37 @@ 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;
static void program(LinearStream &commandStream);
static void adjust(MI_ARB_CHECK &miArbCheck);
static void programWithWa(LinearStream &commandStream, std::optional<bool> preParserDisable, EncodeDummyBlitWaArgs &waArgs);
static size_t getCommandSizeWithWa(const EncodeDummyBlitWaArgs &waArgs);
protected:
static void program(LinearStream &commandStream, std::optional<bool> preParserDisable);
static size_t getCommandSize();
static void adjust(MI_ARB_CHECK &miArbCheck, std::optional<bool> preParserDisable);
};
template <typename GfxFamily>
struct EncodeWA {
static void encodeAdditionalPipelineSelect(LinearStream &stream, const PipelineSelectArgs &args, bool is3DPipeline,
const RootDeviceEnvironment &rootDeviceEnvironment, bool isRcs);
static size_t getAdditionalPipelineSelectSize(Device &device, bool isRcs);
static void addPipeControlPriorToNonPipelinedStateCommand(LinearStream &commandStream, PipeControlArgs args,
const RootDeviceEnvironment &rootDeviceEnvironment, bool isRcs);
static void setAdditionalPipeControlFlagsForNonPipelineStateCommand(PipeControlArgs &args);
static void addPipeControlBeforeStateBaseAddress(LinearStream &commandStream, const RootDeviceEnvironment &rootDeviceEnvironment, bool isRcs, bool dcFlushRequired);
static void adjustCompressionFormatForPlanarImage(uint32_t &compressionFormat, int plane);
};
template <typename GfxFamily>

View File

@ -15,6 +15,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#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/gfx_core_helper.h"
#include "shared/source/helpers/local_id_gen.h"
@ -978,17 +979,27 @@ template <typename Family>
inline size_t EncodeMemoryPrefetch<Family>::getSizeForMemoryPrefetch(size_t size, const RootDeviceEnvironment &rootDeviceEnvironment) { return 0u; }
template <typename Family>
void EncodeMiArbCheck<Family>::program(LinearStream &commandStream) {
void EncodeMiArbCheck<Family>::program(LinearStream &commandStream, std::optional<bool> preParserDisable) {
MI_ARB_CHECK cmd = Family::cmdInitArbCheck;
EncodeMiArbCheck<Family>::adjust(cmd);
EncodeMiArbCheck<Family>::adjust(cmd, preParserDisable);
auto miArbCheckStream = commandStream.getSpaceForCmd<MI_ARB_CHECK>();
*miArbCheckStream = cmd;
}
template <typename Family>
inline size_t EncodeMiArbCheck<Family>::getCommandSize() { return sizeof(MI_ARB_CHECK); }
size_t EncodeMiArbCheck<Family>::getCommandSize() { return sizeof(MI_ARB_CHECK); }
template <typename Family>
void EncodeMiArbCheck<Family>::programWithWa(LinearStream &commandStream, std::optional<bool> preParserDisable, EncodeDummyBlitWaArgs &waArgs) {
BlitCommandsHelper<Family>::dispatchDummyBlit(commandStream, waArgs);
EncodeMiArbCheck<Family>::program(commandStream, preParserDisable);
}
template <typename Family>
size_t EncodeMiArbCheck<Family>::getCommandSizeWithWa(const EncodeDummyBlitWaArgs &waArgs) {
return EncodeMiArbCheck<Family>::getCommandSize() + BlitCommandsHelper<Family>::getDummyBlitSize(waArgs);
}
template <typename Family>
inline void EncodeNoop<Family>::alignToCacheLine(LinearStream &commandStream) {

View File

@ -518,7 +518,7 @@ inline void EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(LinearStre
}
template <typename GfxFamily>
inline void EncodeWA<GfxFamily>::adjustCompressionFormatForPlanarImage(uint32_t &compressionFormat, GMM_YUV_PLANE_ENUM plane) {
inline void EncodeWA<GfxFamily>::adjustCompressionFormatForPlanarImage(uint32_t &compressionFormat, int plane) {
}
template <typename GfxFamily>
@ -577,7 +577,7 @@ inline void EncodeStoreMemory<Family>::programStoreDataImm(MI_STORE_DATA_IMM *cm
}
template <typename Family>
inline void EncodeMiArbCheck<Family>::adjust(MI_ARB_CHECK &miArbCheck) {
inline void EncodeMiArbCheck<Family>::adjust(MI_ARB_CHECK &miArbCheck, std::optional<bool> preParserDisable) {
}
template <typename Family>
@ -590,5 +590,4 @@ template <typename Family>
size_t EncodeDispatchKernel<Family>::additionalSizeRequiredDsh(uint32_t iddCount) {
return iddCount * sizeof(typename Family::INTERFACE_DESCRIPTOR_DATA);
}
} // namespace NEO

View File

@ -24,4 +24,14 @@ void EncodeWA<Family>::addPipeControlBeforeStateBaseAddress(LinearStream &comman
NEO::EncodeWA<Family>::addPipeControlPriorToNonPipelinedStateCommand(commandStream, args, rootDeviceEnvironment, isRcs);
}
template <>
inline void EncodeMiArbCheck<Family>::adjust(MI_ARB_CHECK &miArbCheck, std::optional<bool> preParserDisable) {
if (DebugManager.flags.ForcePreParserEnabledForMiArbCheck.get() != -1) {
preParserDisable = !DebugManager.flags.ForcePreParserEnabledForMiArbCheck.get();
}
if (preParserDisable.has_value()) {
miArbCheck.setPreParserDisable(preParserDisable.value());
}
}
} // namespace NEO

View File

@ -15,7 +15,6 @@
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/basic_math.h"
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/constants.h"
@ -769,7 +768,8 @@ inline void EncodeWA<Family>::addPipeControlPriorToNonPipelinedStateCommand(Line
}
template <typename Family>
void EncodeWA<Family>::adjustCompressionFormatForPlanarImage(uint32_t &compressionFormat, GMM_YUV_PLANE_ENUM plane) {
void EncodeWA<Family>::adjustCompressionFormatForPlanarImage(uint32_t &compressionFormat, int plane) {
static_assert(sizeof(plane) == sizeof(GMM_YUV_PLANE_ENUM));
if (plane == GMM_PLANE_Y) {
compressionFormat &= 0xf;
} else if ((plane == GMM_PLANE_U) || (plane == GMM_PLANE_V)) {
@ -798,13 +798,6 @@ inline void EncodeStoreMemory<Family>::programStoreDataImm(MI_STORE_DATA_IMM *cm
*cmdBuffer = storeDataImmediate;
}
template <typename Family>
inline void EncodeMiArbCheck<Family>::adjust(MI_ARB_CHECK &miArbCheck) {
if (DebugManager.flags.ForcePreParserEnabledForMiArbCheck.get() != -1) {
miArbCheck.setPreParserDisable(!DebugManager.flags.ForcePreParserEnabledForMiArbCheck.get());
}
}
template <typename Family>
inline void EncodeStoreMMIO<Family>::appendFlags(MI_STORE_REGISTER_MEM *storeRegMem, bool workloadPartition) {
storeRegMem->setMmioRemapEnable(true);
@ -818,5 +811,4 @@ template <typename Family>
size_t EncodeDispatchKernel<Family>::additionalSizeRequiredDsh(uint32_t iddCount) {
return 0u;
}
} // namespace NEO

View File

@ -61,19 +61,4 @@ struct EncodeSurfaceState {
static void appendParamsForImageFromBuffer(R_SURFACE_STATE *surfaceState);
};
template <typename GfxFamily>
struct EncodeWA {
static void encodeAdditionalPipelineSelect(LinearStream &stream, const PipelineSelectArgs &args, bool is3DPipeline,
const RootDeviceEnvironment &rootDeviceEnvironment, bool isRcs);
static size_t getAdditionalPipelineSelectSize(Device &device, bool isRcs);
static void addPipeControlPriorToNonPipelinedStateCommand(LinearStream &commandStream, PipeControlArgs args,
const RootDeviceEnvironment &rootDeviceEnvironment, bool isRcs);
static void setAdditionalPipeControlFlagsForNonPipelineStateCommand(PipeControlArgs &args);
static void addPipeControlBeforeStateBaseAddress(LinearStream &commandStream, const RootDeviceEnvironment &rootDeviceEnvironment, bool isRcs, bool dcFlushRequired);
static void adjustCompressionFormatForPlanarImage(uint32_t &compressionFormat, GMM_YUV_PLANE_ENUM plane);
};
} // namespace NEO

View File

@ -1181,8 +1181,9 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
auto lock = obtainUniqueOwnership();
bool blitterDirectSubmission = this->isBlitterDirectSubmissionEnabled();
auto debugPauseEnabled = PauseOnGpuProperties::featureEnabled(DebugManager.flags.PauseOnBlitCopy.get());
auto &rootDeviceEnvironment = this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex];
auto &commandStream = getCS(BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(blitPropertiesContainer, profilingEnabled, debugPauseEnabled, blitterDirectSubmission,
*this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex]));
*rootDeviceEnvironment));
auto commandStreamStart = commandStream.getUsed();
auto newTaskCount = taskCount + 1;
latestSentTaskCount = newTaskCount;
@ -1217,8 +1218,11 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
BlitCommandsHelper<GfxFamily>::encodeProfilingStartMmios(commandStream, *blitProperties.outputTimestampPacket);
}
BlitCommandsHelper<GfxFamily>::dispatchBlitCommands(blitProperties, commandStream, *this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex]);
BlitCommandsHelper<GfxFamily>::dispatchBlitCommands(blitProperties, commandStream, *rootDeviceEnvironment);
auto dummyAllocation = rootDeviceEnvironment->getDummyAllocation();
if (dummyAllocation) {
makeResident(*dummyAllocation);
}
if (blitProperties.outputTimestampPacket) {
if (profilingEnabled) {
MiFlushArgs args;

View File

@ -5,7 +5,7 @@
*
*/
#include "shared/source/command_container/encode_surface_state.h"
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_stream/command_stream_receiver_hw.h"
#include "shared/source/command_stream/device_command_stream.h"
#include "shared/source/helpers/gfx_core_helper.h"

View File

@ -523,3 +523,6 @@ DECLARE_DEBUG_VARIABLE(int32_t, SelectCmdListHeapAddressModel, -1, "-1: default,
DECLARE_DEBUG_VARIABLE(int32_t, EnableSetPair, -1, "Use SET_PAIR to pair two buffer objects behind the same file descriptor, -1: default, 0: disabled, 1: enabled")
/* Binary Cache */
DECLARE_DEBUG_VARIABLE(bool, BinaryCacheTrace, false, "enable cl_cache to produce .trace files with information about hash computation")
/* WORKAROUND FLAGS */
DECLARE_DEBUG_VARIABLE(int32_t, ForceDummyBlitWa, 0, "-1: default, 0: disabled, 1: enabled, Forces a workaround with dummy blits, driver adds an extra blit before command MI_ARB_CHECK on bcs")

View File

@ -20,7 +20,6 @@ void DebuggerL0Hw<GfxFamily>::captureStateBaseAddress(NEO::LinearStream &cmdStre
using MI_STORE_DATA_IMM = typename GfxFamily::MI_STORE_DATA_IMM;
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
using MI_ARB_CHECK = typename GfxFamily::MI_ARB_CHECK;
const auto gmmHelper = device->getGmmHelper();
const auto gpuAddress = gmmHelper->decanonize(sbaTrackingGpuVa.address);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -9,12 +9,12 @@ namespace NEO {
template <typename GfxFamily>
size_t DebuggerL0Hw<GfxFamily>::getSbaTrackingCommandsSize(size_t trackedAddressCount) {
if (singleAddressSpaceSbaTracking) {
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 * (sizeof(typename GfxFamily::MI_ARB_CHECK) + sizeof(typename GfxFamily::MI_BATCH_BUFFER_START)) +
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) +
3 * sizeof(typename GfxFamily::MI_STORE_DATA_IMM) +
sizeof(typename GfxFamily::MI_ARB_CHECK) +
EncodeMiArbCheck<GfxFamily>::getCommandSizeWithWa(waArgs) +
sizeof(typename GfxFamily::MI_BATCH_BUFFER_START));
}
return trackedAddressCount * NEO::EncodeStoreMemory<GfxFamily>::getStoreDataImmSize();
@ -25,7 +25,6 @@ void DebuggerL0Hw<GfxFamily>::programSbaTrackingCommandsSingleAddressSpace(NEO::
using MI_STORE_DATA_IMM = typename GfxFamily::MI_STORE_DATA_IMM;
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
using MI_ARB_CHECK = typename GfxFamily::MI_ARB_CHECK;
using MI_MATH_ALU_INST_INLINE = typename GfxFamily::MI_MATH_ALU_INST_INLINE;
using MI_NOOP = typename GfxFamily::MI_NOOP;
@ -58,12 +57,9 @@ void DebuggerL0Hw<GfxFamily>::programSbaTrackingCommandsSingleAddressSpace(NEO::
const auto cmdStreamCpuBase = reinterpret_cast<uint64_t>(cmdStream.getCpuBase());
auto bbLevel = useFirstLevelBB ? MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER_FIRST_LEVEL_BATCH : MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER_SECOND_LEVEL_BATCH;
EncodeDummyBlitWaArgs waArgs{false};
if (fieldOffsetAndValue.size()) {
auto arb = cmdStream.getSpaceForCmd<MI_ARB_CHECK>();
auto arbCmd = GfxFamily::cmdInitArbCheck;
arbCmd.setPreParserDisable(true);
*arb = arbCmd;
EncodeMiArbCheck<GfxFamily>::programWithWa(cmdStream, true, waArgs);
// Jump to SDI command that is modified
auto newBuffer = cmdStream.getSpaceForCmd<MI_BATCH_BUFFER_START>();
@ -91,10 +87,7 @@ void DebuggerL0Hw<GfxFamily>::programSbaTrackingCommandsSingleAddressSpace(NEO::
auto miStoreDataSettingSbaBufferAddress = cmdStream.getSpaceForCmd<MI_STORE_DATA_IMM>();
auto miStoreDataSettingSbaBufferAddress2 = cmdStream.getSpaceForCmd<MI_STORE_DATA_IMM>();
auto arb = cmdStream.getSpaceForCmd<MI_ARB_CHECK>();
auto arbCmd = GfxFamily::cmdInitArbCheck;
arbCmd.setPreParserDisable(true);
*arb = arbCmd;
EncodeMiArbCheck<GfxFamily>::programWithWa(cmdStream, true, waArgs);
// Jump to SDI command that is modified
auto newBuffer = cmdStream.getSpaceForCmd<MI_BATCH_BUFFER_START>();
@ -155,10 +148,7 @@ void DebuggerL0Hw<GfxFamily>::programSbaTrackingCommandsSingleAddressSpace(NEO::
bbCmd.setSecondLevelBatchBuffer(bbLevel);
*previousBuffer = bbCmd;
auto arbCmd = GfxFamily::cmdInitArbCheck;
auto arb = cmdStream.getSpaceForCmd<MI_ARB_CHECK>();
arbCmd.setPreParserDisable(false);
*arb = arbCmd;
EncodeMiArbCheck<GfxFamily>::programWithWa(cmdStream, false, waArgs);
}
}

View File

@ -40,6 +40,7 @@ extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executio
Device::Device(ExecutionEnvironment *executionEnvironment, const uint32_t rootDeviceIndex)
: executionEnvironment(executionEnvironment), rootDeviceIndex(rootDeviceIndex) {
this->executionEnvironment->incRefInternal();
this->executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setDummyBlitProperties(rootDeviceIndex);
if (DebugManager.flags.NumberOfRegularContextsPerEngine.get() > 1) {
this->numberOfRegularContextsPerEngine = static_cast<uint32_t>(DebugManager.flags.NumberOfRegularContextsPerEngine.get());

View File

@ -212,7 +212,8 @@ void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchStaticRelaxedOrderingSch
{
using MI_LOAD_REGISTER_IMM = typename GfxFamily::MI_LOAD_REGISTER_IMM;
*schedulerCmdStream.getSpaceForCmd<typename GfxFamily::MI_ARB_CHECK>() = GfxFamily::cmdInitArbCheck;
EncodeDummyBlitWaArgs waArgs{false};
EncodeMiArbCheck<GfxFamily>::programWithWa(schedulerCmdStream, std::nullopt, waArgs);
if (DebugManager.flags.DirectSubmissionRelaxedOrderingQueueSizeLimit.get() != -1) {
currentRelaxedOrderingQueueSize = static_cast<uint32_t>(DebugManager.flags.DirectSubmissionRelaxedOrderingQueueSizeLimit.get());

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -21,8 +21,8 @@ inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizePrefetchMitigati
template <typename GfxFamily, typename Dispatcher>
inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeDisablePrefetcher() {
using MI_ARB_CHECK = typename GfxFamily::MI_ARB_CHECK;
return sizeof(MI_ARB_CHECK);
EncodeDummyBlitWaArgs waArgs{false};
return EncodeMiArbCheck<GfxFamily>::getCommandSizeWithWa(waArgs);
}
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -11,16 +11,10 @@ namespace NEO {
template <typename GfxFamily, typename Dispatcher>
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchDisablePrefetcher(bool disable) {
using MI_ARB_CHECK = typename GfxFamily::MI_ARB_CHECK;
if (isDisablePrefetcherRequired) {
MI_ARB_CHECK arbCheck = GfxFamily::cmdInitArbCheck;
arbCheck.setPreParserDisable(disable);
EncodeMiArbCheck<GfxFamily>::adjust(arbCheck);
MI_ARB_CHECK *arbCheckSpace = ringCommandStream.getSpaceForCmd<MI_ARB_CHECK>();
*arbCheckSpace = arbCheck;
EncodeDummyBlitWaArgs waArgs{false};
EncodeMiArbCheck<GfxFamily>::programWithWa(ringCommandStream, disable, waArgs);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -11,16 +11,10 @@ namespace NEO {
template <typename GfxFamily, typename Dispatcher>
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchDisablePrefetcher(bool disable) {
using MI_ARB_CHECK = typename GfxFamily::MI_ARB_CHECK;
if (isDisablePrefetcherRequired) {
MI_ARB_CHECK arbCheck = GfxFamily::cmdInitArbCheck;
arbCheck.setPreFetchDisable(disable);
EncodeMiArbCheck<GfxFamily>::adjust(arbCheck);
MI_ARB_CHECK *arbCheckSpace = ringCommandStream.getSpaceForCmd<MI_ARB_CHECK>();
*arbCheckSpace = arbCheck;
EncodeDummyBlitWaArgs waArgs{false};
EncodeMiArbCheck<GfxFamily>::programWithWa(ringCommandStream, disable, waArgs);
}
}

View File

@ -67,8 +67,7 @@ struct StaticSchedulerSizeAndOffsetSection {
(2 * sizeof(MI_LOAD_REGISTER_IMM)) + EncodeMiPredicate<GfxFamily>::getCmdSize();
static constexpr uint64_t drainRequestSectionStart = tasksListLoopCheckSectionStart + tasksListLoopCheckSectionSize;
static constexpr uint64_t drainRequestSectionSize = sizeof(typename GfxFamily::MI_ARB_CHECK) + (2 * EncodeBatchBufferStartOrEnd<GfxFamily>::getCmdSizeConditionalDataRegBatchBufferStart());
static constexpr uint64_t drainRequestSectionSize = (2 * EncodeBatchBufferStartOrEnd<GfxFamily>::getCmdSizeConditionalDataRegBatchBufferStart());
static constexpr uint64_t schedulerLoopCheckSectionJumpStart = drainRequestSectionStart + drainRequestSectionSize;
static constexpr uint64_t schedulerLoopCheckSectionJumpSize = 2 * sizeof(MI_LOAD_REGISTER_REG) + sizeof(MI_BATCH_BUFFER_START);

View File

@ -25,6 +25,8 @@
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/memory_manager/memory_operations_handler.h"
#include "shared/source/os_interface/hw_info_config.h"
@ -195,6 +197,33 @@ bool RootDeviceEnvironment::isNumberOfCcsLimited() const {
return limitedNumberOfCcs;
}
void RootDeviceEnvironment::initDummyAllocation() {
std::call_once(isDummyAllocationInitialized, [this]() {
auto customDeleter = [this](GraphicsAllocation *dummyAllocation) {
this->executionEnvironment.memoryManager->freeGraphicsMemory(dummyAllocation);
};
auto dummyBlitAllocation = this->executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties(
*this->dummyBlitProperties.get());
this->dummyAllocation = GraphicsAllocationUniquePtrType(dummyBlitAllocation, customDeleter);
});
}
void RootDeviceEnvironment::setDummyBlitProperties(uint32_t rootDeviceIndex) {
size_t size = 4 * 4096u;
this->dummyBlitProperties = std::make_unique<AllocationProperties>(
rootDeviceIndex,
true,
size,
NEO::AllocationType::BUFFER,
false,
false,
systemMemoryBitfield);
}
GraphicsAllocation *RootDeviceEnvironment::getDummyAllocation() const {
return dummyAllocation.get();
}
template <typename HelperType>
HelperType &RootDeviceEnvironment::getHelper() const {
if constexpr (std::is_same_v<HelperType, CompilerProductHelper>) {

View File

@ -10,6 +10,7 @@
#include "shared/source/helpers/affinity_mask.h"
#include "shared/source/helpers/options.h"
#include <functional>
#include <memory>
#include <mutex>
@ -35,7 +36,9 @@ class ProductHelper;
class GfxCoreHelper;
class ApiGfxCoreHelper;
class CompilerProductHelper;
class GraphicsAllocation;
struct AllocationProperties;
struct HardwareInfo;
struct RootDeviceEnvironment {
@ -58,6 +61,8 @@ struct RootDeviceEnvironment {
void initGmm();
void initDebugger();
void initDebuggerL0(Device *neoDevice);
MOCKABLE_VIRTUAL void initDummyAllocation();
void setDummyBlitProperties(uint32_t rootDeviceIndex);
MOCKABLE_VIRTUAL void prepareForCleanup() const;
MOCKABLE_VIRTUAL bool initAilConfiguration();
@ -77,6 +82,7 @@ struct RootDeviceEnvironment {
template <typename HelperType>
HelperType &getHelper() const;
const ProductHelper &getProductHelper() const;
GraphicsAllocation *getDummyAllocation() const;
std::unique_ptr<SipKernel> sipKernels[static_cast<uint32_t>(SipKernelType::COUNT)];
std::unique_ptr<GmmHelper> gmmHelper;
@ -100,7 +106,12 @@ struct RootDeviceEnvironment {
AffinityMaskHelper deviceAffinityMask{true};
protected:
using GraphicsAllocationUniquePtrType = std::unique_ptr<GraphicsAllocation, std::function<void(GraphicsAllocation *)>>;
GraphicsAllocationUniquePtrType dummyAllocation = nullptr;
bool limitedNumberOfCcs = false;
std::once_flag isDummyAllocationInitialized;
std::unique_ptr<AllocationProperties> dummyBlitProperties;
private:
std::mutex mtx;

View File

@ -22,6 +22,7 @@ enum class DebugPauseState : uint32_t;
struct HardwareInfo;
struct RootDeviceEnvironment;
class ProductHelper;
struct EncodeDummyBlitWaArgs;
template <typename GfxFamily>
struct BlitCommandsHelper {
@ -32,8 +33,8 @@ struct BlitCommandsHelper {
static uint64_t getMaxBlitHeightOverride(const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed);
static void dispatchPreBlitCommand(LinearStream &linearStream, const ProductHelper &productHelper);
static size_t estimatePreBlitCommandSize();
static void dispatchPostBlitCommand(LinearStream &linearStream, const ProductHelper &productHelper);
static size_t estimatePostBlitCommandSize();
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,
bool profilingEnabled, bool isImage, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed);
static size_t estimateBlitCommandsSize(const BlitPropertiesContainer &blitPropertiesContainer, bool profilingEnabled,
@ -44,13 +45,16 @@ struct BlitCommandsHelper {
static uint64_t calculateBlitCommandSourceBaseAddress(const BlitProperties &blitProperties, uint64_t offset, uint64_t row, uint64_t slice);
static uint64_t calculateBlitCommandDestinationBaseAddressCopyRegion(const BlitProperties &blitProperties, size_t slice);
static uint64_t calculateBlitCommandSourceBaseAddressCopyRegion(const BlitProperties &blitProperties, size_t slice);
static void dispatchBlitCommands(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchBlitCommandsForBufferRegion(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchBlitCommandsForBufferPerRow(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchBlitCommandsForImageRegion(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchBlitCommands(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchBlitCommandsForBufferRegion(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchBlitCommandsForBufferPerRow(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchBlitCommandsForImageRegion(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchBlitMemoryColorFill(NEO::GraphicsAllocation *dstAlloc, uint64_t offset, uint32_t *pattern, size_t patternSize, LinearStream &linearStream, size_t size, const RootDeviceEnvironment &rootDeviceEnvironment);
template <size_t patternSize>
static void dispatchBlitMemoryFill(NEO::GraphicsAllocation *dstAlloc, uint64_t offset, uint32_t *pattern, LinearStream &linearStream, size_t size, const RootDeviceEnvironment &rootDeviceEnvironment, COLOR_DEPTH depth);
static void dispatchDummyBlit(LinearStream &linearStream, EncodeDummyBlitWaArgs &waArgs);
static size_t getDummyBlitSize(const EncodeDummyBlitWaArgs &waArgs);
static bool isDummyBlitWaNeeded(const EncodeDummyBlitWaArgs &waArgs);
template <typename T>
static void appendBlitCommandsForBuffer(const BlitProperties &blitProperties, T &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment);

View File

@ -58,12 +58,15 @@ size_t BlitCommandsHelper<GfxFamily>::estimatePreBlitCommandSize() {
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linearStream, const ProductHelper &productHelper) {
void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
MiFlushArgs args;
EncodeDummyBlitWaArgs waArgs{true, &rootDeviceEnvironment};
auto &productHelper = rootDeviceEnvironment.getProductHelper();
if (DebugManager.flags.PostBlitCommand.get() != BlitterConstants::PostBlitMode::Default) {
switch (DebugManager.flags.PostBlitCommand.get()) {
case BlitterConstants::PostBlitMode::MiArbCheck:
EncodeMiArbCheck<GfxFamily>::program(linearStream);
EncodeMiArbCheck<GfxFamily>::programWithWa(linearStream, std::nullopt, waArgs);
return;
case BlitterConstants::PostBlitMode::MiFlush:
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, productHelper);
@ -77,15 +80,16 @@ void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linear
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, productHelper);
}
EncodeMiArbCheck<GfxFamily>::program(linearStream);
EncodeMiArbCheck<GfxFamily>::programWithWa(linearStream, std::nullopt, waArgs);
}
template <typename GfxFamily>
size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize() {
size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize(const RootDeviceEnvironment &rootDeviceEnvironment) {
EncodeDummyBlitWaArgs waArgs{true, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
if (DebugManager.flags.PostBlitCommand.get() != BlitterConstants::PostBlitMode::Default) {
switch (DebugManager.flags.PostBlitCommand.get()) {
case BlitterConstants::PostBlitMode::MiArbCheck:
return EncodeMiArbCheck<GfxFamily>::getCommandSize();
return EncodeMiArbCheck<GfxFamily>::getCommandSizeWithWa(waArgs);
case BlitterConstants::PostBlitMode::MiFlush:
return EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite();
default:
@ -94,10 +98,10 @@ size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize() {
}
if (BlitCommandsHelper<GfxFamily>::miArbCheckWaRequired()) {
return (EncodeMiArbCheck<GfxFamily>::getCommandSize() + EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite());
return (EncodeMiArbCheck<GfxFamily>::getCommandSizeWithWa(waArgs) + EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite());
}
return EncodeMiArbCheck<GfxFamily>::getCommandSize();
return EncodeMiArbCheck<GfxFamily>::getCommandSizeWithWa(waArgs);
}
template <typename GfxFamily>
@ -123,7 +127,7 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandSize(const Vec3<size_t>
sizePerBlit = sizeof(typename GfxFamily::XY_COPY_BLT);
}
sizePerBlit += estimatePostBlitCommandSize();
sizePerBlit += estimatePostBlitCommandSize(rootDeviceEnvironment);
return TimestampPacketHelper::getRequiredCmdStreamSize<GfxFamily>(csrDependencies) +
TimestampPacketHelper::getRequiredCmdStreamSizeForMultiRootDeviceSyncNodesContainer<GfxFamily>(csrDependencies) +
(sizePerBlit * nBlits) +
@ -178,7 +182,7 @@ uint64_t BlitCommandsHelper<GfxFamily>::calculateBlitCommandSourceBaseAddress(co
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment) {
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
uint64_t width = 1;
uint64_t height = 1;
@ -224,7 +228,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
auto bltStream = linearStream.getSpaceForCmd<typename GfxFamily::XY_COPY_BLT>();
*bltStream = bltCmd;
dispatchPostBlitCommand(linearStream, productHelper);
dispatchPostBlitCommand(linearStream, rootDeviceEnvironment);
auto blitSize = width * height;
sizeToBlit -= blitSize;
@ -274,7 +278,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(NEO::GraphicsAllocati
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment) {
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
auto srcSlicePitch = static_cast<uint32_t>(blitProperties.srcSlicePitch);
@ -309,7 +313,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const Bli
auto cmd = linearStream.getSpaceForCmd<typename GfxFamily::XY_BLOCK_COPY_BLT>();
*cmd = bltCmd;
dispatchPostBlitCommand(linearStream, productHelper);
dispatchPostBlitCommand(linearStream, rootDeviceEnvironment);
}
}
@ -347,7 +351,7 @@ uint32_t BlitCommandsHelper<GfxFamily>::getAvailableBytesPerPixel(size_t copySiz
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommands(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment) {
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommands(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
if (blitProperties.isImageOperation()) {
dispatchBlitCommandsForImageRegion(blitProperties, linearStream, rootDeviceEnvironment);
} else {
@ -383,7 +387,7 @@ void BlitCommandsHelper<GfxFamily>::appendBlitCommandsMemCopy(const BlitProperti
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferRegion(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment) {
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferRegion(const BlitProperties &blitProperties, LinearStream &linearStream, RootDeviceEnvironment &rootDeviceEnvironment) {
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
const auto maxWidthToCopy = getMaxBlitWidth(rootDeviceEnvironment);
@ -417,7 +421,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferRegion(const Bl
auto cmd = linearStream.getSpaceForCmd<typename GfxFamily::XY_COPY_BLT>();
*cmd = bltCmd;
dispatchPostBlitCommand(linearStream, productHelper);
dispatchPostBlitCommand(linearStream, rootDeviceEnvironment);
srcAddress += width;
dstAddress += width;
@ -525,4 +529,5 @@ template <typename GfxFamily>
size_t BlitCommandsHelper<GfxFamily>::getWaCmdsSize(const BlitPropertiesContainer &blitPropertiesContainer) {
return 0;
}
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -101,4 +101,16 @@ void BlitCommandsHelper<GfxFamily>::appendClearColor(const BlitProperties &blitP
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::printImageBlitBlockCopyCommand(const typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const uint32_t sliceIndex) {}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchDummyBlit(LinearStream &linearStream, EncodeDummyBlitWaArgs &waArgs) {}
template <typename GfxFamily>
bool BlitCommandsHelper<GfxFamily>::isDummyBlitWaNeeded(const EncodeDummyBlitWaArgs &waArgs) {
return false;
}
template <typename GfxFamily>
size_t BlitCommandsHelper<GfxFamily>::getDummyBlitSize(const EncodeDummyBlitWaArgs &waArgs) {
return 0u;
}
} // namespace NEO

View File

@ -435,4 +435,48 @@ void BlitCommandsHelper<GfxFamily>::printImageBlitBlockCopyCommand(const typenam
printf("DestinationArrayIndex: %u\n\n", blitCmd.getDestinationArrayIndex());
}
template <typename GfxFamily>
bool BlitCommandsHelper<GfxFamily>::isDummyBlitWaNeeded(const EncodeDummyBlitWaArgs &waArgs) {
if (waArgs.isBcs) {
UNRECOVERABLE_IF(!waArgs.rootDeviceEnvironment);
if (DebugManager.flags.ForceDummyBlitWa.get() != -1) {
return DebugManager.flags.ForceDummyBlitWa.get();
}
auto &productHelper = waArgs.rootDeviceEnvironment->getProductHelper();
return productHelper.isDummyBlitWaRequired();
}
return false;
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchDummyBlit(LinearStream &linearStream, EncodeDummyBlitWaArgs &waArgs) {
using XY_COLOR_BLT = typename GfxFamily::XY_COLOR_BLT;
if (BlitCommandsHelper<GfxFamily>::isDummyBlitWaNeeded(waArgs)) {
auto blitCmd = GfxFamily::cmdInitXyColorBlt;
auto &rootDeviceEnvironment = waArgs.rootDeviceEnvironment;
rootDeviceEnvironment->initDummyAllocation();
auto dummyAllocation = rootDeviceEnvironment->getDummyAllocation();
blitCmd.setDestinationBaseAddress(dummyAllocation->getGpuAddress());
blitCmd.setColorDepth(COLOR_DEPTH::COLOR_DEPTH_64_BIT_COLOR);
blitCmd.setDestinationX2CoordinateRight(1u);
blitCmd.setDestinationY2CoordinateBottom(4u);
blitCmd.setDestinationPitch(static_cast<uint32_t>(MemoryConstants::pageSize));
appendTilingEnable(blitCmd);
appendBlitCommandsForFillBuffer(dummyAllocation, blitCmd, *rootDeviceEnvironment);
auto cmd = linearStream.getSpaceForCmd<XY_COLOR_BLT>();
*cmd = blitCmd;
}
}
template <typename GfxFamily>
size_t BlitCommandsHelper<GfxFamily>::getDummyBlitSize(const EncodeDummyBlitWaArgs &waArgs) {
if (BlitCommandsHelper<GfxFamily>::isDummyBlitWaNeeded(waArgs)) {
return sizeof(typename GfxFamily::XY_COLOR_BLT);
}
return 0u;
}
} // namespace NEO

View File

@ -40,7 +40,9 @@ void OsAgnosticMemoryManager::initialize(bool aubUsage) {
for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < gfxPartitions.size(); ++rootDeviceIndex) {
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
auto &gfxCoreHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHelper<GfxCoreHelper>();
this->enable64kbpages[rootDeviceIndex] = is64kbPagesEnabled(hwInfo);
this->localMemorySupported.push_back(gfxCoreHelper.getEnableLocalMemory(*hwInfo));
auto gpuAddressSpace = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo()->capabilityTable.gpuAddressSpace;
if (!getGfxPartition(rootDeviceIndex)->init(gpuAddressSpace, reservedCpuAddressRangeSize, rootDeviceIndex, gfxPartitions.size(), heapAssigner.apiAllowExternalHeapForSshAndDsh)) {
initialized = false;

View File

@ -53,9 +53,8 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get();
rootDeviceEnvironment.setHwInfoAndInitHelpers(hwInfoConst);
auto hardwareInfo = rootDeviceEnvironment.getMutableHardwareInfo();
*hardwareInfo = *hwInfoConst;
rootDeviceEnvironment.initHelpers();
if (DebugManager.flags.OverrideRevision.get() != -1) {
hardwareInfo->platform.usRevId = static_cast<unsigned short>(DebugManager.flags.OverrideRevision.get());

View File

@ -165,6 +165,7 @@ class ProductHelper {
virtual bool isBufferPoolAllocatorSupported() const = 0;
virtual uint64_t overridePatIndex(AllocationType allocationType, uint64_t patIndex) const = 0;
virtual bool isTlbFlushRequired() const = 0;
virtual bool isDummyBlitWaRequired() const = 0;
virtual bool getFrontEndPropertyScratchSizeSupport() const = 0;
virtual bool getFrontEndPropertyPrivateScratchSizeSupport() const = 0;
virtual bool getFrontEndPropertyComputeDispatchAllWalkerSupport() const = 0;

View File

@ -733,4 +733,9 @@ template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isCalculationForDisablingEuFusionWithDpasNeeded() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isDummyBlitWaRequired() const {
return false;
}
} // namespace NEO

View File

@ -125,6 +125,7 @@ class ProductHelperHw : public ProductHelper {
bool isBufferPoolAllocatorSupported() const override;
uint64_t overridePatIndex(AllocationType allocationType, uint64_t patIndex) const override;
bool isTlbFlushRequired() const override;
bool isDummyBlitWaRequired() const override;
bool getFrontEndPropertyScratchSizeSupport() const override;
bool getFrontEndPropertyPrivateScratchSizeSupport() const override;
bool getFrontEndPropertyComputeDispatchAllWalkerSupport() const override;

View File

@ -253,4 +253,8 @@ template <>
bool ProductHelperHw<gfxProduct>::isCalculationForDisablingEuFusionWithDpasNeeded() const {
return true;
}
template <>
bool ProductHelperHw<gfxProduct>::isDummyBlitWaRequired() const {
return true;
}
} // namespace NEO

View File

@ -139,4 +139,9 @@ int ProductHelperHw<gfxProduct>::getProductMaxPreferredSlmSize(const HardwareInf
return preferredEnumValue;
}
}
template <>
bool ProductHelperHw<gfxProduct>::isDummyBlitWaRequired() const {
return true;
}
} // namespace NEO

View File

@ -76,7 +76,6 @@ class MockDevice : public RootDevice {
using RootDevice::subdevices;
void setOSTime(OSTime *osTime);
void setDriverInfo(DriverInfo *driverInfo);
static bool createSingleDevice;
bool createDeviceImpl() override;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -13,8 +13,8 @@
namespace NEO {
struct MockRootDeviceEnvironment : public RootDeviceEnvironment {
using RootDeviceEnvironment::isDummyAllocationInitialized;
using RootDeviceEnvironment::RootDeviceEnvironment;
~MockRootDeviceEnvironment() override = default;
void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) override;

View File

@ -504,4 +504,5 @@ EnableMultipleRegularContextForBcs = -1
AppendAubStreamContextFlags = -1
DirectSubmissionRelaxedOrderingMinNumberOfClients = -1
UseDeprecatedClDeviceIpVersion = 0
ExperimentalCopyThroughLockWaitlistSizeThreshold= -1
ExperimentalCopyThroughLockWaitlistSizeThreshold= -1
ForceDummyBlitWa = 0

View File

@ -175,8 +175,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenDebugFlagSetWhenProgrammi
MI_ARB_CHECK buffer[2] = {};
LinearStream linearStream(buffer, sizeof(buffer));
MockExecutionEnvironment executionEnvironment{};
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
rootDeviceEnvironment.initGmm();
EncodeMiArbCheck<FamilyType>::program(linearStream);
EncodeDummyBlitWaArgs waArgs{};
EncodeMiArbCheck<FamilyType>::programWithWa(linearStream, false, waArgs);
if (value == 0) {
EXPECT_TRUE(buffer[0].getPreParserDisable());

View File

@ -147,19 +147,19 @@ HWTEST2_P(L0DebuggerBBlevelParameterizedTest, GivenNonZeroSbaAddressesWhenProgra
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, cmdStream.getCpuBase(), cmdStream.getUsed()));
size_t sizeExpected = sizeof(MI_ARB_CHECK) + sizeof(MI_BATCH_BUFFER_START);
size_t sizeExpected = EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{}) + sizeof(MI_BATCH_BUFFER_START);
for (int i = 0; i < 6; i++) {
sizeExpected += NEO::EncodeSetMMIO<FamilyType>::sizeIMM;
sizeExpected += NEO::EncodeMath<FamilyType>::streamCommandSize;
sizeExpected += 2 * sizeof(MI_STORE_REGISTER_MEM);
sizeExpected += 2 * sizeof(MI_STORE_DATA_IMM);
sizeExpected += sizeof(MI_ARB_CHECK);
sizeExpected += EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{});
sizeExpected += sizeof(MI_BATCH_BUFFER_START);
sizeExpected += sizeof(MI_STORE_DATA_IMM);
}
sizeExpected += sizeof(MI_ARB_CHECK) + sizeof(MI_BATCH_BUFFER_START);
sizeExpected += EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{}) + sizeof(MI_BATCH_BUFFER_START);
EXPECT_EQ(sizeExpected, cmdStream.getUsed());
@ -259,17 +259,17 @@ HWTEST2_P(L0DebuggerBBlevelParameterizedTest, GivenOneNonZeroSbaAddressesWhenPro
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, cmdStream.getCpuBase(), cmdStream.getUsed()));
size_t sizeExpected = sizeof(MI_ARB_CHECK) + sizeof(MI_BATCH_BUFFER_START);
size_t sizeExpected = EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{}) + sizeof(MI_BATCH_BUFFER_START);
sizeExpected += NEO::EncodeSetMMIO<FamilyType>::sizeIMM;
sizeExpected += NEO::EncodeMath<FamilyType>::streamCommandSize;
sizeExpected += 2 * sizeof(MI_STORE_REGISTER_MEM);
sizeExpected += 2 * sizeof(MI_STORE_DATA_IMM);
sizeExpected += sizeof(MI_ARB_CHECK);
sizeExpected += EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{});
sizeExpected += sizeof(MI_BATCH_BUFFER_START);
sizeExpected += sizeof(MI_STORE_DATA_IMM);
sizeExpected += sizeof(MI_ARB_CHECK) + sizeof(MI_BATCH_BUFFER_START);
sizeExpected += EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{}) + sizeof(MI_BATCH_BUFFER_START);
EXPECT_EQ(sizeExpected, cmdStream.getUsed());
EXPECT_EQ(sizeExpected, debugger->getSbaTrackingCommandsSize(1));

View File

@ -14,6 +14,7 @@
#include "shared/source/direct_submission/relaxed_ordering_helper.h"
#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/flush_stamp.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/register_offsets.h"
@ -1054,6 +1055,9 @@ struct DirectSubmissionRelaxedOrderingTests : public DirectSubmissionDispatchBuf
template <typename FamilyType>
bool verifyBbStart(typename FamilyType::MI_BATCH_BUFFER_START *cmd, uint64_t startAddress, bool indirect, bool predicate);
template <typename FamilyType>
bool verifyDummyBlt(typename FamilyType::XY_COLOR_BLT *cmd);
DebugManagerStateRestore restore;
FlushStampTracker flushStamp{true};
};
@ -1091,6 +1095,14 @@ bool DirectSubmissionRelaxedOrderingTests::verifyLrr(typename FamilyType::MI_LOA
return true;
}
template <typename FamilyType>
bool DirectSubmissionRelaxedOrderingTests::verifyDummyBlt(typename FamilyType::XY_COLOR_BLT *cmd) {
if (cmd->getDestinationX2CoordinateRight() == 1u && cmd->getDestinationY2CoordinateBottom() == 4u && cmd->getDestinationPitch() == static_cast<uint32_t>(MemoryConstants::pageSize)) {
return true;
}
return false;
}
template <typename FamilyType>
bool DirectSubmissionRelaxedOrderingTests::verifyIncrementOrDecrement(void *cmds, AluRegisters aluRegister, bool increment) {
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
@ -1305,6 +1317,7 @@ bool DirectSubmissionRelaxedOrderingTests::verifyStaticSchedulerProgramming(Grap
using MI_MATH_ALU_INST_INLINE = typename FamilyType::MI_MATH_ALU_INST_INLINE;
using MI_ARB_CHECK = typename FamilyType::MI_ARB_CHECK;
using MI_MATH = typename FamilyType::MI_MATH;
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
uint64_t schedulerStartGpuAddress = schedulerAllocation.getGpuAddress();
void *schedulerCmds = schedulerAllocation.getUnderlyingBuffer();
@ -1571,6 +1584,7 @@ bool DirectSubmissionRelaxedOrderingTests::verifyStaticSchedulerProgramming(Grap
}
// 5. Drain request section
auto arbCheck = reinterpret_cast<MI_ARB_CHECK *>(++lriCmd);
if (memcmp(arbCheck, &FamilyType::cmdInitArbCheck, sizeof(MI_ARB_CHECK)) != 0) {
return false;
@ -1665,7 +1679,6 @@ bool DirectSubmissionRelaxedOrderingTests::verifyDynamicSchedulerProgramming(Lin
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
using MI_MATH_ALU_INST_INLINE = typename FamilyType::MI_MATH_ALU_INST_INLINE;
using MI_MATH = typename FamilyType::MI_MATH;
using MI_ARB_CHECK = typename FamilyType::MI_ARB_CHECK;
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cs, offset);
@ -1798,7 +1811,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenNewNumberOfClientsWhenDispa
const uint64_t expectedQueueSizeValueVa = directSubmission.relaxedOrderingSchedulerAllocation->getGpuAddress() +
RelaxedOrderingHelper::StaticSchedulerSizeAndOffsetSection<FamilyType>::drainRequestSectionStart +
sizeof(typename FamilyType::MI_ARB_CHECK) +
EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{}) +
RelaxedOrderingHelper::getQueueSizeLimitValueOffset<FamilyType>();
auto findStaticSchedulerUpdate = [&](LinearStream &cs, size_t offset, uint32_t expectedQueueSize) {

View File

@ -1,10 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/direct_submission/dispatchers/blitter_dispatcher.h"
#include "shared/source/xe_hp_core/hw_cmds.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
@ -21,7 +22,7 @@ XE_HPC_CORETEST_F(DirectSubmissionTestXeHpcCore, givenXeHpcCoreWhenDispatchDisab
MockDirectSubmissionHw<FamilyType, Dispatcher> directSubmission(*pDevice->getDefaultEngine().commandStreamReceiver);
EXPECT_EQ(sizeof(MI_ARB_CHECK), directSubmission.getSizeDisablePrefetcher());
EXPECT_EQ(EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{}), directSubmission.getSizeDisablePrefetcher());
bool ret = directSubmission.allocateResources();
EXPECT_TRUE(ret);

View File

@ -5,6 +5,7 @@
*
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_container/encode_surface_state.h"
#include "shared/source/helpers/preamble.h"
#include "shared/test/common/mocks/mock_command_stream_receiver.h"

View File

@ -150,7 +150,7 @@ HWTEST_F(BlitTests, givenDebugVariablesWhenGettingMaxBlitSizeThenHonorUseProvide
}
HWTEST_F(BlitTests, givenDebugVariableWhenEstimatingPostBlitsCommandSizeThenReturnCorrectResult) {
const size_t arbCheckSize = sizeof(typename FamilyType::MI_ARB_CHECK);
size_t arbCheckSize = EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{true, const_cast<RootDeviceEnvironment *>(&(pDevice->getRootDeviceEnvironment()))});
DebugManagerStateRestore restore{};
@ -160,16 +160,16 @@ HWTEST_F(BlitTests, givenDebugVariableWhenEstimatingPostBlitsCommandSizeThenRetu
expectedDefaultSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
}
EXPECT_EQ(expectedDefaultSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
EXPECT_EQ(expectedDefaultSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(pDevice->getRootDeviceEnvironment()));
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::MiArbCheck);
EXPECT_EQ(arbCheckSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
EXPECT_EQ(arbCheckSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(pDevice->getRootDeviceEnvironment()));
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::MiFlush);
EXPECT_EQ(EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite(), BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
EXPECT_EQ(EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite(), BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(pDevice->getRootDeviceEnvironment()));
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::None);
EXPECT_EQ(0u, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
EXPECT_EQ(0u, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize(pDevice->getRootDeviceEnvironment()));
}
HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorrectCommands) {
@ -180,14 +180,15 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
LinearStream linearStream{streamBuffer, sizeof(streamBuffer)};
GenCmdList commands{};
size_t expectedDefaultSize = sizeof(MI_ARB_CHECK);
size_t expectedDefaultSize = EncodeMiArbCheck<FamilyType>::getCommandSizeWithWa(EncodeDummyBlitWaArgs{true, const_cast<RootDeviceEnvironment *>(&(pDevice->getRootDeviceEnvironment()))});
if (BlitCommandsHelper<FamilyType>::miArbCheckWaRequired()) {
expectedDefaultSize += EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
}
// -1: default
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, this->pDevice->getProductHelper());
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, pDevice->getRootDeviceEnvironmentRef());
EXPECT_EQ(expectedDefaultSize, linearStream.getUsed());
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
@ -209,7 +210,8 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer));
commands.clear();
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::MiArbCheck);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, this->pDevice->getProductHelper());
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, pDevice->getRootDeviceEnvironmentRef());
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
arbCheck = find<MI_ARB_CHECK *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), arbCheck);
@ -219,7 +221,8 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer));
commands.clear();
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::MiFlush);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, this->pDevice->getProductHelper());
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, pDevice->getRootDeviceEnvironmentRef());
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
auto miFlush = find<MI_FLUSH_DW *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), miFlush);
@ -229,7 +232,8 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer));
commands.clear();
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::None);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, this->pDevice->getProductHelper());
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, pDevice->getRootDeviceEnvironmentRef());
EXPECT_EQ(0u, linearStream.getUsed());
}

View File

@ -5,6 +5,7 @@
*
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/resource_info.h"
@ -12,7 +13,10 @@
#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"
#include "shared/source/os_interface/product_helper_hw.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/raii_hw_info_config.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_gmm.h"
#include "shared/test/common/mocks/mock_gmm_client_context.h"
#include "shared/test/common/mocks/mock_gmm_resource_info.h"
@ -1214,3 +1218,189 @@ HWTEST2_F(BlitTests, givenDebugVariableWhenDispatchBlitCommandsForImageRegionIsC
<< "DestinationArrayIndex: 1\n\n";
EXPECT_EQ(expectedOutput.str(), output);
}
template <PRODUCT_FAMILY gfxProduct>
class TestDummyBlitMockProductHelper : public ProductHelperHw<gfxProduct> {
public:
bool isDummyBlitWaRequired() const override {
return dummyBlitRequired;
}
uint32_t dummyBlitRequired = true;
};
HWTEST2_F(BlitTests, givenDispatchDummyBlitWhenDummyBlitWaRequiredThenColorBltProgrammedCorrectly, IsXeHPOrAbove) {
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
DebugManagerStateRestore dbgRestore;
DebugManager.flags.ForceDummyBlitWa.set(-1);
auto &rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment &>(pDevice->getRootDeviceEnvironmentRef());
RAIIProductHelperFactory<TestDummyBlitMockProductHelper<productFamily>> raii{
rootDeviceEnvironment};
auto &productHelper = *raii.mockProductHelper;
productHelper.dummyBlitRequired = true;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
size_t expectedSize = 0u;
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
EncodeDummyBlitWaArgs waArgsWhenDefault{};
auto val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenDefault);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenDefault);
EXPECT_EQ(0u, stream.getUsed());
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
EncodeDummyBlitWaArgs waArgsWhenNotBcs{false, &rootDeviceEnvironment};
val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenNotBcs);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenNotBcs);
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
EXPECT_EQ(0u, stream.getUsed());
EncodeDummyBlitWaArgs waArgsWhenBcs{true, &rootDeviceEnvironment};
expectedSize = sizeof(XY_COLOR_BLT);
val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenBcs);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenBcs);
EXPECT_NE(nullptr, rootDeviceEnvironment.getDummyAllocation());
EXPECT_EQ(expectedSize, stream.getUsed());
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
auto itor = find<XY_COLOR_BLT *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itor);
auto cmd = genCmdCast<XY_COLOR_BLT *>(*itor);
EXPECT_EQ(rootDeviceEnvironment.getDummyAllocation()->getGpuAddress(), cmd->getDestinationBaseAddress());
EXPECT_EQ(XY_COLOR_BLT::COLOR_DEPTH::COLOR_DEPTH_64_BIT_COLOR, cmd->getColorDepth());
EXPECT_EQ(1u, cmd->getDestinationX2CoordinateRight());
EXPECT_EQ(4u, cmd->getDestinationY2CoordinateBottom());
EXPECT_EQ(static_cast<uint32_t>(MemoryConstants::pageSize), cmd->getDestinationPitch());
EXPECT_EQ(XY_COLOR_BLT::DESTINATION_SURFACE_TYPE::DESTINATION_SURFACE_TYPE_2D, cmd->getDestinationSurfaceType());
}
HWTEST2_F(BlitTests, givenDispatchDummyBlitWhenForceDummyBlitWaSetThenColorBltProgrammedCorrectly, IsXeHPOrAbove) {
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
DebugManagerStateRestore dbgRestore;
DebugManager.flags.ForceDummyBlitWa.set(1);
auto &rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment &>(pDevice->getRootDeviceEnvironmentRef());
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
size_t expectedSize = 0u;
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
EncodeDummyBlitWaArgs waArgsWhenDefault{};
auto val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenDefault);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenDefault);
EXPECT_EQ(0u, stream.getUsed());
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
EncodeDummyBlitWaArgs waArgsWhenNotBcs{false, &rootDeviceEnvironment};
val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenNotBcs);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenNotBcs);
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
EXPECT_EQ(0u, stream.getUsed());
EncodeDummyBlitWaArgs waArgsWhenBcs{true, &rootDeviceEnvironment};
expectedSize = sizeof(XY_COLOR_BLT);
val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenBcs);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenBcs);
EXPECT_NE(nullptr, rootDeviceEnvironment.getDummyAllocation());
EXPECT_EQ(expectedSize, stream.getUsed());
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
auto itor = find<XY_COLOR_BLT *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itor);
auto cmd = genCmdCast<XY_COLOR_BLT *>(*itor);
EXPECT_EQ(rootDeviceEnvironment.getDummyAllocation()->getGpuAddress(), cmd->getDestinationBaseAddress());
EXPECT_EQ(XY_COLOR_BLT::COLOR_DEPTH::COLOR_DEPTH_64_BIT_COLOR, cmd->getColorDepth());
EXPECT_EQ(1u, cmd->getDestinationX2CoordinateRight());
EXPECT_EQ(4u, cmd->getDestinationY2CoordinateBottom());
EXPECT_EQ(static_cast<uint32_t>(MemoryConstants::pageSize), cmd->getDestinationPitch());
EXPECT_EQ(XY_COLOR_BLT::DESTINATION_SURFACE_TYPE::DESTINATION_SURFACE_TYPE_2D, cmd->getDestinationSurfaceType());
}
HWTEST2_F(BlitTests, givenDispatchDummyBlitWhenDummyBlitWaNotRequiredThenAdditionalCommandsAreNotProgrammed, IsXeHPOrAbove) {
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
DebugManagerStateRestore dbgRestore;
DebugManager.flags.ForceDummyBlitWa.set(-1);
auto &rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment &>(pDevice->getRootDeviceEnvironmentRef());
RAIIProductHelperFactory<TestDummyBlitMockProductHelper<productFamily>> raii{
rootDeviceEnvironment};
auto &productHelper = *raii.mockProductHelper;
productHelper.dummyBlitRequired = false;
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
size_t expectedSize = 0u;
EncodeDummyBlitWaArgs waArgsWhenDefault{};
auto val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenDefault);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenDefault);
EXPECT_EQ(expectedSize, stream.getUsed());
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
EncodeDummyBlitWaArgs waArgsWhenNotBcs{false, &rootDeviceEnvironment};
val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenNotBcs);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenNotBcs);
EXPECT_EQ(expectedSize, stream.getUsed());
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
EncodeDummyBlitWaArgs waArgsWhenBcs{true, &rootDeviceEnvironment};
val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenBcs);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenBcs);
EXPECT_EQ(expectedSize, stream.getUsed());
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
}
HWTEST2_F(BlitTests, givenDispatchDummyBlitWhenForceDummyBlitWaDisabledThenAdditionalCommandsAreNotProgrammed, IsXeHPOrAbove) {
using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT;
DebugManagerStateRestore dbgRestore;
DebugManager.flags.ForceDummyBlitWa.set(0);
auto &rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment &>(pDevice->getRootDeviceEnvironmentRef());
uint32_t streamBuffer[100] = {};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
size_t expectedSize = 0u;
EncodeDummyBlitWaArgs waArgsWhenDefault{};
auto val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenDefault);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenDefault);
EXPECT_EQ(expectedSize, stream.getUsed());
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
EncodeDummyBlitWaArgs waArgsWhenNotBcs{false, &rootDeviceEnvironment};
val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenNotBcs);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenNotBcs);
EXPECT_EQ(expectedSize, stream.getUsed());
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
EncodeDummyBlitWaArgs waArgsWhenBcs{true, &rootDeviceEnvironment};
val = BlitCommandsHelper<FamilyType>::getDummyBlitSize(waArgsWhenBcs);
EXPECT_EQ(expectedSize, val);
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenBcs);
EXPECT_EQ(expectedSize, stream.getUsed());
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
}

View File

@ -682,4 +682,8 @@ HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckingIsMultiContextResource
HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckingIsUnlockingLockedPtrNecessaryThenReturnFalse) {
EXPECT_FALSE(productHelper->isUnlockingLockedPtrNecessary(pInHwInfo));
}
HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckDummyBlitWaRequiredThenReturnFalse) {
EXPECT_FALSE(productHelper->isDummyBlitWaRequired());
}

View File

@ -25,6 +25,7 @@ using namespace NEO;
TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreNotExportedThenMemoryIsAllocatedAsNonSvmAllocation) {
MockDevice device{};
REQUIRE_SVM_OR_SKIP(&device);
device.injectMemoryManager(new MockMemoryManager());
MockSVMAllocsManager svmAllocsManager(device.getMemoryManager(), false);
WhiteBox<LinkerInput> emptyLinkerInput;
std::vector<uint8_t> initData;
@ -67,8 +68,8 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreNotExportedTh
TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreExportedThenMemoryIsAllocatedAsUsmDeviceAllocation) {
MockDevice device{};
REQUIRE_SVM_OR_SKIP(&device);
MockMemoryManager memoryManager;
MockSVMAllocsManager svmAllocsManager(&memoryManager, false);
device.injectMemoryManager(new MockMemoryManager());
MockSVMAllocsManager svmAllocsManager(device.getMemoryManager(), false);
WhiteBox<LinkerInput> linkerInputExportGlobalVariables;
WhiteBox<LinkerInput> linkerInputExportGlobalConstants;
linkerInputExportGlobalVariables.traits.exportsGlobalVariables = true;
@ -112,6 +113,7 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreExportedThenM
TEST(AllocateGlobalSurfaceTest, GivenNullSvmAllocsManagerWhenGlobalsAreExportedThenMemoryIsAllocatedAsNonSvmAllocation) {
MockDevice device{};
device.injectMemoryManager(new MockMemoryManager());
WhiteBox<LinkerInput> linkerInputExportGlobalVariables;
WhiteBox<LinkerInput> linkerInputExportGlobalConstants;
linkerInputExportGlobalVariables.traits.exportsGlobalVariables = true;
@ -233,6 +235,7 @@ TEST(AllocateGlobalSurfaceTest, GivenAllocationInLocalMemoryWhichRequiresBlitter
TEST(AllocateGlobalSurfaceTest, whenAllocatingGlobalSurfaceWithNonZeroZeroInitSizeThenTransferOnlyInitDataToAllocation) {
MockDevice device{};
WhiteBox<LinkerInput> emptyLinkerInput;
device.injectMemoryManager(new MockMemoryManager());
emptyLinkerInput.traits.exportsGlobalConstants = true;
std::vector<uint8_t> initData;
initData.resize(64, 7u);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -11,6 +11,7 @@ HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenSamplerStateWhenAdjustSamplerStat
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskedIfBlitterForImagesIsSupportedThenFalseIsReturned, IGFX_XE_HPG_CORE);
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskedIfTile64With3DSurfaceOnBCSIsSupportedThenTrueIsReturned, IGFX_XE_HPG_CORE);
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenIsSystolicModeConfigurabledThenFalseIsReturned, IGFX_XE_HPG_CORE);
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenCheckDummyBlitWaRequiredThenReturnFalse, IGFX_XE_HPG_CORE);
HWTEST_EXCLUDE_PRODUCT(CommandEncodeStatesTest, givenEventAddressWhenEncodeThenMocsFromGmmHelperIsSet, IGFX_XE_HPG_CORE);
HWTEST_EXCLUDE_PRODUCT(XeHPAndLaterPreemptionTests, GivenDebuggerUsedWhenProgrammingStateSipThenStateSipIsAdded, IGFX_XE_HPG_CORE);
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeCmdSizeWhenLargeGrfModeChangeIsRequiredThenSCMCommandSizeIsCalculated, IGFX_XE_HPG_CORE);

View File

@ -172,6 +172,11 @@ XE_HPG_CORETEST_F(ProductHelperTestXeHpgCore, givenProductHelperWhenCheckTimesta
EXPECT_FALSE(productHelper.isTimestampWaitSupportedForEvents());
}
XE_HPG_CORETEST_F(ProductHelperTestXeHpgCore, givenProductHelperWhenCheckDummyBlitWaRequiredThenReturnTrue) {
auto &productHelper = getHelper<ProductHelper>();
EXPECT_TRUE(productHelper.isDummyBlitWaRequired());
}
XE_HPG_CORETEST_F(GfxCoreHelperTestXeHpgCore, givenGfxCoreHelperWhenCheckTimestampWaitSupportForQueuesThenReturnFalse) {
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
EXPECT_FALSE(gfxCoreHelper.isTimestampWaitSupportedForQueues());