mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Add helper functions for memory compression to CSR
Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
fb75390954
commit
6986d5de0b
@@ -62,7 +62,8 @@ void CommandQueueHw<gfxCoreFamily>::programGeneralStateBaseAddress(uint64_t gsba
|
||||
neoDevice->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), !hwHelper.useSystemMemoryPlacementForISA(hwInfo)),
|
||||
true,
|
||||
neoDevice->getGmmHelper(),
|
||||
false);
|
||||
false,
|
||||
NEO::MemoryCompressionState::NotApplicable);
|
||||
*pSbaCmd = sbaCmd;
|
||||
gsbaInit = true;
|
||||
|
||||
|
||||
@@ -676,6 +676,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
|
||||
auto specialPipelineSelectMode = false;
|
||||
Kernel *kernel = nullptr;
|
||||
bool usePerDssBackedBuffer = false;
|
||||
bool auxTranslationRequired = false;
|
||||
|
||||
for (auto &dispatchInfo : multiDispatchInfo) {
|
||||
if (kernel != dispatchInfo.getKernel()) {
|
||||
@@ -689,6 +690,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
|
||||
auto numGrfRequiredByKernel = static_cast<uint32_t>(kernel->getKernelInfo(rootDeviceIndex).kernelDescriptor.kernelAttributes.numGrfRequired);
|
||||
numGrfRequired = std::max(numGrfRequired, numGrfRequiredByKernel);
|
||||
specialPipelineSelectMode |= kernel->requiresSpecialPipelineSelectMode();
|
||||
auxTranslationRequired |= kernel->isAuxTranslationRequired();
|
||||
if (kernel->hasUncacheableStatelessArgs()) {
|
||||
anyUncacheableArgs = true;
|
||||
}
|
||||
@@ -734,6 +736,8 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
|
||||
}
|
||||
}
|
||||
|
||||
auto memoryCompressionState = getGpgpuCommandStreamReceiver().getMemoryCompressionState(auxTranslationRequired);
|
||||
|
||||
DispatchFlags dispatchFlags(
|
||||
{}, //csrDependencies
|
||||
×tampPacketDependencies.barrierNodes, //barrierTimestampPacketNodes
|
||||
@@ -746,6 +750,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
|
||||
kernel->getThreadArbitrationPolicy(), //threadArbitrationPolicy
|
||||
kernel->getAdditionalKernelExecInfo(), //additionalKernelExecInfo
|
||||
kernel->getExecutionType(), //kernelExecutionType
|
||||
memoryCompressionState, //memoryCompressionState
|
||||
getSliceCount(), //sliceCount
|
||||
blocking, //blocking
|
||||
shouldFlushDC(commandType, printfHandler) || allocNeedsFlushDC, //dcFlush
|
||||
@@ -961,6 +966,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueCommandWithoutKernel(
|
||||
ThreadArbitrationPolicy::NotPresent, //threadArbitrationPolicy
|
||||
AdditionalKernelExecInfo::NotApplicable, //additionalKernelExecInfo
|
||||
KernelExecutionType::NotApplicable, //kernelExecutionType
|
||||
MemoryCompressionState::NotApplicable, //memoryCompressionState
|
||||
getSliceCount(), //sliceCount
|
||||
blocking, //blocking
|
||||
false, //dcFlush
|
||||
|
||||
@@ -62,6 +62,7 @@ CompletionStamp &CommandMapUnmap::submit(uint32_t taskLevel, bool terminated) {
|
||||
ThreadArbitrationPolicy::NotPresent, //threadArbitrationPolicy
|
||||
AdditionalKernelExecInfo::NotApplicable, //additionalKernelExecInfo
|
||||
KernelExecutionType::NotApplicable, //kernelExecutionType
|
||||
MemoryCompressionState::NotApplicable, //memoryCompressionState
|
||||
commandQueue.getSliceCount(), //sliceCount
|
||||
true, //blocking
|
||||
true, //dcFlush
|
||||
@@ -212,6 +213,8 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
|
||||
auto rootDeviceIndex = commandQueue.getDevice().getRootDeviceIndex();
|
||||
const auto &kernelDescriptor = kernel->getKernelInfo(rootDeviceIndex).kernelDescriptor;
|
||||
|
||||
auto memoryCompressionState = commandStreamReceiver.getMemoryCompressionState(kernel->isAuxTranslationRequired());
|
||||
|
||||
DispatchFlags dispatchFlags(
|
||||
{}, //csrDependencies
|
||||
nullptr, //barrierTimestampPacketNodes
|
||||
@@ -224,6 +227,7 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
|
||||
kernel->getThreadArbitrationPolicy(), //threadArbitrationPolicy
|
||||
kernel->getAdditionalKernelExecInfo(), //additionalKernelExecInfo
|
||||
kernel->getExecutionType(), //kernelExecutionType
|
||||
memoryCompressionState, //memoryCompressionState
|
||||
commandQueue.getSliceCount(), //sliceCount
|
||||
true, //blocking
|
||||
flushDC, //dcFlush
|
||||
@@ -346,6 +350,7 @@ CompletionStamp &CommandWithoutKernel::submit(uint32_t taskLevel, bool terminate
|
||||
ThreadArbitrationPolicy::NotPresent, //threadArbitrationPolicy
|
||||
AdditionalKernelExecInfo::NotApplicable, //additionalKernelExecInfo
|
||||
KernelExecutionType::NotApplicable, //kernelExecutionType
|
||||
MemoryCompressionState::NotApplicable, //memoryCompressionState
|
||||
commandQueue.getSliceCount(), //sliceCount
|
||||
true, //blocking
|
||||
false, //dcFlush
|
||||
|
||||
@@ -1190,3 +1190,52 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDispatchFlagsWhenCallFlushTas
|
||||
|
||||
EXPECT_EQ(dispatchFlags.threadArbitrationPolicy, mockCsr->requiredThreadArbitrationPolicy);
|
||||
}
|
||||
|
||||
class CommandStreamReceiverFlushTaskMemoryCompressionTests : public UltCommandStreamReceiverTest,
|
||||
public ::testing::WithParamInterface<MemoryCompressionState> {};
|
||||
|
||||
HWTEST_P(CommandStreamReceiverFlushTaskMemoryCompressionTests, givenCsrWithMemoryCompressionStateApplicableWhenFlushTaskIsCalledThenUpdateLastMemoryCompressionState) {
|
||||
auto &mockCsr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
CommandQueueHw<FamilyType> commandQueue(nullptr, pClDevice, 0, false);
|
||||
auto &commandStream = commandQueue.getCS(4096u);
|
||||
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
|
||||
dispatchFlags.memoryCompressionState = GetParam();
|
||||
|
||||
if (dispatchFlags.memoryCompressionState == MemoryCompressionState::NotApplicable) {
|
||||
|
||||
for (auto memoryCompressionState : {MemoryCompressionState::NotApplicable, MemoryCompressionState::Disabled, MemoryCompressionState::Enabled}) {
|
||||
mockCsr.lastMemoryCompressionState = memoryCompressionState;
|
||||
MemoryCompressionState lastMemoryCompressionState = mockCsr.lastMemoryCompressionState;
|
||||
mockCsr.flushTask(commandStream,
|
||||
0,
|
||||
dsh,
|
||||
ioh,
|
||||
ssh,
|
||||
taskLevel,
|
||||
dispatchFlags,
|
||||
*pDevice);
|
||||
EXPECT_EQ(lastMemoryCompressionState, mockCsr.lastMemoryCompressionState);
|
||||
}
|
||||
} else {
|
||||
|
||||
for (auto memoryCompressionState : {MemoryCompressionState::NotApplicable, MemoryCompressionState::Disabled, MemoryCompressionState::Enabled}) {
|
||||
mockCsr.lastMemoryCompressionState = memoryCompressionState;
|
||||
mockCsr.flushTask(commandStream,
|
||||
0,
|
||||
dsh,
|
||||
ioh,
|
||||
ssh,
|
||||
taskLevel,
|
||||
dispatchFlags,
|
||||
*pDevice);
|
||||
EXPECT_EQ(dispatchFlags.memoryCompressionState, mockCsr.lastMemoryCompressionState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
CommandStreamReceiverFlushTaskMemoryCompressionTestsValues,
|
||||
CommandStreamReceiverFlushTaskMemoryCompressionTests,
|
||||
testing::Values(MemoryCompressionState::NotApplicable, MemoryCompressionState::Disabled, MemoryCompressionState::Enabled));
|
||||
|
||||
@@ -1208,7 +1208,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrWhenGen
|
||||
generalStateBaseAddress,
|
||||
true,
|
||||
pDevice->getGmmHelper(),
|
||||
false);
|
||||
false,
|
||||
MemoryCompressionState::NotApplicable);
|
||||
|
||||
EXPECT_NE(generalStateBaseAddress, sbaCmd.getGeneralStateBaseAddress());
|
||||
EXPECT_EQ(GmmHelper::decanonize(generalStateBaseAddress), sbaCmd.getGeneralStateBaseAddress());
|
||||
@@ -1229,7 +1230,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenNonZeroGeneralStateBaseAddres
|
||||
generalStateBaseAddress,
|
||||
true,
|
||||
pDevice->getGmmHelper(),
|
||||
false);
|
||||
false,
|
||||
MemoryCompressionState::NotApplicable);
|
||||
|
||||
EXPECT_EQ(0ull, sbaCmd.getGeneralStateBaseAddress());
|
||||
EXPECT_EQ(0u, sbaCmd.getGeneralStateBufferSize());
|
||||
@@ -1252,7 +1254,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenNonZeroInternalHeapBaseAddres
|
||||
0,
|
||||
false,
|
||||
pDevice->getGmmHelper(),
|
||||
false);
|
||||
false,
|
||||
MemoryCompressionState::NotApplicable);
|
||||
|
||||
EXPECT_FALSE(sbaCmd.getInstructionBaseAddressModifyEnable());
|
||||
EXPECT_EQ(0ull, sbaCmd.getInstructionBaseAddress());
|
||||
@@ -1280,7 +1283,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenSbaProgram
|
||||
instructionHeapBase,
|
||||
true,
|
||||
pDevice->getGmmHelper(),
|
||||
false);
|
||||
false,
|
||||
MemoryCompressionState::NotApplicable);
|
||||
|
||||
EXPECT_FALSE(sbaCmd.getDynamicStateBaseAddressModifyEnable());
|
||||
EXPECT_FALSE(sbaCmd.getDynamicStateBufferSizeModifyEnable());
|
||||
|
||||
@@ -299,6 +299,15 @@ TEST(CommandStreamReceiverSimpleTest, givenCsrWhenSubmitiingBatchBufferThenTaskC
|
||||
executionEnvironment.memoryManager->freeGraphicsMemoryImpl(commandBuffer);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverTest, givenCommandStreamReceiverWhenCallingGetMemoryCompressionStateThenReturnNotApplicable) {
|
||||
CommandStreamReceiverHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
for (bool auxTranslationRequired : {false, true}) {
|
||||
auto memoryCompressionState = commandStreamReceiver.getMemoryCompressionState(auxTranslationRequired);
|
||||
EXPECT_EQ(MemoryCompressionState::NotApplicable, memoryCompressionState);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverTest, givenDebugVariableEnabledWhenCreatingCsrThenEnableTimestampPacketWriteMode) {
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
|
||||
@@ -81,6 +81,6 @@ struct ComputeModeRequirements : public ::testing::Test {
|
||||
|
||||
CommandStreamReceiver *csr = nullptr;
|
||||
std::unique_ptr<MockDevice> device;
|
||||
DispatchFlags flags{{}, nullptr, {}, nullptr, QueueThrottle::MEDIUM, PreemptionMode::Disabled, GrfConfig::DefaultGrfNumber, L3CachingSettings::l3CacheOn, ThreadArbitrationPolicy::NotPresent, AdditionalKernelExecInfo::NotApplicable, KernelExecutionType::NotApplicable, QueueSliceCount::defaultSliceCount, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
DispatchFlags flags{{}, nullptr, {}, nullptr, QueueThrottle::MEDIUM, PreemptionMode::Disabled, GrfConfig::DefaultGrfNumber, L3CachingSettings::l3CacheOn, ThreadArbitrationPolicy::NotPresent, AdditionalKernelExecInfo::NotApplicable, KernelExecutionType::NotApplicable, MemoryCompressionState::NotApplicable, QueueSliceCount::defaultSliceCount, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
};
|
||||
|
||||
@@ -471,6 +471,10 @@ class CommandStreamReceiverMock : public CommandStreamReceiver {
|
||||
|
||||
bool isMultiOsContextCapable() const override { return false; }
|
||||
|
||||
MemoryCompressionState getMemoryCompressionState(bool auxTranslationRequired) const override {
|
||||
return MemoryCompressionState::NotApplicable;
|
||||
}
|
||||
|
||||
CommandStreamReceiverMock() : BaseClass(*(new ExecutionEnvironment), 0, 1) {
|
||||
this->mockExecutionEnvironment.reset(&this->executionEnvironment);
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
|
||||
@@ -75,6 +75,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
using BaseClass::CommandStreamReceiver::isStateSipSent;
|
||||
using BaseClass::CommandStreamReceiver::lastKernelExecutionType;
|
||||
using BaseClass::CommandStreamReceiver::lastMediaSamplerConfig;
|
||||
using BaseClass::CommandStreamReceiver::lastMemoryCompressionState;
|
||||
using BaseClass::CommandStreamReceiver::lastPreemptionMode;
|
||||
using BaseClass::CommandStreamReceiver::lastSentCoherencyRequest;
|
||||
using BaseClass::CommandStreamReceiver::lastSentL3Config;
|
||||
@@ -289,6 +290,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
bool flushBatchedSubmissionsCalled = false;
|
||||
bool initProgrammingFlagsCalled = false;
|
||||
bool multiOsContextCapable = false;
|
||||
bool memoryCompressionEnabled = false;
|
||||
bool directSubmissionAvailable = false;
|
||||
bool blitterDirectSubmissionAvailable = false;
|
||||
bool callBaseIsMultiOsContextCapable = false;
|
||||
|
||||
@@ -354,7 +354,8 @@ void EncodeStateBaseAddress<Family>::encode(CommandContainer &container, STATE_B
|
||||
container.getInstructionHeapBaseAddress(),
|
||||
false,
|
||||
gmmHelper,
|
||||
false);
|
||||
false,
|
||||
MemoryCompressionState::NotApplicable);
|
||||
|
||||
auto pCmd = reinterpret_cast<STATE_BASE_ADDRESS *>(container.getCommandStream()->getSpace(sizeof(STATE_BASE_ADDRESS)));
|
||||
*pCmd = sbaCmd;
|
||||
|
||||
@@ -189,6 +189,8 @@ class CommandStreamReceiver {
|
||||
|
||||
virtual bool isMultiOsContextCapable() const = 0;
|
||||
|
||||
virtual MemoryCompressionState getMemoryCompressionState(bool auxTranslationRequired) const = 0;
|
||||
|
||||
void setLatestSentTaskCount(uint32_t latestSentTaskCount) {
|
||||
this->latestSentTaskCount = latestSentTaskCount;
|
||||
}
|
||||
@@ -293,6 +295,7 @@ class CommandStreamReceiver {
|
||||
uint32_t requiredPrivateScratchSize = 0;
|
||||
uint32_t lastAdditionalKernelExecInfo = AdditionalKernelExecInfo::NotSet;
|
||||
KernelExecutionType lastKernelExecutionType = KernelExecutionType::Default;
|
||||
MemoryCompressionState lastMemoryCompressionState = MemoryCompressionState::NotApplicable;
|
||||
|
||||
const uint32_t rootDeviceIndex;
|
||||
const DeviceBitfield deviceBitfield;
|
||||
|
||||
@@ -95,6 +95,8 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
|
||||
bool isMultiOsContextCapable() const override;
|
||||
|
||||
MemoryCompressionState getMemoryCompressionState(bool auxTranslationRequired) const override;
|
||||
|
||||
bool isDirectSubmissionEnabled() const override {
|
||||
return directSubmission.get() != nullptr;
|
||||
}
|
||||
|
||||
@@ -368,6 +368,13 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
|
||||
bool sourceLevelDebuggerActive = device.getSourceLevelDebugger() != nullptr ? true : false;
|
||||
|
||||
if (dispatchFlags.memoryCompressionState != MemoryCompressionState::NotApplicable) {
|
||||
if (lastMemoryCompressionState != dispatchFlags.memoryCompressionState) {
|
||||
isStateBaseAddressDirty = true;
|
||||
lastMemoryCompressionState = dispatchFlags.memoryCompressionState;
|
||||
}
|
||||
}
|
||||
|
||||
//Reprogram state base address if required
|
||||
if (isStateBaseAddressDirty || sourceLevelDebuggerActive) {
|
||||
addPipeControlBeforeStateBaseAddress(commandStreamCSR);
|
||||
@@ -399,7 +406,8 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
instructionHeapBaseAddress,
|
||||
true,
|
||||
device.getGmmHelper(),
|
||||
isMultiOsContextCapable());
|
||||
isMultiOsContextCapable(),
|
||||
dispatchFlags.memoryCompressionState);
|
||||
*pCmd = cmd;
|
||||
|
||||
if (sshDirty) {
|
||||
@@ -1068,6 +1076,11 @@ inline bool CommandStreamReceiverHw<GfxFamily>::isComputeModeNeeded() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline MemoryCompressionState CommandStreamReceiverHw<GfxFamily>::getMemoryCompressionState(bool auxTranslationRequired) const {
|
||||
return MemoryCompressionState::NotApplicable;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline bool CommandStreamReceiverHw<GfxFamily>::isPipelineSelectAlreadyProgrammed() const {
|
||||
auto &hwHelper = HwHelper::get(peekHwInfo().platform.eRenderCoreFamily);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/command_stream/csr_deps.h"
|
||||
#include "shared/source/command_stream/memory_compression_state.h"
|
||||
#include "shared/source/command_stream/queue_throttle.h"
|
||||
#include "shared/source/command_stream/thread_arbitration_policy.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
@@ -52,33 +53,35 @@ struct DispatchFlags {
|
||||
DispatchFlags() = delete;
|
||||
DispatchFlags(CsrDependencies csrDependencies, TimestampPacketContainer *barrierTimestampPacketNodes, PipelineSelectArgs pipelineSelectArgs,
|
||||
FlushStampTrackingObj *flushStampReference, QueueThrottle throttle, PreemptionMode preemptionMode, uint32_t numGrfRequired,
|
||||
uint32_t l3CacheSettings, uint32_t threadArbitrationPolicy, uint32_t additionalKernelExecInfo, KernelExecutionType kernelExecutionType, uint64_t sliceCount, bool blocking, bool dcFlush,
|
||||
bool useSLM, bool guardCommandBufferWithPipeControl, bool gsba32BitRequired,
|
||||
bool requiresCoherency, bool lowPriority, bool implicitFlush,
|
||||
bool outOfOrderExecutionAllowed, bool epilogueRequired, bool usePerDSSbackedBuffer, bool useSingleSubdevice) : csrDependencies(csrDependencies),
|
||||
barrierTimestampPacketNodes(barrierTimestampPacketNodes),
|
||||
pipelineSelectArgs(pipelineSelectArgs),
|
||||
flushStampReference(flushStampReference),
|
||||
throttle(throttle),
|
||||
preemptionMode(preemptionMode),
|
||||
numGrfRequired(numGrfRequired),
|
||||
l3CacheSettings(l3CacheSettings),
|
||||
threadArbitrationPolicy(threadArbitrationPolicy),
|
||||
additionalKernelExecInfo(additionalKernelExecInfo),
|
||||
kernelExecutionType(kernelExecutionType),
|
||||
sliceCount(sliceCount),
|
||||
blocking(blocking),
|
||||
dcFlush(dcFlush),
|
||||
useSLM(useSLM),
|
||||
guardCommandBufferWithPipeControl(guardCommandBufferWithPipeControl),
|
||||
gsba32BitRequired(gsba32BitRequired),
|
||||
requiresCoherency(requiresCoherency),
|
||||
lowPriority(lowPriority),
|
||||
implicitFlush(implicitFlush),
|
||||
outOfOrderExecutionAllowed(outOfOrderExecutionAllowed),
|
||||
epilogueRequired(epilogueRequired),
|
||||
usePerDssBackedBuffer(usePerDSSbackedBuffer),
|
||||
useSingleSubdevice(useSingleSubdevice){};
|
||||
uint32_t l3CacheSettings, uint32_t threadArbitrationPolicy, uint32_t additionalKernelExecInfo,
|
||||
KernelExecutionType kernelExecutionType, MemoryCompressionState memoryCompressionState,
|
||||
uint64_t sliceCount, bool blocking, bool dcFlush, bool useSLM, bool guardCommandBufferWithPipeControl, bool gsba32BitRequired,
|
||||
bool requiresCoherency, bool lowPriority, bool implicitFlush, bool outOfOrderExecutionAllowed, bool epilogueRequired,
|
||||
bool usePerDSSbackedBuffer, bool useSingleSubdevice) : csrDependencies(csrDependencies),
|
||||
barrierTimestampPacketNodes(barrierTimestampPacketNodes),
|
||||
pipelineSelectArgs(pipelineSelectArgs),
|
||||
flushStampReference(flushStampReference),
|
||||
throttle(throttle),
|
||||
preemptionMode(preemptionMode),
|
||||
numGrfRequired(numGrfRequired),
|
||||
l3CacheSettings(l3CacheSettings),
|
||||
threadArbitrationPolicy(threadArbitrationPolicy),
|
||||
additionalKernelExecInfo(additionalKernelExecInfo),
|
||||
kernelExecutionType(kernelExecutionType),
|
||||
memoryCompressionState(memoryCompressionState),
|
||||
sliceCount(sliceCount),
|
||||
blocking(blocking),
|
||||
dcFlush(dcFlush),
|
||||
useSLM(useSLM),
|
||||
guardCommandBufferWithPipeControl(guardCommandBufferWithPipeControl),
|
||||
gsba32BitRequired(gsba32BitRequired),
|
||||
requiresCoherency(requiresCoherency),
|
||||
lowPriority(lowPriority),
|
||||
implicitFlush(implicitFlush),
|
||||
outOfOrderExecutionAllowed(outOfOrderExecutionAllowed),
|
||||
epilogueRequired(epilogueRequired),
|
||||
usePerDssBackedBuffer(usePerDSSbackedBuffer),
|
||||
useSingleSubdevice(useSingleSubdevice){};
|
||||
|
||||
CsrDependencies csrDependencies;
|
||||
TimestampPacketContainer *barrierTimestampPacketNodes = nullptr;
|
||||
@@ -91,6 +94,7 @@ struct DispatchFlags {
|
||||
uint32_t threadArbitrationPolicy = ThreadArbitrationPolicy::NotPresent;
|
||||
uint32_t additionalKernelExecInfo = AdditionalKernelExecInfo::NotApplicable;
|
||||
KernelExecutionType kernelExecutionType = KernelExecutionType::NotApplicable;
|
||||
MemoryCompressionState memoryCompressionState = MemoryCompressionState::NotApplicable;
|
||||
uint64_t sliceCount = QueueSliceCount::defaultSliceCount;
|
||||
uint64_t engineHints = 0;
|
||||
bool blocking = false;
|
||||
|
||||
16
shared/source/command_stream/memory_compression_state.h
Normal file
16
shared/source/command_stream/memory_compression_state.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace NEO {
|
||||
enum class MemoryCompressionState {
|
||||
Disabled = 0x0u,
|
||||
Enabled = 0x1u,
|
||||
NotApplicable = 0x2u
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
enum class MemoryCompressionState;
|
||||
class GmmHelper;
|
||||
class IndirectHeap;
|
||||
class LinearStream;
|
||||
@@ -32,7 +33,8 @@ struct StateBaseAddressHelper {
|
||||
uint64_t instructionHeapBaseAddress,
|
||||
bool setInstructionStateBaseAddress,
|
||||
GmmHelper *gmmHelper,
|
||||
bool isMultiOsContextCapable);
|
||||
bool isMultiOsContextCapable,
|
||||
MemoryCompressionState memoryCompressionState);
|
||||
|
||||
static void appendStateBaseAddressParameters(
|
||||
STATE_BASE_ADDRESS *stateBaseAddress,
|
||||
@@ -40,7 +42,8 @@ struct StateBaseAddressHelper {
|
||||
bool setGeneralStateBaseAddress,
|
||||
uint64_t indirectObjectHeapBaseAddress,
|
||||
GmmHelper *gmmHelper,
|
||||
bool isMultiOsContextCapable);
|
||||
bool isMultiOsContextCapable,
|
||||
MemoryCompressionState memoryCompressionState);
|
||||
|
||||
static void appendExtraCacheSettings(STATE_BASE_ADDRESS *stateBaseAddress, GmmHelper *gmmHelper);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/memory_compression_state.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
@@ -27,7 +28,8 @@ void StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(
|
||||
uint64_t instructionHeapBaseAddress,
|
||||
bool setInstructionStateBaseAddress,
|
||||
GmmHelper *gmmHelper,
|
||||
bool isMultiOsContextCapable) {
|
||||
bool isMultiOsContextCapable,
|
||||
MemoryCompressionState memoryCompressionState) {
|
||||
|
||||
*stateBaseAddress = GfxFamily::cmdInitStateBaseAddress;
|
||||
|
||||
@@ -74,7 +76,7 @@ void StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(
|
||||
|
||||
stateBaseAddress->setStatelessDataPortAccessMemoryObjectControlState(statelessMocsIndex);
|
||||
|
||||
appendStateBaseAddressParameters(stateBaseAddress, ssh, setGeneralStateBaseAddress, indirectObjectHeapBaseAddress, gmmHelper, isMultiOsContextCapable);
|
||||
appendStateBaseAddressParameters(stateBaseAddress, ssh, setGeneralStateBaseAddress, indirectObjectHeapBaseAddress, gmmHelper, isMultiOsContextCapable, memoryCompressionState);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -16,7 +16,8 @@ void StateBaseAddressHelper<GfxFamily>::appendStateBaseAddressParameters(
|
||||
bool setGeneralStateBaseAddress,
|
||||
uint64_t indirectObjectHeapBaseAddress,
|
||||
GmmHelper *gmmHelper,
|
||||
bool isMultiOsContextCapable) {
|
||||
bool isMultiOsContextCapable,
|
||||
MemoryCompressionState memoryCompressionState) {
|
||||
appendExtraCacheSettings(stateBaseAddress, gmmHelper);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ void StateBaseAddressHelper<GfxFamily>::appendStateBaseAddressParameters(
|
||||
bool setGeneralStateBaseAddress,
|
||||
uint64_t indirectObjectHeapBaseAddress,
|
||||
GmmHelper *gmmHelper,
|
||||
bool isMultiOsContextCapable) {
|
||||
bool isMultiOsContextCapable,
|
||||
MemoryCompressionState memoryCompressionState) {
|
||||
|
||||
if (ssh) {
|
||||
stateBaseAddress->setBindlessSurfaceStateBaseAddressModifyEnable(true);
|
||||
|
||||
@@ -21,7 +21,8 @@ BDWTEST_F(SBATest, givenUsedBindlessBuffersWhenAppendStateBaseAddressParametersI
|
||||
false,
|
||||
0,
|
||||
nullptr,
|
||||
false);
|
||||
false,
|
||||
MemoryCompressionState::NotApplicable);
|
||||
|
||||
EXPECT_EQ(0u, ssh.getUsed());
|
||||
EXPECT_EQ(0, memcmp(&stateBaseAddressReference, &stateBaseAddress, sizeof(STATE_BASE_ADDRESS)));
|
||||
|
||||
@@ -26,6 +26,7 @@ struct DispatchFlagsHelper {
|
||||
ThreadArbitrationPolicy::NotPresent, //threadArbitrationPolicy
|
||||
AdditionalKernelExecInfo::NotApplicable, //additionalKernelExecInfo
|
||||
KernelExecutionType::NotApplicable, //kernelExecutionType
|
||||
MemoryCompressionState::NotApplicable, //memoryCompressionState
|
||||
QueueSliceCount::defaultSliceCount, //sliceCount
|
||||
false, //blocking
|
||||
false, //dcFlush
|
||||
@@ -38,7 +39,6 @@ struct DispatchFlagsHelper {
|
||||
false, //outOfOrderExecutionAllowed
|
||||
false, //epilogueRequired
|
||||
false, //usePerDssBackedBuffer
|
||||
false //useSingleSubdevice
|
||||
);
|
||||
false); //useSingleSubdevice
|
||||
}
|
||||
};
|
||||
|
||||
@@ -25,7 +25,8 @@ HWTEST2_F(SBATest, WhenAppendStateBaseAddressParametersIsCalledThenSBACmdHasBind
|
||||
false,
|
||||
0,
|
||||
nullptr,
|
||||
false);
|
||||
false,
|
||||
MemoryCompressionState::NotApplicable);
|
||||
|
||||
EXPECT_EQ(ssh.getMaxAvailableSpace() / 64 - 1, stateBaseAddress.getBindlessSurfaceStateSize());
|
||||
EXPECT_EQ(ssh.getHeapGpuBase(), stateBaseAddress.getBindlessSurfaceStateBaseAddress());
|
||||
@@ -58,7 +59,8 @@ HWTEST2_F(SBATest, WhenProgramStateBaseAddressParametersIsCalledThenSBACmdHasBin
|
||||
0,
|
||||
false,
|
||||
pDevice->getGmmHelper(),
|
||||
true);
|
||||
true,
|
||||
MemoryCompressionState::NotApplicable);
|
||||
|
||||
EXPECT_EQ(ssh.getMaxAvailableSpace() / 64 - 1, cmd->getBindlessSurfaceStateSize());
|
||||
EXPECT_EQ(ssh.getHeapGpuBase(), cmd->getBindlessSurfaceStateBaseAddress());
|
||||
|
||||
@@ -47,6 +47,10 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
|
||||
|
||||
bool isMultiOsContextCapable() const override { return multiOsContextCapable; }
|
||||
|
||||
MemoryCompressionState getMemoryCompressionState(bool auxTranslationRequired) const override {
|
||||
return MemoryCompressionState::NotApplicable;
|
||||
};
|
||||
|
||||
CompletionStamp flushTask(
|
||||
LinearStream &commandStream,
|
||||
size_t commandStreamStart,
|
||||
@@ -98,6 +102,7 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
|
||||
uint32_t waitForCompletionWithTimeoutCalled = 0;
|
||||
uint32_t mockTagAddress = 0;
|
||||
bool multiOsContextCapable = false;
|
||||
bool memoryCompressionEnabled = false;
|
||||
bool downloadAllocationsCalled = false;
|
||||
bool programHardwareContextCalled = false;
|
||||
bool callParentGetTagAddress = true;
|
||||
|
||||
Reference in New Issue
Block a user