refactor: don't use global ProductHelper getter 11/n

Related-To: NEO-6853
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk 2023-01-25 19:28:09 +00:00 committed by Compute-Runtime-Automation
parent fb8c844e00
commit 27393c76ea
31 changed files with 177 additions and 138 deletions

View File

@ -1814,8 +1814,8 @@ void CommandListCoreFamily<gfxCoreFamily>::appendEventForProfilingCopyCommand(Ev
event->resetKernelCountAndPacketUsedCount();
} else {
NEO::MiFlushArgs args;
const auto &hwInfo = this->device->getHwInfo();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), 0, 0, args, hwInfo);
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), 0, 0, args, productHelper);
dispatchEventPostSyncOperation(event, Event::STATE_SIGNALED, true, false, false);
}
appendWriteKernelTimestamp(event, beforeWalker, false, false);
@ -1981,8 +1981,6 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnEvents(uint32_t nu
constexpr uint32_t eventStateClear = Event::State::STATE_CLEARED;
bool dcFlushRequired = false;
const auto &hwInfo = this->device->getHwInfo();
if (this->dcFlushSupport) {
for (uint32_t i = 0; i < numEvents; i++) {
auto event = Event::fromHandle(phEvent[i]);
@ -1992,7 +1990,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnEvents(uint32_t nu
if (dcFlushRequired) {
if (isCopyOnly()) {
NEO::MiFlushArgs args;
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), 0, 0, args, hwInfo);
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), 0, 0, args, productHelper);
} else {
NEO::PipeControlArgs args;
args.dcFlushEnable = true;
@ -2146,11 +2145,12 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWriteGlobalTimestamp(
NEO::MiFlushArgs args;
args.timeStampOperation = true;
args.commandWithPostSync = true;
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(),
reinterpret_cast<uint64_t>(dstptr),
0,
args,
hwInfo);
productHelper);
} else {
NEO::PipeControlArgs args;
@ -2508,7 +2508,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendBarrier(ze_event_handle_
if (isCopyOnly()) {
NEO::MiFlushArgs args;
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), 0, 0, args, this->device->getHwInfo());
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), 0, 0, args, productHelper);
} else {
appendComputeBarrierCommand();
}
@ -2675,8 +2676,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWriteToMemory(void *desc
if (isCopyOnly()) {
NEO::MiFlushArgs args;
args.commandWithPostSync = true;
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(*commandContainer.getCommandStream(), gpuAddress,
data, args, hwInfo);
data, args, productHelper);
} else {
NEO::MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation(
*commandContainer.getCommandStream(),
@ -2715,16 +2717,16 @@ CmdListEventOperation CommandListCoreFamily<gfxCoreFamily>::estimateEventPostSyn
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandListCoreFamily<gfxCoreFamily>::dispatchPostSyncCopy(uint64_t gpuAddress, uint32_t value, bool workloadPartition) {
const auto &hwInfo = this->device->getHwInfo();
NEO::MiFlushArgs miFlushArgs;
miFlushArgs.commandWithPostSync = true;
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(
*commandContainer.getCommandStream(),
gpuAddress,
value,
miFlushArgs,
hwInfo);
productHelper);
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@ -987,13 +987,12 @@ void CommandQueueHw<gfxCoreFamily>::dispatchTaskCountPostSyncByMiFlushDw(
uint64_t postSyncAddress = this->csr->getTagAllocation()->getGpuAddress();
TaskCountType postSyncData = this->csr->peekTaskCount() + 1;
const auto &hwInfo = this->device->getHwInfo();
NEO::MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = this->csr->isUsedNotifyEnableForPostSync();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(cmdStream, postSyncAddress, postSyncData, args, hwInfo);
const auto &productHelper = this->device->getProductHelper();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(cmdStream, postSyncAddress, postSyncData, args, productHelper);
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -47,7 +47,6 @@ ze_result_t CommandListCoreFamily<IGFX_XE_HPC_CORE>::appendMemoryPrefetch(const
}
auto gpuAlloc = allocData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
auto &hwInfo = device->getHwInfo();
commandContainer.addToResidencyContainer(gpuAlloc);
@ -55,7 +54,7 @@ ze_result_t CommandListCoreFamily<IGFX_XE_HPC_CORE>::appendMemoryPrefetch(const
NEO::LinearStream &cmdStream = *commandContainer.getCommandStream();
NEO::EncodeMemoryPrefetch<GfxFamily>::programMemoryPrefetch(cmdStream, *gpuAlloc, static_cast<uint32_t>(size), offset, hwInfo);
NEO::EncodeMemoryPrefetch<GfxFamily>::programMemoryPrefetch(cmdStream, *gpuAlloc, static_cast<uint32_t>(size), offset, device->getNEODevice()->getRootDeviceEnvironment());
return ZE_RESULT_SUCCESS;
}

View File

@ -136,7 +136,7 @@ size_t EnqueueOperation<GfxFamily>::getSizeRequiredCSKernel(bool reserveProfilin
size_t size = sizeof(typename GfxFamily::COMPUTE_WALKER) +
(MemorySynchronizationCommands<GfxFamily>::getSizeForSingleBarrier(false) * numBarriers) +
HardwareCommandsHelper<GfxFamily>::getSizeRequiredCS() +
EncodeMemoryPrefetch<GfxFamily>::getSizeForMemoryPrefetch(pKernel->getKernelInfo().heapInfo.KernelHeapSize, commandQueue.getDevice().getHardwareInfo());
EncodeMemoryPrefetch<GfxFamily>::getSizeForMemoryPrefetch(pKernel->getKernelInfo().heapInfo.KernelHeapSize, commandQueue.getDevice().getRootDeviceEnvironment());
auto devices = commandQueue.getGpgpuCommandStreamReceiver().getOsContext().getDeviceBitfield();
auto partitionWalker = ImplicitScalingHelper::isImplicitScalingEnabled(devices, true);
if (partitionWalker) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -87,7 +87,7 @@ inline void HardwareInterface<GfxFamily>::programWalker(
const auto &hwInfo = commandQueue.getDevice().getHardwareInfo();
if (auto kernelAllocation = kernelInfo.getGraphicsAllocation()) {
EncodeMemoryPrefetch<GfxFamily>::programMemoryPrefetch(commandStream, *kernelAllocation, kernelInfo.heapInfo.KernelHeapSize, 0, hwInfo);
EncodeMemoryPrefetch<GfxFamily>::programMemoryPrefetch(commandStream, *kernelAllocation, kernelInfo.heapInfo.KernelHeapSize, 0, commandQueue.getDevice().getRootDeviceEnvironment());
}
HardwareCommandsHelper<GfxFamily>::sendIndirectState(

View File

@ -1091,7 +1091,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeContr
auto baseSize = sizeof(typename FamilyType::COMPUTE_WALKER) +
(sizeof(typename FamilyType::PIPE_CONTROL) * numPipeControls) +
HardwareCommandsHelper<FamilyType>::getSizeRequiredCS() +
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getHardwareInfo());
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getRootDeviceEnvironment());
DispatchInfo dispatchInfo{};
dispatchInfo.setNumberOfWorkgroups({32, 1, 1});
@ -1149,7 +1149,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeContr
auto baseSize = sizeof(typename FamilyType::COMPUTE_WALKER) +
(sizeof(typename FamilyType::PIPE_CONTROL) * numPipeControls) +
HardwareCommandsHelper<FamilyType>::getSizeRequiredCS() +
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getHardwareInfo());
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getRootDeviceEnvironment());
DispatchInfo dispatchInfo{};
dispatchInfo.setNumberOfWorkgroups({32, 1, 1});
@ -1204,7 +1204,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, whenWalkerPart
auto baseSize = sizeof(typename FamilyType::COMPUTE_WALKER) +
(sizeof(typename FamilyType::PIPE_CONTROL) * numPipeControls) +
HardwareCommandsHelper<FamilyType>::getSizeRequiredCS() +
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getHardwareInfo());
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getRootDeviceEnvironment());
auto returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *cmdQ.get(), kernel->mockKernel, dispatchInfo);
EXPECT_EQ(returnedSize, baseSize);
@ -1221,7 +1221,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, whenPipeContro
auto baseSize = sizeof(typename FamilyType::COMPUTE_WALKER) +
(sizeof(typename FamilyType::PIPE_CONTROL) * numPipeControls) +
HardwareCommandsHelper<FamilyType>::getSizeRequiredCS() +
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getHardwareInfo());
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getRootDeviceEnvironment());
auto returnedSize = EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *cmdQ.get(), kernel->mockKernel, {});
EXPECT_EQ(returnedSize, baseSize);
@ -1239,7 +1239,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeContr
auto baseSize = sizeof(typename FamilyType::COMPUTE_WALKER) +
(sizeof(typename FamilyType::PIPE_CONTROL) * numPipeControls) +
HardwareCommandsHelper<FamilyType>::getSizeRequiredCS() +
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getHardwareInfo());
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getRootDeviceEnvironment());
WalkerPartition::WalkerPartitionArgs testArgs = {};
testArgs.initializeWparidRegister = true;
@ -1270,7 +1270,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, GivenPipeContr
auto baseSize = sizeof(typename FamilyType::COMPUTE_WALKER) +
(sizeof(typename FamilyType::PIPE_CONTROL) * numPipeControls) +
HardwareCommandsHelper<FamilyType>::getSizeRequiredCS() +
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getHardwareInfo());
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(kernel->kernelInfo.heapInfo.KernelHeapSize, device->getRootDeviceEnvironment());
WalkerPartition::WalkerPartitionArgs testArgs = {};
testArgs.initializeWparidRegister = true;

View File

@ -97,7 +97,7 @@ XE_HPC_CORETEST_F(MemoryPrefetchTestsXeHpcCore, givenPrefetchEnabledWhenEstimati
size_t expected = sizeof(typename FamilyType::COMPUTE_WALKER) +
(sizeof(typename FamilyType::PIPE_CONTROL) * numPipeControls) +
HardwareCommandsHelper<FamilyType>::getSizeRequiredCS() +
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(mockKernel->kernelInfo.heapInfo.KernelHeapSize, clDevice->getHardwareInfo());
EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(mockKernel->kernelInfo.heapInfo.KernelHeapSize, clDevice->getRootDeviceEnvironment());
EXPECT_EQ(expected, EnqueueOperation<FamilyType>::getSizeRequiredCS(CL_COMMAND_NDRANGE_KERNEL, false, false, *commandQueue, mockKernel->mockKernel, {}));
}

View File

@ -36,6 +36,7 @@ struct HardwareInfo;
struct KernelInfo;
struct StateComputeModeProperties;
struct KernelDescriptor;
class ProductHelper;
struct EncodeDispatchKernelArgs {
uint64_t eventAddress = 0ull;
@ -446,17 +447,17 @@ template <typename GfxFamily>
struct EncodeMiFlushDW {
using MI_FLUSH_DW = typename GfxFamily::MI_FLUSH_DW;
static void programMiFlushDw(LinearStream &commandStream, uint64_t immediateDataGpuAddress, uint64_t immediateData,
MiFlushArgs &args, const HardwareInfo &hwInfo);
MiFlushArgs &args, const ProductHelper &productHelper);
static void programMiFlushDwWA(LinearStream &commandStream);
static void appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const HardwareInfo &hwInfo);
static void appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper);
static size_t getMiFlushDwCmdSizeForDataWrite();
static size_t getMiFlushDwWaSize();
};
template <typename GfxFamily>
struct EncodeMemoryPrefetch {
static void programMemoryPrefetch(LinearStream &commandStream, const GraphicsAllocation &graphicsAllocation, uint32_t size, size_t offset, const HardwareInfo &hwInfo);
static size_t getSizeForMemoryPrefetch(size_t size, const HardwareInfo &hwInfo);
static void programMemoryPrefetch(LinearStream &commandStream, const GraphicsAllocation &graphicsAllocation, uint32_t size, size_t offset, const RootDeviceEnvironment &rootDeviceEnvironment);
static size_t getSizeForMemoryPrefetch(size_t size, const RootDeviceEnvironment &rootDeviceEnvironment);
};
template <typename GfxFamily>

View File

@ -943,7 +943,7 @@ void EncodeBatchBufferStartOrEnd<Family>::programBatchBufferEnd(CommandContainer
template <typename Family>
void EncodeMiFlushDW<Family>::programMiFlushDw(LinearStream &commandStream, uint64_t immediateDataGpuAddress, uint64_t immediateData,
MiFlushArgs &args, const HardwareInfo &hwInfo) {
MiFlushArgs &args, const ProductHelper &productHelper) {
programMiFlushDwWA(commandStream);
auto miFlushDwCmd = commandStream.getSpaceForCmd<MI_FLUSH_DW>();
@ -956,7 +956,7 @@ void EncodeMiFlushDW<Family>::programMiFlushDw(LinearStream &commandStream, uint
}
miFlush.setNotifyEnable(args.notifyEnable);
miFlush.setTlbInvalidate(args.tlbFlush);
appendMiFlushDw(&miFlush, hwInfo);
appendMiFlushDw(&miFlush, productHelper);
*miFlushDwCmd = miFlush;
}
@ -966,10 +966,10 @@ size_t EncodeMiFlushDW<Family>::getMiFlushDwCmdSizeForDataWrite() {
}
template <typename Family>
inline void EncodeMemoryPrefetch<Family>::programMemoryPrefetch(LinearStream &commandStream, const GraphicsAllocation &graphicsAllocation, uint32_t size, size_t offset, const HardwareInfo &hwInfo) {}
inline void EncodeMemoryPrefetch<Family>::programMemoryPrefetch(LinearStream &commandStream, const GraphicsAllocation &graphicsAllocation, uint32_t size, size_t offset, const RootDeviceEnvironment &rootDeviceEnvironment) {}
template <typename Family>
inline size_t EncodeMemoryPrefetch<Family>::getSizeForMemoryPrefetch(size_t size, const HardwareInfo &hwInfo) { return 0u; }
inline size_t EncodeMemoryPrefetch<Family>::getSizeForMemoryPrefetch(size_t size, const RootDeviceEnvironment &rootDeviceEnvironment) { return 0u; }
template <typename Family>
void EncodeMiArbCheck<Family>::program(LinearStream &commandStream) {

View File

@ -454,7 +454,7 @@ void EncodeL3State<Family>::encode(CommandContainer &container, bool enableSLM)
}
template <typename GfxFamily>
void EncodeMiFlushDW<GfxFamily>::appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const HardwareInfo &hwInfo) {}
void EncodeMiFlushDW<GfxFamily>::appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper) {}
template <typename GfxFamily>
void EncodeMiFlushDW<GfxFamily>::programMiFlushDwWA(LinearStream &commandStream) {}

View File

@ -618,7 +618,7 @@ inline void EncodeMediaInterfaceDescriptorLoad<Family>::encode(CommandContainer
}
template <typename Family>
void EncodeMiFlushDW<Family>::appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const HardwareInfo &hwInfo) {
void EncodeMiFlushDW<Family>::appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper) {
miFlushDwCmd->setFlushCcs(1);
miFlushDwCmd->setFlushLlc(1);
}

View File

@ -200,7 +200,8 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushBcsTask(LinearStream &c
args.commandWithPostSync = true;
args.notifyEnable = isUsedNotifyEnableForPostSync();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStreamTask, postSyncAddress, postSyncData, args, hwInfo);
auto &productHelper = this->peekRootDeviceEnvironment().template getHelper<ProductHelper>();
NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStreamTask, postSyncAddress, postSyncData, args, productHelper);
}
auto &commandStreamCSR = getCS(getRequiredCmdStreamSizeAligned(dispatchBcsFlags));
@ -1179,11 +1180,11 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
this->initializeResources();
this->initDirectSubmission();
const auto &hwInfo = this->peekHwInfo();
auto &productHelper = this->peekRootDeviceEnvironment().template getHelper<ProductHelper>();
if (PauseOnGpuProperties::pauseModeAllowed(DebugManager.flags.PauseOnBlitCopy.get(), taskCount, PauseOnGpuProperties::PauseMode::BeforeWorkload)) {
BlitCommandsHelper<GfxFamily>::dispatchDebugPauseCommands(commandStream, getDebugPauseStateGPUAddress(),
DebugPauseState::waitingForUserStartConfirmation,
DebugPauseState::hasUserStartConfirmation, hwInfo);
DebugPauseState::hasUserStartConfirmation, productHelper);
}
programEnginePrologue(commandStream);
@ -1211,14 +1212,16 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
if (blitProperties.outputTimestampPacket) {
if (profilingEnabled) {
MiFlushArgs args;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, 0llu, newTaskCount, args, hwInfo);
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, 0llu, newTaskCount, args, productHelper);
BlitCommandsHelper<GfxFamily>::encodeProfilingEndMmios(commandStream, *blitProperties.outputTimestampPacket);
} else {
auto timestampPacketGpuAddress = TimestampPacketHelper::getContextEndGpuAddress(*blitProperties.outputTimestampPacket);
MiFlushArgs args;
args.commandWithPostSync = true;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, timestampPacketGpuAddress, 0, args, hwInfo);
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, timestampPacketGpuAddress, 0, args, productHelper);
}
makeResident(*blitProperties.outputTimestampPacket->getBaseGraphicsAllocation());
}
@ -1235,7 +1238,7 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = isUsedNotifyEnableForPostSync();
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, blitProperties.multiRootDeviceEventSync->getGpuAddress() + blitProperties.multiRootDeviceEventSync->getContextEndOffset(), std::numeric_limits<uint64_t>::max(), args, hwInfo);
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, blitProperties.multiRootDeviceEventSync->getGpuAddress() + blitProperties.multiRootDeviceEventSync->getContextEndOffset(), std::numeric_limits<uint64_t>::max(), args, productHelper);
}
}
@ -1249,14 +1252,14 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = isUsedNotifyEnableForPostSync();
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, tagAllocation->getGpuAddress(), newTaskCount, args, hwInfo);
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, tagAllocation->getGpuAddress(), newTaskCount, args, productHelper);
MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(commandStream, tagAllocation->getGpuAddress(), false, peekHwInfo());
}
if (PauseOnGpuProperties::pauseModeAllowed(DebugManager.flags.PauseOnBlitCopy.get(), taskCount, PauseOnGpuProperties::PauseMode::AfterWorkload)) {
BlitCommandsHelper<GfxFamily>::dispatchDebugPauseCommands(commandStream, getDebugPauseStateGPUAddress(),
DebugPauseState::waitingForUserEndConfirmation,
DebugPauseState::hasUserEndConfirmation, hwInfo);
DebugPauseState::hasUserEndConfirmation, productHelper);
}
void *endingCmdPtr = nullptr;
@ -1322,11 +1325,11 @@ inline SubmissionStatus CommandStreamReceiverHw<GfxFamily>::flushMiFlushDW() {
auto &commandStream = getCS(EncodeMiFlushDW<GfxFamily>::getMiFlushDwCmdSizeForDataWrite());
auto commandStreamStart = commandStream.getUsed();
const auto &hwInfo = this->peekHwInfo();
MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = isUsedNotifyEnableForPostSync();
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, tagAllocation->getGpuAddress(), taskCount + 1, args, hwInfo);
auto &productHelper = this->peekRootDeviceEnvironment().template getHelper<ProductHelper>();
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, tagAllocation->getGpuAddress(), taskCount + 1, args, productHelper);
makeResident(*tagAllocation);

View File

@ -529,7 +529,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::stopRingBuffer() {
if (disableMonitorFence) {
TagData currentTagData = {};
getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, *hwInfo,
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment,
this->useNotifyForPostSync, this->partitionedMode, this->dcFlushRequired);
}
Dispatcher::dispatchStopCommandBuffer(ringCommandStream);
@ -604,7 +604,7 @@ inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchSwitchRingBufferS
if (disableMonitorFence) {
TagData currentTagData = {};
getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, *hwInfo,
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment,
this->useNotifyForPostSync, this->partitionedMode, this->dcFlushRequired);
}
Dispatcher::dispatchStartCommandBuffer(ringCommandStream, nextBufferGpuAddress);
@ -717,7 +717,7 @@ void *DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchWorkloadSection(BatchBu
if (!disableMonitorFence) {
TagData currentTagData = {};
getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, *hwInfo,
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment,
this->useNotifyForPostSync, this->partitionedMode, this->dcFlushRequired);
}

View File

@ -11,6 +11,7 @@
namespace NEO {
struct RootDeviceEnvironment;
class ProductHelper;
template <typename GfxFamily>
class BlitterDispatcher : public Dispatcher<GfxFamily> {
@ -21,14 +22,14 @@ class BlitterDispatcher : public Dispatcher<GfxFamily> {
static void dispatchMonitorFence(LinearStream &cmdBuffer,
uint64_t gpuAddress,
uint64_t immediateData,
const HardwareInfo &hwInfo,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool useNotifyEnable,
bool partitionedWorkload,
bool dcFlushRequired);
static size_t getSizeMonitorFence(const HardwareInfo &hwInfo);
static void dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address);
static void dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const HardwareInfo &hwInfo);
static void dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const ProductHelper &productHelper);
static size_t getSizeCacheFlush(const HardwareInfo &hwInfo);
static size_t getSizeTlbFlush();
static bool isMultiTileSynchronizationSupported() {

View File

@ -27,14 +27,15 @@ template <typename GfxFamily>
inline void BlitterDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmdBuffer,
uint64_t gpuAddress,
uint64_t immediateData,
const HardwareInfo &hwInfo,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool useNotifyEnable,
bool partitionedWorkload,
bool dcFlushRequired) {
MiFlushArgs args;
args.commandWithPostSync = true;
args.notifyEnable = useNotifyEnable;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(cmdBuffer, gpuAddress, immediateData, args, hwInfo);
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(cmdBuffer, gpuAddress, immediateData, args, productHelper);
}
template <typename GfxFamily>
@ -45,17 +46,17 @@ inline size_t BlitterDispatcher<GfxFamily>::getSizeMonitorFence(const HardwareIn
template <typename GfxFamily>
inline void BlitterDispatcher<GfxFamily>::dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address) {
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
dispatchTlbFlush(cmdBuffer, address, hwInfo);
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
dispatchTlbFlush(cmdBuffer, address, productHelper);
}
template <typename GfxFamily>
inline void BlitterDispatcher<GfxFamily>::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const HardwareInfo &hwInfo) {
inline void BlitterDispatcher<GfxFamily>::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const ProductHelper &productHelper) {
MiFlushArgs args;
args.tlbFlush = true;
args.commandWithPostSync = true;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(cmdBuffer, address, 0ull, args, hwInfo);
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(cmdBuffer, address, 0ull, args, productHelper);
}
template <typename GfxFamily>

View File

@ -11,6 +11,7 @@
namespace NEO {
struct RootDeviceEnvironment;
class ProductHelper;
template <typename GfxFamily>
class RenderDispatcher : public Dispatcher<GfxFamily> {
@ -21,14 +22,14 @@ class RenderDispatcher : public Dispatcher<GfxFamily> {
static void dispatchMonitorFence(LinearStream &cmdBuffer,
uint64_t gpuAddress,
uint64_t immediateData,
const HardwareInfo &hwInfo,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool useNotifyEnable,
bool partitionedWorkload,
bool dcFlushRequired);
static size_t getSizeMonitorFence(const HardwareInfo &hwInfo);
static void dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address);
static void dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const HardwareInfo &hwInfo);
static void dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const ProductHelper &productHelper);
static size_t getSizeCacheFlush(const HardwareInfo &hwInfo);
static size_t getSizeTlbFlush();
static bool isMultiTileSynchronizationSupported() {

View File

@ -28,7 +28,7 @@ template <typename GfxFamily>
inline void RenderDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmdBuffer,
uint64_t gpuAddress,
uint64_t immediateData,
const HardwareInfo &hwInfo,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool useNotifyEnable,
bool partitionedWorkload,
bool dcFlushRequired) {
@ -36,6 +36,8 @@ inline void RenderDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmdB
args.dcFlushEnable = dcFlushRequired;
args.workloadPartitionOffset = partitionedWorkload;
args.notifyEnable = useNotifyEnable;
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation(
cmdBuffer,
PostSyncMode::ImmediateData,
@ -56,7 +58,7 @@ inline void RenderDispatcher<GfxFamily>::dispatchCacheFlush(LinearStream &cmdBuf
}
template <typename GfxFamily>
inline void RenderDispatcher<GfxFamily>::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const HardwareInfo &hwInfo) {
inline void RenderDispatcher<GfxFamily>::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const ProductHelper &productHelper) {
PipeControlArgs args;
args.tlbInvalidation = true;
args.pipeControlFlushEnable = true;

View File

@ -179,7 +179,8 @@ void DrmDirectSubmission<GfxFamily, Dispatcher>::handleNewResourcesSubmission()
auto osContextLinux = static_cast<OsContextLinux *>(&this->osContext);
auto tlbFlushCounter = osContextLinux->peekTlbFlushCounter();
Dispatcher::dispatchTlbFlush(this->ringCommandStream, this->gpuVaForMiFlush, *this->hwInfo);
auto &productHelper = this->rootDeviceEnvironment.template getHelper<ProductHelper>();
Dispatcher::dispatchTlbFlush(this->ringCommandStream, this->gpuVaForMiFlush, productHelper);
osContextLinux->setTlbFlushed(tlbFlushCounter);
}
}

View File

@ -21,6 +21,7 @@ class TagNodeBase;
enum class DebugPauseState : uint32_t;
struct HardwareInfo;
struct RootDeviceEnvironment;
class ProductHelper;
template <typename GfxFamily>
struct BlitCommandsHelper {
@ -29,9 +30,9 @@ struct BlitCommandsHelper {
static uint64_t getMaxBlitWidthOverride(const RootDeviceEnvironment &rootDeviceEnvironment);
static uint64_t getMaxBlitHeight(const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed);
static uint64_t getMaxBlitHeightOverride(const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed);
static void dispatchPreBlitCommand(LinearStream &linearStream, const HardwareInfo &hwInfo);
static void dispatchPreBlitCommand(LinearStream &linearStream, const ProductHelper &productHelper);
static size_t estimatePreBlitCommandSize();
static void dispatchPostBlitCommand(LinearStream &linearStream, const HardwareInfo &hwInfo);
static void dispatchPostBlitCommand(LinearStream &linearStream, const ProductHelper &productHelper);
static size_t estimatePostBlitCommandSize();
static size_t estimateBlitCommandSize(const Vec3<size_t> &copySize, const CsrDependencies &csrDependencies, bool updateTimestampPacket,
bool profilingEnabled, bool isImage, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed);
@ -70,7 +71,7 @@ struct BlitCommandsHelper {
uint32_t &mipTailLod, uint32_t &compressionDetails, uint32_t &compressionType,
const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane);
static void dispatchDebugPauseCommands(LinearStream &commandStream, uint64_t debugPauseStateGPUAddress, DebugPauseState confirmationTrigger,
DebugPauseState waitCondition, const HardwareInfo &hwInfo);
DebugPauseState waitCondition, const ProductHelper &productHelper);
static size_t getSizeForDebugPauseCommands();
static uint32_t getAvailableBytesPerPixel(size_t copySize, uint32_t srcOrigin, uint32_t dstOrigin, size_t srcSize, size_t dstSize);
static bool isCopyRegionPreferred(const Vec3<size_t> &copySize, const RootDeviceEnvironment &rootDeviceEnvironment, bool isSystemMemoryPoolUsed);

View File

@ -43,10 +43,10 @@ uint64_t BlitCommandsHelper<GfxFamily>::getMaxBlitHeight(const RootDeviceEnviron
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchPreBlitCommand(LinearStream &linearStream, const HardwareInfo &hwInfo) {
void BlitCommandsHelper<GfxFamily>::dispatchPreBlitCommand(LinearStream &linearStream, const ProductHelper &productHelper) {
if (BlitCommandsHelper<GfxFamily>::preBlitCommandWARequired()) {
MiFlushArgs args;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, hwInfo);
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, productHelper);
}
}
@ -60,7 +60,7 @@ size_t BlitCommandsHelper<GfxFamily>::estimatePreBlitCommandSize() {
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linearStream, const HardwareInfo &hwInfo) {
void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linearStream, const ProductHelper &productHelper) {
MiFlushArgs args;
if (DebugManager.flags.PostBlitCommand.get() != BlitterConstants::PostBlitMode::Default) {
switch (DebugManager.flags.PostBlitCommand.get()) {
@ -68,7 +68,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linear
EncodeMiArbCheck<GfxFamily>::program(linearStream);
return;
case BlitterConstants::PostBlitMode::MiFlush:
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, hwInfo);
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, productHelper);
return;
default:
return;
@ -76,7 +76,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linear
}
if (BlitCommandsHelper<GfxFamily>::miArbCheckWaRequired()) {
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, hwInfo);
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, args, productHelper);
}
EncodeMiArbCheck<GfxFamily>::program(linearStream);
@ -187,8 +187,8 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
PRINT_DEBUG_STRING(DebugManager.flags.PrintBlitDispatchDetails.get(), stdout,
"\nBlit dispatch with AuxTranslationDirection %u ", static_cast<uint32_t>(blitProperties.auxTranslationDirection));
const auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
dispatchPreBlitCommand(linearStream, hwInfo);
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
dispatchPreBlitCommand(linearStream, productHelper);
auto bltCmd = GfxFamily::cmdInitXyCopyBlt;
appendColorDepth(blitProperties, bltCmd);
@ -226,7 +226,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferPerRow(const Bl
auto bltStream = linearStream.getSpaceForCmd<typename GfxFamily::XY_COPY_BLT>();
*bltStream = bltCmd;
dispatchPostBlitCommand(linearStream, hwInfo);
dispatchPostBlitCommand(linearStream, productHelper);
auto blitSize = width * height;
sizeToBlit -= blitSize;
@ -277,6 +277,8 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(NEO::GraphicsAllocati
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment) {
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
auto srcSlicePitch = static_cast<uint32_t>(blitProperties.srcSlicePitch);
auto dstSlicePitch = static_cast<uint32_t>(blitProperties.dstSlicePitch);
@ -294,12 +296,12 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const Bli
bltCmd.setSourceX1CoordinateLeft(static_cast<uint32_t>(blitProperties.srcOffset.x));
bltCmd.setSourceY1CoordinateTop(static_cast<uint32_t>(blitProperties.srcOffset.y));
const auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
appendBlitCommandsBlockCopy(blitProperties, bltCmd, rootDeviceEnvironment);
appendBlitCommandsForImages(blitProperties, bltCmd, rootDeviceEnvironment, srcSlicePitch, dstSlicePitch);
appendColorDepth(blitProperties, bltCmd);
appendSurfaceType(blitProperties, bltCmd);
dispatchPreBlitCommand(linearStream, hwInfo);
dispatchPreBlitCommand(linearStream, productHelper);
for (uint32_t i = 0; i < blitProperties.copySize.z; i++) {
appendSliceOffsets(blitProperties, bltCmd, i, rootDeviceEnvironment, srcSlicePitch, dstSlicePitch);
@ -309,20 +311,20 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const Bli
auto cmd = linearStream.getSpaceForCmd<typename GfxFamily::XY_BLOCK_COPY_BLT>();
*cmd = bltCmd;
dispatchPostBlitCommand(linearStream, hwInfo);
dispatchPostBlitCommand(linearStream, productHelper);
}
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchDebugPauseCommands(LinearStream &commandStream, uint64_t debugPauseStateGPUAddress,
DebugPauseState confirmationTrigger, DebugPauseState waitCondition,
const HardwareInfo &hwInfo) {
const ProductHelper &productHelper) {
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
MiFlushArgs args;
args.commandWithPostSync = true;
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(commandStream, debugPauseStateGPUAddress, static_cast<uint32_t>(confirmationTrigger),
args, hwInfo);
args, productHelper);
EncodeSempahore<GfxFamily>::addMiSemaphoreWaitCommand(commandStream, debugPauseStateGPUAddress, static_cast<uint32_t>(waitCondition), MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD);
}
@ -384,11 +386,12 @@ void BlitCommandsHelper<GfxFamily>::appendBlitCommandsMemCopy(const BlitProperti
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferRegion(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment) {
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
const auto maxWidthToCopy = getMaxBlitWidth(rootDeviceEnvironment);
const auto maxHeightToCopy = getMaxBlitHeight(rootDeviceEnvironment, blitProperties.isSystemMemoryPoolUsed);
const auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
dispatchPreBlitCommand(linearStream, hwInfo);
dispatchPreBlitCommand(linearStream, productHelper);
auto bltCmd = GfxFamily::cmdInitXyCopyBlt;
bltCmd.setSourcePitch(static_cast<uint32_t>(blitProperties.srcRowPitch));
@ -416,7 +419,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBufferRegion(const Bl
auto cmd = linearStream.getSpaceForCmd<typename GfxFamily::XY_COPY_BLT>();
*cmd = bltCmd;
dispatchPostBlitCommand(linearStream, hwInfo);
dispatchPostBlitCommand(linearStream, productHelper);
srcAddress += width;
dstAddress += width;

View File

@ -132,11 +132,14 @@ void EncodeComputeMode<Family>::programComputeModeCommand(LinearStream &csr, Sta
}
template <>
void EncodeMemoryPrefetch<Family>::programMemoryPrefetch(LinearStream &commandStream, const GraphicsAllocation &graphicsAllocation, uint32_t size, size_t offset, const HardwareInfo &hwInfo) {
void EncodeMemoryPrefetch<Family>::programMemoryPrefetch(LinearStream &commandStream, const GraphicsAllocation &graphicsAllocation, uint32_t size, size_t offset, const RootDeviceEnvironment &rootDeviceEnvironment) {
using STATE_PREFETCH = typename Family::STATE_PREFETCH;
constexpr uint32_t mocsIndexForL3 = (2 << 1);
bool prefetch = ProductHelper::get(hwInfo.platform.eProductFamily)->allowMemoryPrefetch(hwInfo);
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
bool prefetch = productHelper.allowMemoryPrefetch(hwInfo);
if (!prefetch) {
return;
@ -175,7 +178,7 @@ void EncodeMemoryPrefetch<Family>::programMemoryPrefetch(LinearStream &commandSt
}
template <>
size_t EncodeMemoryPrefetch<Family>::getSizeForMemoryPrefetch(size_t size, const HardwareInfo &hwInfo) {
size_t EncodeMemoryPrefetch<Family>::getSizeForMemoryPrefetch(size_t size, const RootDeviceEnvironment &rootDeviceEnvironment) {
if (DebugManager.flags.EnableMemoryPrefetch.get() == 0) {
return 0;
}
@ -187,7 +190,7 @@ size_t EncodeMemoryPrefetch<Family>::getSizeForMemoryPrefetch(size_t size, const
}
template <>
inline void EncodeMiFlushDW<Family>::appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const HardwareInfo &hwInfo) {
inline void EncodeMiFlushDW<Family>::appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd, const ProductHelper &productHelper) {
miFlushDwCmd->setFlushLlc(1);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -65,6 +65,7 @@ struct MockDirectSubmissionHw : public DirectSubmissionHw<GfxFamily, Dispatcher>
using BaseClass::ringBuffers;
using BaseClass::ringCommandStream;
using BaseClass::ringStart;
using BaseClass::rootDeviceEnvironment;
using BaseClass::semaphoreData;
using BaseClass::semaphoreGpuVa;
using BaseClass::semaphorePtr;

View File

@ -51,10 +51,12 @@ 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;
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, gpuAddress, immData, args, *defaultHwInfo);
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, gpuAddress, immData, args, productHelper);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
unsigned int sizeMultiplier = 1;
@ -83,25 +85,29 @@ 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, *defaultHwInfo);
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, setGpuAddress, 0, args, productHelper);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
EXPECT_EQ(verifyGpuAddress, miFlushDwCmd->getDestinationAddress());
}
HWTEST_F(CommandEncoderTests, whenEncodeMemoryPrefetchCalledThenDoNothing) {
MockExecutionEnvironment mockExecutionEnvironment{};
uint8_t buffer[MemoryConstants::pageSize] = {};
LinearStream linearStream(buffer, sizeof(buffer));
GraphicsAllocation allocation(0, AllocationType::UNKNOWN, nullptr, 123, 456, 789, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 2, 0, *defaultHwInfo);
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 2, 0, *mockExecutionEnvironment.rootDeviceEnvironments[0]);
EXPECT_EQ(0u, linearStream.getUsed());
EXPECT_EQ(0u, EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(2, *defaultHwInfo));
EXPECT_EQ(0u, EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(2, *mockExecutionEnvironment.rootDeviceEnvironments[0]));
}
HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncoderTests, WhenAnyParameterIsProvidedThenRuntimeGenerationLocalIdsIsRequired) {
@ -122,11 +128,12 @@ 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, *defaultHwInfo);
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, gpuAddress, immData, args, productHelper);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
unsigned int sizeMultiplier = 1;

View File

@ -500,7 +500,7 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionWhenDispatchTagUpdateSection
bool ret = directSubmission.initialize(false, false);
EXPECT_TRUE(ret);
Dispatcher::dispatchMonitorFence(directSubmission.ringCommandStream, 0ull, 0ull, *directSubmission.hwInfo, false, false, directSubmission.dcFlushRequired);
Dispatcher::dispatchMonitorFence(directSubmission.ringCommandStream, 0ull, 0ull, directSubmission.rootDeviceEnvironment, false, false, directSubmission.dcFlushRequired);
EXPECT_NE(0x0u, directSubmission.ringCommandStream.getUsed());
EXPECT_EQ(Dispatcher::getSizeMonitorFence(*directSubmission.hwInfo), directSubmission.ringCommandStream.getUsed());
}

View File

@ -37,7 +37,7 @@ HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingMonitorFenceCmdThenDis
uint64_t expectedGpuAddress = 0x5100ull;
uint64_t expectedValue = 0x1234ull;
BlitterDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, expectedGpuAddress, expectedValue, pDevice->getHardwareInfo(), false, false, false);
BlitterDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, expectedGpuAddress, expectedValue, pDevice->getRootDeviceEnvironment(), false, false, false);
EXPECT_EQ(expectedSize, cmdBuffer.getUsed());
@ -78,7 +78,8 @@ HWTEST_F(BlitterDispatcheTest, givenBlitterWhenDispatchingTlbFlushThenDispatchMi
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
size_t expectedSize = EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite();
BlitterDispatcher<FamilyType>::dispatchTlbFlush(cmdBuffer, 0ull, *defaultHwInfo);
auto &productHelper = this->pDevice->getRootDeviceEnvironment().getHelper<ProductHelper>();
BlitterDispatcher<FamilyType>::dispatchTlbFlush(cmdBuffer, 0ull, productHelper);
EXPECT_EQ(expectedSize, cmdBuffer.getUsed());

View File

@ -64,7 +64,7 @@ HWTEST_F(RenderDispatcherTest, givenRenderWhenAddingMonitorFenceCmdThenExpectPip
uint64_t gpuVa = 0xFF00FF0000ull;
uint64_t value = 0x102030;
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, hardwareInfo, false, false, false);
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, this->pDevice->getRootDeviceEnvironment(), false, false, false);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer);
@ -126,7 +126,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, RenderDispatcherTest,
uint64_t gpuVa = 0xBADA550000ull;
uint64_t value = 0x102030;
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, hardwareInfo, false, true, false);
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, this->pDevice->getRootDeviceEnvironment(), false, true, false);
HardwareParse hwParse;
hwParse.parsePipeControl = true;
@ -159,7 +159,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, RenderDispatcherTest,
uint64_t gpuAddress = 0xADD35500ull;
uint64_t value = 0x102030;
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuAddress, value, hardwareInfo, true, false, false);
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuAddress, value, this->pDevice->getRootDeviceEnvironment(), true, false, false);
HardwareParse hwParse;
hwParse.parsePipeControl = true;
@ -187,7 +187,7 @@ HWTEST_F(RenderDispatcherTest, givenRenderWithDcFlushFlagTrueWhenAddingMonitorFe
uint64_t gpuVa = 0xFF00FF0000ull;
uint64_t value = 0x102030;
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, hardwareInfo, false, false, true);
RenderDispatcher<FamilyType>::dispatchMonitorFence(cmdBuffer, gpuVa, value, this->pDevice->getRootDeviceEnvironment(), false, false, true);
HardwareParse hwParse;
hwParse.parseCommands<FamilyType>(cmdBuffer);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -11,6 +11,7 @@
#include "shared/source/helpers/definitions/mi_flush_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"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/test_macros/hw_test.h"
@ -23,9 +24,10 @@ HWTEST_F(EncodeMiFlushDWTest, GivenLinearStreamWhenCllaedEncodeWithNoPostSyncThe
uint32_t pCmdBuffer[1024];
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, *defaultHwInfo);
EncodeMiFlushDW<FamilyType>::programMiFlushDw(stream, 0, 0, args, productHelper);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, stream.getCpuBase(), stream.getUsed());
@ -45,10 +47,11 @@ 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, *defaultHwInfo);
EncodeMiFlushDW<FamilyType>::programMiFlushDw(stream, address, data, args, productHelper);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, stream.getCpuBase(), stream.getUsed());
@ -77,10 +80,11 @@ 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, *defaultHwInfo);
EncodeMiFlushDW<FamilyType>::programMiFlushDw(stream, address, data, args, productHelper);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, stream.getCpuBase(), stream.getUsed());
@ -108,11 +112,12 @@ 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, *defaultHwInfo);
EncodeMiFlushDW<FamilyType>::programMiFlushDw(stream, address, data, args, productHelper);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, stream.getCpuBase(), stream.getUsed());

View File

@ -8,6 +8,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/helpers/definitions/mi_flush_args.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
using namespace NEO;
@ -18,10 +19,11 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterEncodeMiFlushDWTest, whenMiFlushDwIsPro
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
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, *defaultHwInfo);
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, 0x1230000, 456, args, productHelper);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
EXPECT_EQ(0u, miFlushDwCmd->getFlushCcs());
EXPECT_EQ(0u, miFlushDwCmd->getFlushLlc());

View File

@ -186,7 +186,7 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
}
// -1: default
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, *defaultHwInfo);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, this->pDevice->getProductHelper());
EXPECT_EQ(expectedDefaultSize, linearStream.getUsed());
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
@ -208,7 +208,7 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer));
commands.clear();
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::MiArbCheck);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, *defaultHwInfo);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, this->pDevice->getProductHelper());
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
arbCheck = find<MI_ARB_CHECK *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), arbCheck);
@ -218,7 +218,7 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer));
commands.clear();
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::MiFlush);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, *defaultHwInfo);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, this->pDevice->getProductHelper());
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
auto miFlush = find<MI_FLUSH_DW *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), miFlush);
@ -228,7 +228,7 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer));
commands.clear();
DebugManager.flags.PostBlitCommand.set(BlitterConstants::PostBlitMode::None);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, *defaultHwInfo);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream, this->pDevice->getProductHelper());
EXPECT_EQ(0u, linearStream.getUsed());
}
@ -658,7 +658,7 @@ HWTEST2_F(BlitTests, givenPlatformWhenCallingDispatchPreBlitCommandThenNoneMiFlu
auto miFlushBuffer = std::make_unique<MI_FLUSH_DW>();
LinearStream linearStream(miFlushBuffer.get(), EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite());
BlitCommandsHelper<FamilyType>::dispatchPreBlitCommand(linearStream, *defaultHwInfo);
BlitCommandsHelper<FamilyType>::dispatchPreBlitCommand(linearStream, this->pDevice->getProductHelper());
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(linearStream);

View File

@ -256,7 +256,7 @@ HWTEST2_F(BlitTests, givenGen12LpPlatformWhenDispatchPreBlitCommandThenMiFlushDw
auto miFlushBuffer = std::make_unique<MI_FLUSH_DW>();
LinearStream linearStream(miFlushBuffer.get(), EncodeMiFlushDW<FamilyType>::getMiFlushDwCmdSizeForDataWrite());
BlitCommandsHelper<FamilyType>::dispatchPreBlitCommand(linearStream, *defaultHwInfo);
BlitCommandsHelper<FamilyType>::dispatchPreBlitCommand(linearStream, this->pDevice->getProductHelper());
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(linearStream);

View File

@ -36,10 +36,11 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, whenMiFlushDwIsProgrammedThenSetAn
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
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, *defaultHwInfo);
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, 0x1230000, 456, args, productHelper);
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
EXPECT_EQ(0u, miFlushDwCmd->getFlushCcs());
EXPECT_EQ(1u, miFlushDwCmd->getFlushLlc());
@ -47,8 +48,9 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, whenMiFlushDwIsProgrammedThenSetAn
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenOffsetWhenProgrammingStatePrefetchThenSetCorrectGpuVa) {
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
MockExecutionEnvironment mockExecutionEnvironment{};
HardwareInfo hwInfo = *defaultHwInfo;
auto &hwInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
hwInfo.platform.usRevId = 0b0011'1000; // [3:5] - BaseDie != A0
uint8_t buffer[sizeof(STATE_PREFETCH) * 4] = {};
@ -65,7 +67,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenOffsetWhenProgrammingStatePre
uint32_t expectedCmdsCount = 3;
uint32_t alignedSize = MemoryConstants::pageSize64k * expectedCmdsCount;
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, alignedSize, gpuVaOffset, hwInfo);
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, alignedSize, gpuVaOffset, *mockExecutionEnvironment.rootDeviceEnvironments[0]);
EXPECT_EQ(sizeof(STATE_PREFETCH) * expectedCmdsCount, linearStream.getUsed());
for (uint32_t i = 0; i < expectedCmdsCount; i++) {
@ -76,8 +78,9 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenOffsetWhenProgrammingStatePre
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugVariableSetwhenProgramingStatePrefetchThenSetCorrectFields) {
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
MockExecutionEnvironment mockExecutionEnvironment{};
HardwareInfo hwInfo = *defaultHwInfo;
auto &hwInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
hwInfo.platform.usRevId = 0b0011'1000; // [3:5] - BaseDie != A0
uint8_t buffer[sizeof(STATE_PREFETCH) * 4] = {};
@ -106,9 +109,9 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugVariableSetwhenProgramin
uint32_t alignedSize = alignUp(expectedSize, MemoryConstants::pageSize64k);
uint32_t expectedCmdsCount = std::max((alignedSize / static_cast<uint32_t>(MemoryConstants::pageSize64k)), 1u);
EXPECT_EQ(sizeof(STATE_PREFETCH) * expectedCmdsCount, EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(expectedSize, hwInfo));
EXPECT_EQ(sizeof(STATE_PREFETCH) * expectedCmdsCount, EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(expectedSize, *mockExecutionEnvironment.rootDeviceEnvironments[0]));
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, expectedSize, 0, hwInfo);
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, expectedSize, 0, *mockExecutionEnvironment.rootDeviceEnvironments[0]);
EXPECT_EQ(sizeof(STATE_PREFETCH) * expectedCmdsCount, linearStream.getUsed());
for (uint32_t i = 0; i < expectedCmdsCount; i++) {
@ -133,25 +136,26 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugVariableSetwhenProgramin
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenIsaAllocationWhenProgrammingPrefetchThenSetKernelInstructionPrefetchBit) {
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
MockExecutionEnvironment mockExecutionEnvironment{};
HardwareInfo hwInfo = *defaultHwInfo;
auto &hwInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
hwInfo.platform.usRevId = 0b0011'1000; // [3:5] - BaseDie != A0
uint8_t buffer[sizeof(STATE_PREFETCH)] = {};
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
EXPECT_EQ(sizeof(STATE_PREFETCH), EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(1, hwInfo));
EXPECT_EQ(sizeof(STATE_PREFETCH), EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(1, *mockExecutionEnvironment.rootDeviceEnvironments[0]));
AllocationType isaTypes[] = {AllocationType::KERNEL_ISA, AllocationType::KERNEL_ISA_INTERNAL};
for (uint32_t i = 0; i < 2; i++) {
for (auto &isaType : isaTypes) {
memset(buffer, 0, sizeof(STATE_PREFETCH));
LinearStream linearStream(buffer, sizeof(buffer));
const GraphicsAllocation allocation(0, isaTypes[i],
const GraphicsAllocation allocation(0, isaType,
nullptr, 1234, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, hwInfo);
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, *mockExecutionEnvironment.rootDeviceEnvironments[0]);
EXPECT_EQ(sizeof(STATE_PREFETCH), linearStream.getUsed());
EXPECT_TRUE(statePrefetchCmd->getKernelInstructionPrefetch());
@ -161,28 +165,29 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenIsaAllocationWhenProgrammingP
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugFlagSetWhenProgramPrefetchCalledThenDoPrefetchIfSetToOne) {
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
DebugManagerStateRestore restore;
MockExecutionEnvironment mockExecutionEnvironment{};
HardwareInfo hwInfo = *defaultHwInfo;
auto &hwInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
hwInfo.platform.usRevId = 0b0011'1000; // [3:5] - BaseDie != A0
uint8_t buffer[sizeof(STATE_PREFETCH)] = {};
AllocationType isaTypes[] = {AllocationType::KERNEL_ISA, AllocationType::KERNEL_ISA_INTERNAL};
for (uint32_t i = 0; i < 2; i++) {
for (auto &isaType : isaTypes) {
memset(buffer, 0, sizeof(STATE_PREFETCH));
const GraphicsAllocation allocation(0, isaTypes[i],
const GraphicsAllocation allocation(0, isaType,
nullptr, 1234, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
LinearStream linearStream(buffer, sizeof(buffer));
DebugManager.flags.EnableMemoryPrefetch.set(0);
EXPECT_EQ(0u, EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(100, hwInfo));
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 100, 0, hwInfo);
EXPECT_EQ(0u, EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(100, *mockExecutionEnvironment.rootDeviceEnvironments[0]));
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 100, 0, *mockExecutionEnvironment.rootDeviceEnvironments[0]);
EXPECT_EQ(0u, linearStream.getUsed());
DebugManager.flags.EnableMemoryPrefetch.set(1);
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, hwInfo);
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, *mockExecutionEnvironment.rootDeviceEnvironments[0]);
EXPECT_EQ(sizeof(STATE_PREFETCH), linearStream.getUsed());
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
EXPECT_TRUE(statePrefetchCmd->getKernelInstructionPrefetch());
@ -191,11 +196,12 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugFlagSetWhenProgramPrefet
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugFlagSetWhenProgrammingPrefetchThenSetParserStall) {
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
MockExecutionEnvironment mockExecutionEnvironment{};
DebugManagerStateRestore restore;
DebugManager.flags.ForceCsStallForStatePrefetch.set(1);
HardwareInfo hwInfo = *defaultHwInfo;
auto &hwInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
hwInfo.platform.usRevId = 0b0010'1000; // [3:5] - BaseDie != A0
const GraphicsAllocation allocation(0, AllocationType::BUFFER,
@ -204,7 +210,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugFlagSetWhenProgrammingPr
LinearStream linearStream(buffer, sizeof(buffer));
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, hwInfo);
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, *mockExecutionEnvironment.rootDeviceEnvironments[0]);
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);