mirror of
https://github.com/intel/compute-runtime.git
synced 2025-11-15 10:14:56 +08:00
Use correct engine group type when programming state base address
Command lists and their helper classes should use engine group type assigned to the particular command list to check if it is RCS group and not use default CSR class assigned to the device, since default and current in command list might be different. Related-To: NEO-5019 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
dda5b19859
commit
acac5ea0d5
@@ -47,6 +47,7 @@ struct EncodeDispatchKernelArgs {
|
||||
bool isHostScopeSignalEvent = false;
|
||||
bool isKernelUsingSystemAllocation = false;
|
||||
bool isKernelDispatchedFromImmediateCmdList = false;
|
||||
bool isRcs = false;
|
||||
};
|
||||
|
||||
struct EncodeWalkerArgs {
|
||||
@@ -240,13 +241,26 @@ struct EncodeMediaInterfaceDescriptorLoad {
|
||||
static void encode(CommandContainer &container);
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct EncodeStateBaseAddressArgs {
|
||||
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
|
||||
|
||||
CommandContainer *container = nullptr;
|
||||
STATE_BASE_ADDRESS &sbaCmd;
|
||||
|
||||
uint32_t statelessMocsIndex = 0;
|
||||
|
||||
bool useGlobalAtomics = false;
|
||||
bool multiOsContextCapable = false;
|
||||
bool isRcs = false;
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct EncodeStateBaseAddress {
|
||||
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
|
||||
static void encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd, bool multiOsContextCapable);
|
||||
static void encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd, uint32_t statelessMocsIndex, bool useGlobalAtomics, bool multiOsContextCapable);
|
||||
static void encode(EncodeStateBaseAddressArgs<GfxFamily> &args);
|
||||
static void setSbaAddressesForDebugger(NEO::Debugger::SbaAddresses &sbaAddress, const STATE_BASE_ADDRESS &sbaCmd);
|
||||
static size_t getRequiredSizeForStateBaseAddress(Device &device, CommandContainer &container);
|
||||
static size_t getRequiredSizeForStateBaseAddress(Device &device, CommandContainer &container, bool isRcs);
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
@@ -313,7 +327,7 @@ template <typename GfxFamily>
|
||||
struct EncodeWA {
|
||||
static void encodeAdditionalPipelineSelect(LinearStream &stream, const PipelineSelectArgs &args, bool is3DPipeline,
|
||||
const HardwareInfo &hwInfo, bool isRcs);
|
||||
static size_t getAdditionalPipelineSelectSize(Device &device);
|
||||
static size_t getAdditionalPipelineSelectSize(Device &device, bool isRcs);
|
||||
|
||||
static void addPipeControlPriorToNonPipelinedStateCommand(LinearStream &commandStream, PipeControlArgs args,
|
||||
const HardwareInfo &hwInfo, bool isRcs);
|
||||
|
||||
@@ -178,7 +178,15 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
|
||||
auto gmmHelper = container.getDevice()->getGmmHelper();
|
||||
uint32_t statelessMocsIndex =
|
||||
args.requiresUncachedMocs ? (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1) : (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
|
||||
EncodeStateBaseAddress<Family>::encode(container, sba, statelessMocsIndex, false, false);
|
||||
|
||||
EncodeStateBaseAddressArgs<Family> encodeStateBaseAddressArgs = {
|
||||
&container,
|
||||
sba,
|
||||
statelessMocsIndex,
|
||||
false,
|
||||
false,
|
||||
args.isRcs};
|
||||
EncodeStateBaseAddress<Family>::encode(encodeStateBaseAddressArgs);
|
||||
container.setDirtyStateForAllHeaps(false);
|
||||
args.requiresUncachedMocs = false;
|
||||
}
|
||||
@@ -350,58 +358,51 @@ void EncodeStateBaseAddress<Family>::setSbaAddressesForDebugger(NEO::Debugger::S
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
void EncodeStateBaseAddress<Family>::encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd, bool multiOsContextCapable) {
|
||||
auto gmmHelper = container.getDevice()->getRootDeviceEnvironment().getGmmHelper();
|
||||
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
|
||||
EncodeStateBaseAddress<Family>::encode(container, sbaCmd, statelessMocsIndex, false, multiOsContextCapable);
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
void EncodeStateBaseAddress<Family>::encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd, uint32_t statelessMocsIndex, bool useGlobalAtomics, bool multiOsContextCapable) {
|
||||
auto &device = *container.getDevice();
|
||||
void EncodeStateBaseAddress<Family>::encode(EncodeStateBaseAddressArgs<Family> &args) {
|
||||
auto &device = *args.container->getDevice();
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto isRcs = device.getDefaultEngine().commandStreamReceiver->isRcs();
|
||||
if (container.isAnyHeapDirty()) {
|
||||
EncodeWA<Family>::encodeAdditionalPipelineSelect(*container.getCommandStream(), {}, true, hwInfo, isRcs);
|
||||
|
||||
if (args.container->isAnyHeapDirty()) {
|
||||
EncodeWA<Family>::encodeAdditionalPipelineSelect(*args.container->getCommandStream(), {}, true, hwInfo, args.isRcs);
|
||||
}
|
||||
|
||||
auto gmmHelper = device.getGmmHelper();
|
||||
|
||||
auto dsh = container.isHeapDirty(HeapType::DYNAMIC_STATE) ? container.getIndirectHeap(HeapType::DYNAMIC_STATE) : nullptr;
|
||||
auto ioh = container.isHeapDirty(HeapType::INDIRECT_OBJECT) ? container.getIndirectHeap(HeapType::INDIRECT_OBJECT) : nullptr;
|
||||
auto ssh = container.isHeapDirty(HeapType::SURFACE_STATE) ? container.getIndirectHeap(HeapType::SURFACE_STATE) : nullptr;
|
||||
auto dsh = args.container->isHeapDirty(HeapType::DYNAMIC_STATE) ? args.container->getIndirectHeap(HeapType::DYNAMIC_STATE) : nullptr;
|
||||
auto ioh = args.container->isHeapDirty(HeapType::INDIRECT_OBJECT) ? args.container->getIndirectHeap(HeapType::INDIRECT_OBJECT) : nullptr;
|
||||
auto ssh = args.container->isHeapDirty(HeapType::SURFACE_STATE) ? args.container->getIndirectHeap(HeapType::SURFACE_STATE) : nullptr;
|
||||
|
||||
StateBaseAddressHelperArgs<Family> args = {
|
||||
0, // generalStateBase
|
||||
container.getIndirectObjectHeapBaseAddress(), // indirectObjectHeapBaseAddress
|
||||
container.getInstructionHeapBaseAddress(), // instructionHeapBaseAddress
|
||||
0, // globalHeapsBaseAddress
|
||||
&sbaCmd, // stateBaseAddressCmd
|
||||
dsh, // dsh
|
||||
ioh, // ioh
|
||||
ssh, // ssh
|
||||
gmmHelper, // gmmHelper
|
||||
statelessMocsIndex, // statelessMocsIndex
|
||||
NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState
|
||||
false, // setInstructionStateBaseAddress
|
||||
false, // setGeneralStateBaseAddress
|
||||
false, // useGlobalHeapsBaseAddress
|
||||
false, // isMultiOsContextCapable
|
||||
useGlobalAtomics, // useGlobalAtomics
|
||||
false // areMultipleSubDevicesInContext
|
||||
StateBaseAddressHelperArgs<Family> stateBaseAddressHelperArgs = {
|
||||
0, // generalStateBase
|
||||
args.container->getIndirectObjectHeapBaseAddress(), // indirectObjectHeapBaseAddress
|
||||
args.container->getInstructionHeapBaseAddress(), // instructionHeapBaseAddress
|
||||
0, // globalHeapsBaseAddress
|
||||
&args.sbaCmd, // stateBaseAddressCmd
|
||||
dsh, // dsh
|
||||
ioh, // ioh
|
||||
ssh, // ssh
|
||||
gmmHelper, // gmmHelper
|
||||
args.statelessMocsIndex, // statelessMocsIndex
|
||||
NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState
|
||||
false, // setInstructionStateBaseAddress
|
||||
false, // setGeneralStateBaseAddress
|
||||
false, // useGlobalHeapsBaseAddress
|
||||
false, // isMultiOsContextCapable
|
||||
args.useGlobalAtomics, // useGlobalAtomics
|
||||
false // areMultipleSubDevicesInContext
|
||||
};
|
||||
|
||||
StateBaseAddressHelper<Family>::programStateBaseAddress(args);
|
||||
StateBaseAddressHelper<Family>::programStateBaseAddress(stateBaseAddressHelperArgs);
|
||||
|
||||
auto cmdSpace = StateBaseAddressHelper<Family>::getSpaceForSbaCmd(*container.getCommandStream());
|
||||
*cmdSpace = sbaCmd;
|
||||
auto cmdSpace = StateBaseAddressHelper<Family>::getSpaceForSbaCmd(*args.container->getCommandStream());
|
||||
*cmdSpace = args.sbaCmd;
|
||||
|
||||
EncodeWA<Family>::encodeAdditionalPipelineSelect(*container.getCommandStream(), {}, false, hwInfo, isRcs);
|
||||
EncodeWA<Family>::encodeAdditionalPipelineSelect(*args.container->getCommandStream(), {}, false, hwInfo, args.isRcs);
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
size_t EncodeStateBaseAddress<Family>::getRequiredSizeForStateBaseAddress(Device &device, CommandContainer &container) {
|
||||
return sizeof(typename Family::STATE_BASE_ADDRESS) + 2 * EncodeWA<Family>::getAdditionalPipelineSelectSize(device);
|
||||
size_t EncodeStateBaseAddress<Family>::getRequiredSizeForStateBaseAddress(Device &device, CommandContainer &container, bool isRcs) {
|
||||
return sizeof(typename Family::STATE_BASE_ADDRESS) + 2 * EncodeWA<Family>::getAdditionalPipelineSelectSize(device, isRcs);
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
@@ -427,7 +428,7 @@ inline void EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(LinearStream &st
|
||||
const HardwareInfo &hwInfo, bool isRcs) {}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline size_t EncodeWA<GfxFamily>::getAdditionalPipelineSelectSize(Device &device) {
|
||||
inline size_t EncodeWA<GfxFamily>::getAdditionalPipelineSelectSize(Device &device, bool isRcs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,15 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
|
||||
auto gmmHelper = container.getDevice()->getGmmHelper();
|
||||
uint32_t statelessMocsIndex =
|
||||
args.requiresUncachedMocs ? (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1) : (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
|
||||
EncodeStateBaseAddress<Family>::encode(container, sbaCmd, statelessMocsIndex, args.useGlobalAtomics, args.partitionCount > 1);
|
||||
|
||||
EncodeStateBaseAddressArgs<Family> encodeStateBaseAddressArgs = {
|
||||
&container,
|
||||
sbaCmd,
|
||||
statelessMocsIndex,
|
||||
args.useGlobalAtomics,
|
||||
args.partitionCount > 1,
|
||||
args.isRcs};
|
||||
EncodeStateBaseAddress<Family>::encode(encodeStateBaseAddressArgs);
|
||||
container.setDirtyStateForAllHeaps(false);
|
||||
args.requiresUncachedMocs = false;
|
||||
}
|
||||
@@ -464,62 +472,55 @@ void EncodeStateBaseAddress<Family>::setSbaAddressesForDebugger(NEO::Debugger::S
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
void EncodeStateBaseAddress<Family>::encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd, bool multiOsContextCapable) {
|
||||
auto gmmHelper = container.getDevice()->getRootDeviceEnvironment().getGmmHelper();
|
||||
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
|
||||
EncodeStateBaseAddress<Family>::encode(container, sbaCmd, statelessMocsIndex, false, multiOsContextCapable);
|
||||
}
|
||||
void EncodeStateBaseAddress<Family>::encode(EncodeStateBaseAddressArgs<Family> &args) {
|
||||
auto gmmHelper = args.container->getDevice()->getRootDeviceEnvironment().getGmmHelper();
|
||||
|
||||
template <typename Family>
|
||||
void EncodeStateBaseAddress<Family>::encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd, uint32_t statelessMocsIndex, bool useGlobalAtomics, bool multiOsContextCapable) {
|
||||
auto gmmHelper = container.getDevice()->getRootDeviceEnvironment().getGmmHelper();
|
||||
auto dsh = args.container->isHeapDirty(HeapType::DYNAMIC_STATE) ? args.container->getIndirectHeap(HeapType::DYNAMIC_STATE) : nullptr;
|
||||
auto ioh = args.container->isHeapDirty(HeapType::INDIRECT_OBJECT) ? args.container->getIndirectHeap(HeapType::INDIRECT_OBJECT) : nullptr;
|
||||
auto ssh = args.container->isHeapDirty(HeapType::SURFACE_STATE) ? args.container->getIndirectHeap(HeapType::SURFACE_STATE) : nullptr;
|
||||
|
||||
auto dsh = container.isHeapDirty(HeapType::DYNAMIC_STATE) ? container.getIndirectHeap(HeapType::DYNAMIC_STATE) : nullptr;
|
||||
auto ioh = container.isHeapDirty(HeapType::INDIRECT_OBJECT) ? container.getIndirectHeap(HeapType::INDIRECT_OBJECT) : nullptr;
|
||||
auto ssh = container.isHeapDirty(HeapType::SURFACE_STATE) ? container.getIndirectHeap(HeapType::SURFACE_STATE) : nullptr;
|
||||
|
||||
StateBaseAddressHelperArgs<Family> args = {
|
||||
0, // generalStateBase
|
||||
container.getIndirectObjectHeapBaseAddress(), // indirectObjectHeapBaseAddress
|
||||
container.getInstructionHeapBaseAddress(), // instructionHeapBaseAddress
|
||||
0, // globalHeapsBaseAddress
|
||||
&sbaCmd, // stateBaseAddressCmd
|
||||
dsh, // dsh
|
||||
ioh, // ioh
|
||||
ssh, // ssh
|
||||
gmmHelper, // gmmHelper
|
||||
statelessMocsIndex, // statelessMocsIndex
|
||||
NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState
|
||||
true, // setInstructionStateBaseAddress
|
||||
true, // setGeneralStateBaseAddress
|
||||
false, // useGlobalHeapsBaseAddress
|
||||
multiOsContextCapable, // isMultiOsContextCapable
|
||||
useGlobalAtomics, // useGlobalAtomics
|
||||
false // areMultipleSubDevicesInContext
|
||||
StateBaseAddressHelperArgs<Family> stateBaseAddressHelperArgs = {
|
||||
0, // generalStateBase
|
||||
args.container->getIndirectObjectHeapBaseAddress(), // indirectObjectHeapBaseAddress
|
||||
args.container->getInstructionHeapBaseAddress(), // instructionHeapBaseAddress
|
||||
0, // globalHeapsBaseAddress
|
||||
&args.sbaCmd, // stateBaseAddressCmd
|
||||
dsh, // dsh
|
||||
ioh, // ioh
|
||||
ssh, // ssh
|
||||
gmmHelper, // gmmHelper
|
||||
args.statelessMocsIndex, // statelessMocsIndex
|
||||
NEO::MemoryCompressionState::NotApplicable, // memoryCompressionState
|
||||
true, // setInstructionStateBaseAddress
|
||||
true, // setGeneralStateBaseAddress
|
||||
false, // useGlobalHeapsBaseAddress
|
||||
args.multiOsContextCapable, // isMultiOsContextCapable
|
||||
args.useGlobalAtomics, // useGlobalAtomics
|
||||
false // areMultipleSubDevicesInContext
|
||||
};
|
||||
|
||||
StateBaseAddressHelper<Family>::programStateBaseAddress(args);
|
||||
StateBaseAddressHelper<Family>::programStateBaseAddress(stateBaseAddressHelperArgs);
|
||||
|
||||
auto cmdSpace = StateBaseAddressHelper<Family>::getSpaceForSbaCmd(*container.getCommandStream());
|
||||
*cmdSpace = sbaCmd;
|
||||
auto cmdSpace = StateBaseAddressHelper<Family>::getSpaceForSbaCmd(*args.container->getCommandStream());
|
||||
*cmdSpace = args.sbaCmd;
|
||||
|
||||
auto &hwInfo = container.getDevice()->getHardwareInfo();
|
||||
auto &hwInfo = args.container->getDevice()->getHardwareInfo();
|
||||
auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
if (hwInfoConfig.isAdditionalStateBaseAddressWARequired(hwInfo)) {
|
||||
cmdSpace = StateBaseAddressHelper<Family>::getSpaceForSbaCmd(*container.getCommandStream());
|
||||
*cmdSpace = sbaCmd;
|
||||
cmdSpace = StateBaseAddressHelper<Family>::getSpaceForSbaCmd(*args.container->getCommandStream());
|
||||
*cmdSpace = args.sbaCmd;
|
||||
}
|
||||
|
||||
if (container.isHeapDirty(HeapType::SURFACE_STATE)) {
|
||||
auto heap = container.getIndirectHeap(HeapType::SURFACE_STATE);
|
||||
StateBaseAddressHelper<Family>::programBindingTableBaseAddress(*container.getCommandStream(),
|
||||
if (args.container->isHeapDirty(HeapType::SURFACE_STATE)) {
|
||||
auto heap = args.container->getIndirectHeap(HeapType::SURFACE_STATE);
|
||||
StateBaseAddressHelper<Family>::programBindingTableBaseAddress(*args.container->getCommandStream(),
|
||||
*heap,
|
||||
gmmHelper);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
size_t EncodeStateBaseAddress<Family>::getRequiredSizeForStateBaseAddress(Device &device, CommandContainer &container) {
|
||||
size_t EncodeStateBaseAddress<Family>::getRequiredSizeForStateBaseAddress(Device &device, CommandContainer &container, bool isRcs) {
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
|
||||
@@ -677,7 +678,7 @@ inline void EncodeWA<Family>::encodeAdditionalPipelineSelect(LinearStream &strea
|
||||
const HardwareInfo &hwInfo, bool isRcs) {}
|
||||
|
||||
template <typename Family>
|
||||
inline size_t EncodeWA<Family>::getAdditionalPipelineSelectSize(Device &device) {
|
||||
inline size_t EncodeWA<Family>::getAdditionalPipelineSelectSize(Device &device, bool isRcs) {
|
||||
return 0u;
|
||||
}
|
||||
template <typename Family>
|
||||
|
||||
@@ -25,9 +25,9 @@ using Family = NEO::Gen12LpFamily;
|
||||
namespace NEO {
|
||||
|
||||
template <>
|
||||
size_t EncodeWA<Family>::getAdditionalPipelineSelectSize(Device &device) {
|
||||
size_t EncodeWA<Family>::getAdditionalPipelineSelectSize(Device &device, bool isRcs) {
|
||||
size_t size = 0;
|
||||
if (device.getDefaultEngine().commandStreamReceiver->isRcs()) {
|
||||
if (isRcs) {
|
||||
size += 2 * PreambleHelper<Family>::getCmdSizeForPipelineSelect(device.getHardwareInfo());
|
||||
}
|
||||
return size;
|
||||
|
||||
@@ -31,14 +31,14 @@ HWTEST2_F(DG2CommandEncoderTest, givenDG2WhenGettingRequiredSizeForStateBaseAddr
|
||||
|
||||
auto container = MockCommandContainer();
|
||||
container.clearHeaps();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 176ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(DG2CommandEncoderTest, givenDG2AndCommandContainerWithDirtyHeapWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsDG2) {
|
||||
auto container = CommandContainer();
|
||||
container.setHeapDirty(HeapType::SURFACE_STATE);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 192ul);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,21 +33,21 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterHardwareCommandsTest, GivenXeHPAndLater
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterHardwareCommandsTest, givenXeHPAndLaterPlatformWhenGetAdditionalPipelineSelectSizeIsCalledThenZeroIsReturned) {
|
||||
MockDevice device;
|
||||
EXPECT_EQ(0u, EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device));
|
||||
EXPECT_EQ(0u, EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device, false));
|
||||
}
|
||||
|
||||
using XeHPAndLaterCommandEncoderTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(XeHPAndLaterCommandEncoderTest, whenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsAtLeastXeHpCore) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 104ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(XeHPAndLaterCommandEncoderTest, givenCommandContainerWithDirtyHeapWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsAtLeastXeHpCore) {
|
||||
auto container = CommandContainer();
|
||||
container.setHeapDirty(HeapType::SURFACE_STATE);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 104ul);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,43 +24,61 @@ using CommandEncoderTest = Test<DeviceFixture>;
|
||||
using Platforms = IsWithinProducts<IGFX_SKYLAKE, IGFX_ROCKETLAKE>;
|
||||
HWTEST2_F(CommandEncoderTest, whenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, Platforms) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 76ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenGLLPWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsTGLLP) {
|
||||
HWTEST2_F(CommandEncoderTest, givenTglLpUsingRcsWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsTGLLP) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, true);
|
||||
EXPECT_EQ(size, 200ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenDG1WhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsDG1) {
|
||||
HWTEST2_F(CommandEncoderTest, givenTglLpNotUsingRcsWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsTGLLP) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
EXPECT_EQ(size, 200ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenEHLWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsEHL) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 88ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenRKLWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsRKL) {
|
||||
HWTEST2_F(CommandEncoderTest, givenDg1UsingRcsWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsDG1) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, true);
|
||||
EXPECT_EQ(size, 200ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenDg1NotUsingRcsWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsDG1) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 88ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenEhlWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsEHL) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 88ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenRklUsingRcsWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsRKL) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, true);
|
||||
EXPECT_EQ(size, 104ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenLFKWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsLKF) {
|
||||
HWTEST2_F(CommandEncoderTest, givenRklNotUsingRcsWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsRKL) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 88ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenICLLPWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsICLLP) {
|
||||
HWTEST2_F(CommandEncoderTest, givenLkfWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsLKF) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container);
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 88ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenIclLpWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsICLLP) {
|
||||
auto container = CommandContainer();
|
||||
size_t size = EncodeStateBaseAddress<FamilyType>::getRequiredSizeForStateBaseAddress(*pDevice, container, false);
|
||||
EXPECT_EQ(size, 88ul);
|
||||
}
|
||||
|
||||
|
||||
@@ -1236,6 +1236,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, givenGlobalBindlessHeapsWhenDispatchin
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false};
|
||||
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dispatchArgs, nullptr);
|
||||
@@ -1282,6 +1283,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, givenBindlessModeDisabledelWithSampler
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false};
|
||||
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dispatchArgs, nullptr);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
@@ -297,8 +298,14 @@ HWTEST2_F(CommandEncodeStatesTest, givenCommandContainerWithDirtyHeapsWhenSetSta
|
||||
cmdContainer->setHeapDirty(NEO::HeapType::INDIRECT_OBJECT);
|
||||
cmdContainer->setHeapDirty(NEO::HeapType::SURFACE_STATE);
|
||||
|
||||
auto gmmHelper = cmdContainer->getDevice()->getRootDeviceEnvironment().getGmmHelper();
|
||||
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
|
||||
|
||||
STATE_BASE_ADDRESS sba;
|
||||
EncodeStateBaseAddress<FamilyType>::encode(*cmdContainer.get(), sba, false);
|
||||
|
||||
EncodeStateBaseAddressArgs<FamilyType> args = createDefaultEncodeStateBaseAddressArgs<FamilyType>(cmdContainer.get(), sba, statelessMocsIndex);
|
||||
|
||||
EncodeStateBaseAddress<FamilyType>::encode(args);
|
||||
|
||||
auto dsh = cmdContainer->getIndirectHeap(NEO::HeapType::DYNAMIC_STATE);
|
||||
auto ssh = cmdContainer->getIndirectHeap(NEO::HeapType::SURFACE_STATE);
|
||||
@@ -332,7 +339,12 @@ HWTEST_F(CommandEncodeStatesTest, givenCommandContainerWhenSetStateBaseAddressCa
|
||||
cmdContainer->dirtyHeaps = 0;
|
||||
|
||||
STATE_BASE_ADDRESS sba;
|
||||
EncodeStateBaseAddress<FamilyType>::encode(*cmdContainer.get(), sba, false);
|
||||
auto gmmHelper = cmdContainer->getDevice()->getRootDeviceEnvironment().getGmmHelper();
|
||||
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
|
||||
|
||||
EncodeStateBaseAddressArgs<FamilyType> args = createDefaultEncodeStateBaseAddressArgs<FamilyType>(cmdContainer.get(), sba, statelessMocsIndex);
|
||||
|
||||
EncodeStateBaseAddress<FamilyType>::encode(args);
|
||||
|
||||
auto dsh = cmdContainer->getIndirectHeap(NEO::HeapType::DYNAMIC_STATE);
|
||||
auto ssh = cmdContainer->getIndirectHeap(NEO::HeapType::SURFACE_STATE);
|
||||
|
||||
@@ -53,11 +53,27 @@ class CommandEncodeStatesFixture : public DeviceFixture {
|
||||
false, // isCooperative
|
||||
false, // isHostScopeSignalEvent
|
||||
false, // isKernelUsingSystemAllocation
|
||||
false // isKernelDispatchedFromImmediateCmdList
|
||||
false, // isKernelDispatchedFromImmediateCmdList
|
||||
false // isRcs
|
||||
};
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
EncodeStateBaseAddressArgs<FamilyType> createDefaultEncodeStateBaseAddressArgs(
|
||||
CommandContainer *container,
|
||||
typename FamilyType::STATE_BASE_ADDRESS &sbaCmd,
|
||||
uint32_t statelessMocs) {
|
||||
EncodeStateBaseAddressArgs<FamilyType> args = {
|
||||
container,
|
||||
sbaCmd,
|
||||
statelessMocs,
|
||||
false,
|
||||
false,
|
||||
false};
|
||||
return args;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -32,7 +32,7 @@ GEN12LPTEST_F(Gen12LpCommandEncodeTest, givenGen12LpPlatformWhenDefaultEngineIsR
|
||||
auto csr = std::make_unique<MyCommandStreamReceiverMock<true>>(*device.getExecutionEnvironment(), 0, device.getDeviceBitfield());
|
||||
auto oldCsr = device.getDefaultEngine().commandStreamReceiver;
|
||||
device.getDefaultEngine().commandStreamReceiver = csr.get();
|
||||
EXPECT_EQ(2 * PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(device.getHardwareInfo()), EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device));
|
||||
EXPECT_EQ(2 * PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(device.getHardwareInfo()), EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device, csr->isRcs()));
|
||||
device.getDefaultEngine().commandStreamReceiver = oldCsr;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,6 @@ GEN12LPTEST_F(Gen12LpCommandEncodeTest, givenGen12LpPlatformWhenDefaultEngineIsN
|
||||
auto csr = std::make_unique<MyCommandStreamReceiverMock<false>>(*device.getExecutionEnvironment(), 0, device.getDeviceBitfield());
|
||||
auto oldCsr = device.getDefaultEngine().commandStreamReceiver;
|
||||
device.getDefaultEngine().commandStreamReceiver = csr.get();
|
||||
EXPECT_EQ(0u, EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device));
|
||||
EXPECT_EQ(0u, EncodeWA<FamilyType>::getAdditionalPipelineSelectSize(device, csr->isRcs()));
|
||||
device.getDefaultEngine().commandStreamReceiver = oldCsr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,17 +7,20 @@
|
||||
|
||||
#include "shared/source/command_container/cmdcontainer.h"
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
|
||||
|
||||
#include "reg_configs_common.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using CommandEncoderTest = Test<DeviceFixture>;
|
||||
using CommandEncodeStatesTest = Test<CommandEncodeStatesFixture>;
|
||||
|
||||
GEN12LPTEST_F(CommandEncoderTest, WhenAdjustComputeModeIsCalledThenStateComputeModeShowsNonCoherencySet) {
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
@@ -68,7 +71,7 @@ struct MockOsContext : public OsContext {
|
||||
using OsContext::engineType;
|
||||
};
|
||||
|
||||
GEN12LPTEST_F(CommandEncoderTest, givenVariousEngineTypesWhenEncodeSBAThenAdditionalPipelineSelectWAIsAppliedOnlyToRcs) {
|
||||
GEN12LPTEST_F(CommandEncodeStatesTest, givenVariousEngineTypesWhenEncodeSbaThenAdditionalPipelineSelectWAIsAppliedOnlyToRcs) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
@@ -78,9 +81,14 @@ GEN12LPTEST_F(CommandEncoderTest, givenVariousEngineTypesWhenEncodeSBAThenAdditi
|
||||
auto ret = cmdContainer.initialize(pDevice, nullptr, true);
|
||||
ASSERT_EQ(ErrorCode::SUCCESS, ret);
|
||||
|
||||
auto gmmHelper = cmdContainer.getDevice()->getRootDeviceEnvironment().getGmmHelper();
|
||||
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
|
||||
|
||||
{
|
||||
STATE_BASE_ADDRESS sba;
|
||||
EncodeStateBaseAddress<FamilyType>::encode(cmdContainer, sba, false);
|
||||
EncodeStateBaseAddressArgs<FamilyType> args = createDefaultEncodeStateBaseAddressArgs<FamilyType>(&cmdContainer, sba, statelessMocsIndex);
|
||||
args.isRcs = true;
|
||||
EncodeStateBaseAddress<FamilyType>::encode(args);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer.getCommandStream()->getCpuBase(), 0), cmdContainer.getCommandStream()->getUsed());
|
||||
@@ -95,10 +103,10 @@ GEN12LPTEST_F(CommandEncoderTest, givenVariousEngineTypesWhenEncodeSBAThenAdditi
|
||||
cmdContainer.reset();
|
||||
|
||||
{
|
||||
static_cast<MockOsContext *>(pDevice->getDefaultEngine().osContext)->engineType = aub_stream::ENGINE_CCS;
|
||||
|
||||
STATE_BASE_ADDRESS sba;
|
||||
EncodeStateBaseAddress<FamilyType>::encode(cmdContainer, sba, false);
|
||||
EncodeStateBaseAddressArgs<FamilyType> args = createDefaultEncodeStateBaseAddressArgs<FamilyType>(&cmdContainer, sba, statelessMocsIndex);
|
||||
args.isRcs = false;
|
||||
EncodeStateBaseAddress<FamilyType>::encode(args);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer.getCommandStream()->getCpuBase(), 0), cmdContainer.getCommandStream()->getUsed());
|
||||
|
||||
Reference in New Issue
Block a user