Set SingleSliceDispatchCcsMode for EngineInstanced OsContext

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2021-08-13 14:48:13 +00:00 committed by Compute-Runtime-Automation
parent 41fc2e8cce
commit d8a98acafd
24 changed files with 187 additions and 70 deletions

View File

@ -2158,17 +2158,16 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
auto disableOverdispatch = hwHelper.isDisableOverdispatchAvailable(hwInfo);
if (!containsAnyKernel) {
requiredStreamState.frontEndState.setProperties(kernel.usesSyncBuffer(), disableOverdispatch, device->getHwInfo());
requiredStreamState.frontEndState.setProperties(kernel.usesSyncBuffer(), disableOverdispatch, false, device->getHwInfo());
finalStreamState = requiredStreamState;
containsAnyKernel = true;
}
finalStreamState.frontEndState.setProperties(kernel.usesSyncBuffer(), disableOverdispatch, hwInfo);
finalStreamState.frontEndState.setProperties(kernel.usesSyncBuffer(), disableOverdispatch, false, hwInfo);
if (finalStreamState.frontEndState.isDirty()) {
auto pVfeStateAddress = NEO::PreambleHelper<GfxFamily>::getSpaceForVfeState(commandContainer.getCommandStream(), hwInfo, engineGroupType);
auto pVfeState = new VFE_STATE_TYPE;
NEO::PreambleHelper<GfxFamily>::programVfeState(pVfeState, hwInfo, 0, 0, device->getMaxNumHwThreads(),
NEO::AdditionalKernelExecInfo::NotApplicable, finalStreamState);
NEO::PreambleHelper<GfxFamily>::programVfeState(pVfeState, hwInfo, 0, 0, device->getMaxNumHwThreads(), finalStreamState);
commandsToPatch.push_back({pVfeStateAddress, pVfeState, CommandToPatch::FrontEndState});
}

View File

@ -336,6 +336,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
if (!isCopyOnlyCommandQueue) {
auto &requiredStreamState = commandList->getRequiredStreamState();
streamProperties.frontEndState.setProperties(requiredStreamState.frontEndState);
streamProperties.frontEndState.singleSliceDispatchCcsMode.value = csr->getOsContext().isEngineInstanced();
auto programVfe = streamProperties.frontEndState.isDirty();
if (frontEndStateDirty) {
programVfe = true;
@ -346,6 +347,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
}
auto &finalStreamState = commandList->getFinalStreamState();
streamProperties.frontEndState.setProperties(finalStreamState.frontEndState);
streamProperties.frontEndState.singleSliceDispatchCcsMode.value = csr->getOsContext().isEngineInstanced();
}
patchCommands(*commandList, scratchSpaceController->getScratchPatchAddress());
@ -437,7 +439,6 @@ void CommandQueueHw<gfxCoreFamily>::programFrontEnd(uint64_t scratchAddress, uin
perThreadScratchSpaceSize,
scratchAddress,
device->getMaxNumHwThreads(),
NEO::AdditionalKernelExecInfo::NotApplicable,
streamProperties);
csr->setMediaVFEStateDirty(false);
}

View File

@ -135,12 +135,18 @@ void CommandQueueHw<gfxCoreFamily>::patchCommands(CommandList &commandList, uint
uint32_t lowScratchAddress = uint32_t(0xFFFFFFFF & scratchAddress);
CFE_STATE *cfeStateCmd = nullptr;
auto &commandsToPatch = commandList.getCommandsToPatch();
for (auto &commandToPatch : commandsToPatch) {
switch (commandToPatch.type) {
case CommandList::CommandToPatch::FrontEndState:
reinterpret_cast<CFE_STATE *>(commandToPatch.pCommand)->setScratchSpaceBuffer(lowScratchAddress);
*reinterpret_cast<CFE_STATE *>(commandToPatch.pDestination) = *reinterpret_cast<CFE_STATE *>(commandToPatch.pCommand);
cfeStateCmd = reinterpret_cast<CFE_STATE *>(commandToPatch.pCommand);
cfeStateCmd->setScratchSpaceBuffer(lowScratchAddress);
cfeStateCmd->setSingleSliceDispatchCcsMode(streamProperties.frontEndState.singleSliceDispatchCcsMode.value);
*reinterpret_cast<CFE_STATE *>(commandToPatch.pDestination) = *cfeStateCmd;
break;
default:
UNRECOVERABLE_IF(true);

View File

@ -17,6 +17,7 @@
#include "shared/test/common/mocks/mock_bindless_heaps_helper.h"
#include "shared/test/common/mocks/mock_command_stream_receiver.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "opencl/test/unit_test/libult/ult_command_stream_receiver.h"
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
@ -1134,6 +1135,100 @@ HWTEST2_F(ExecuteCommandListTests, givenCommandQueueHavingTwoB2BCommandListsThen
commandQueue->destroy();
}
struct EngineInstancedDeviceExecuteTests : public ::testing::Test {
void SetUp() override {
DebugManager.flags.EngineInstancedSubDevices.set(true);
}
bool createDevices(uint32_t numGenericSubDevices, uint32_t numCcs) {
DebugManager.flags.CreateMultipleSubDevices.set(numGenericSubDevices);
auto executionEnvironment = std::make_unique<NEO::ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = numCcs;
hwInfo->featureTable.ftrCCSNode = (numCcs > 0);
HwHelper::get(hwInfo->platform.eRenderCoreFamily).adjustDefaultEngineType(hwInfo);
if (!multiCcsDevice(*hwInfo, numCcs)) {
return false;
}
executionEnvironment->parseAffinityMask();
deviceFactory = std::make_unique<NEO::UltDeviceFactory>(1, numGenericSubDevices, *executionEnvironment.release());
rootDevice = deviceFactory->rootDevices[0];
EXPECT_NE(nullptr, rootDevice);
return true;
}
bool multiCcsDevice(const HardwareInfo &hwInfo, uint32_t expectedNumCcs) {
auto gpgpuEngines = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo);
uint32_t numCcs = 0;
for (auto &engine : gpgpuEngines) {
if (EngineHelpers::isCcs(engine.first) && (engine.second == EngineUsage::Regular)) {
numCcs++;
}
}
return (numCcs == expectedNumCcs);
}
DebugManagerStateRestore restorer;
std::unique_ptr<NEO::UltDeviceFactory> deviceFactory;
MockDevice *rootDevice = nullptr;
};
HWTEST2_F(EngineInstancedDeviceExecuteTests, givenEngineInstancedDeviceWhenExecutingThenEnableSingleSliceDispatch, IsAtLeastXeHpCore) {
using CFE_STATE = typename FamilyType::CFE_STATE;
constexpr uint32_t genericDevicesCount = 1;
constexpr uint32_t ccsCount = 2;
if (!createDevices(genericDevicesCount, ccsCount)) {
GTEST_SKIP();
}
auto subDevice = static_cast<MockSubDevice *>(rootDevice->getDeviceById(0));
auto defaultEngine = subDevice->getDefaultEngine();
EXPECT_TRUE(defaultEngine.osContext->isEngineInstanced());
std::vector<std::unique_ptr<NEO::Device>> devices;
devices.push_back(std::unique_ptr<NEO::Device>(subDevice));
auto driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
driverHandle->initialize(std::move(devices));
auto l0Device = driverHandle->devices[0];
ze_command_queue_desc_t desc = {};
NEO::CommandStreamReceiver *csr;
l0Device->getCsrForOrdinalAndIndex(&csr, 0u, 0u);
ze_result_t returnValue;
auto commandQueue = whitebox_cast(CommandQueue::create(productFamily, l0Device, csr, &desc, false, false, returnValue));
auto commandList = std::unique_ptr<CommandList>(whitebox_cast(CommandList::create(productFamily, l0Device, NEO::EngineGroupType::Compute, 0u, returnValue)));
auto commandListHandle = commandList->toHandle();
commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false);
GenCmdList cmdList;
FamilyType::PARSE::parseCommandBuffer(cmdList, commandQueue->commandStream->getCpuBase(), commandQueue->commandStream->getUsed());
auto cfeStates = findAll<CFE_STATE *>(cmdList.begin(), cmdList.end());
EXPECT_NE(0u, cfeStates.size());
for (auto &cmd : cfeStates) {
auto cfeState = reinterpret_cast<CFE_STATE *>(*cmd);
EXPECT_TRUE(cfeState->getSingleSliceDispatchCcsMode());
}
commandQueue->destroy();
}
HWTEST2_F(ExecuteCommandListTests, givenTwoCommandQueuesHavingTwoB2BCommandListsWithPTSSsetForFirstCmdListThenMVSAndGSBAAreProgrammedOnlyOnce, CommandQueueExecuteSupport) {
using MEDIA_VFE_STATE = typename FamilyType::MEDIA_VFE_STATE;
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;

View File

@ -135,8 +135,7 @@ void DeviceQueueHw<GfxFamily>::addMediaStateClearCmds() {
auto pVfeState = PreambleHelper<GfxFamily>::getSpaceForVfeState(&slbCS, device->getHardwareInfo(), EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<GfxFamily>::programVfeState(pVfeState, device->getHardwareInfo(), 0u, 0, device->getSharedDeviceInfo().maxFrontEndThreads,
AdditionalKernelExecInfo::NotApplicable, emptyProperties);
PreambleHelper<GfxFamily>::programVfeState(pVfeState, device->getHardwareInfo(), 0u, 0, device->getSharedDeviceInfo().maxFrontEndThreads, emptyProperties);
}
template <typename GfxFamily>

View File

@ -9,14 +9,18 @@
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/dispatch_flags_helper.h"
#include "shared/test/common/helpers/ult_hw_config.h"
#include "shared/test/common/helpers/variable_backup.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "opencl/source/cl_device/cl_device.h"
#include "opencl/test/unit_test/libult/ult_command_stream_receiver.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
#include "test.h"
using namespace NEO;
@ -695,6 +699,33 @@ TEST_F(EngineInstancedDeviceTests, givenAffinityMaskForSingle2rdLevelDeviceOnlyW
EXPECT_TRUE(hasEngineInstancedEngines(rootDevice, engineType));
}
HWTEST2_F(EngineInstancedDeviceTests, givenEngineInstancedDeviceWhenProgrammingCfeStateThenSetSingleSliceDispatch, IsAtLeastXeHpCore) {
using CFE_STATE = typename FamilyType::CFE_STATE;
constexpr uint32_t genericDevicesCount = 1;
constexpr uint32_t ccsCount = 2;
if (!createDevices(genericDevicesCount, ccsCount)) {
GTEST_SKIP();
}
auto subDevice = static_cast<MockSubDevice *>(rootDevice->getDeviceById(0));
auto defaultEngine = subDevice->getDefaultEngine();
EXPECT_TRUE(defaultEngine.osContext->isEngineInstanced());
char buffer[64] = {};
MockGraphicsAllocation graphicsAllocation(buffer, sizeof(buffer));
LinearStream linearStream(&graphicsAllocation, graphicsAllocation.getUnderlyingBuffer(), graphicsAllocation.getUnderlyingBufferSize());
auto csr = static_cast<UltCommandStreamReceiver<FamilyType> *>(defaultEngine.commandStreamReceiver);
auto dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
csr->programVFEState(linearStream, dispatchFlags, 1);
auto cfeState = reinterpret_cast<CFE_STATE *>(buffer);
EXPECT_TRUE(cfeState->getSingleSliceDispatchCcsMode());
}
TEST(SubDevicesTest, whenInitializeRootCsrThenDirectSubmissionIsNotInitialized) {
auto device = std::make_unique<MockDevice>();
device->initializeRootCommandStreamReceiver();

View File

@ -143,7 +143,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, PreambleCfeStateXeHPPlus, givenScratchEnabledWhenPr
uint32_t expectedMaxThreads = HwHelper::getMaxThreadsForVfe(*defaultHwInfo);
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, expectedAddress, expectedMaxThreads, AdditionalKernelExecInfo::NotApplicable, emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, expectedAddress, expectedMaxThreads, emptyProperties);
parseCommands<FamilyType>(linearStream);
@ -171,7 +171,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, PreambleCfeStateXeHPPlus, givenNotSetDebugFlagWhenP
uint32_t expectedMaxThreads = HwHelper::getMaxThreadsForVfe(*defaultHwInfo);
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, expectedAddress, expectedMaxThreads, AdditionalKernelExecInfo::NotApplicable, emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, expectedAddress, expectedMaxThreads, emptyProperties);
uint32_t maximumNumberOfThreads = cfeState->getMaximumNumberOfThreads();
EXPECT_EQ(numberOfWalkers, cfeState->getNumberOfWalkers());
@ -198,7 +198,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, PreambleCfeStateXeHPPlus, givenSetDebugFlagWhenPrea
uint64_t expectedAddress = 1 << CFE_STATE::SCRATCHSPACEBUFFER_BIT_SHIFT;
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, expectedAddress, 16u, AdditionalKernelExecInfo::NotApplicable, emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, expectedAddress, 16u, emptyProperties);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());

View File

@ -48,6 +48,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
using BaseClass::programPerDssBackedBuffer;
using BaseClass::programPreamble;
using BaseClass::programStateSip;
using BaseClass::programVFEState;
using BaseClass::requiresInstructionCacheFlush;
using BaseClass::rootDeviceIndex;
using BaseClass::sshState;

View File

@ -23,8 +23,8 @@ HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEWeightedDispatchModeDisableSetFal
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, AdditionalKernelExecInfo::NotApplicable, streamProperties);
streamProperties.frontEndState.setProperties(false, false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, streamProperties);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), cfeStateIt);
@ -39,8 +39,8 @@ HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEWeightedDispatchModeDisableSetTru
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, AdditionalKernelExecInfo::NotApplicable, streamProperties);
streamProperties.frontEndState.setProperties(false, false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, streamProperties);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), cfeStateIt);
@ -56,8 +56,8 @@ HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEComputeOverdispatchDisableSetFals
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, AdditionalKernelExecInfo::NotApplicable, streamProperties);
streamProperties.frontEndState.setProperties(false, false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, streamProperties);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), cfeStateIt);
@ -72,8 +72,8 @@ HWTEST2_F(PreambleCfeState, givenXehpAndFlagCFEComputeOverdispatchDisableSetTrue
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, AdditionalKernelExecInfo::NotApplicable, streamProperties);
streamProperties.frontEndState.setProperties(false, false, false, *defaultHwInfo);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 0, streamProperties);
parseCommands<FamilyType>(linearStream);
auto cfeStateIt = find<CFE_STATE *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), cfeStateIt);

View File

@ -937,10 +937,10 @@ inline void CommandStreamReceiverHw<GfxFamily>::programVFEState(LinearStream &cs
(dispatchFlags.additionalKernelExecInfo != AdditionalKernelExecInfo::NotSet);
StreamProperties streamProperties{};
streamProperties.frontEndState.setProperties(lastKernelExecutionType == KernelExecutionType::Concurrent,
disableOverdispatch, hwInfo);
disableOverdispatch, osContext->isEngineInstanced(), hwInfo);
PreambleHelper<GfxFamily>::programVfeState(
pVfeState, hwInfo, requiredScratchSize, getScratchPatchAddress(),
maxFrontEndThreads, lastAdditionalKernelExecInfo, streamProperties);
maxFrontEndThreads, streamProperties);
auto commandOffset = PreambleHelper<GfxFamily>::getScratchSpaceAddressOffsetForVfeState(&csr, pVfeState);
if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) {

View File

@ -21,8 +21,9 @@ struct StateComputeModeProperties {
struct FrontEndProperties {
StreamProperty disableOverdispatch{};
StreamProperty singleSliceDispatchCcsMode{};
void setProperties(bool isCooperativeKernel, bool disableOverdispatch, const HardwareInfo &hwInfo);
void setProperties(bool isCooperativeKernel, bool disableOverdispatch, bool engineInstancedDevice, const HardwareInfo &hwInfo);
void setProperties(const FrontEndProperties &properties);
bool isDirty();
void clearIsDirty();

View File

@ -37,22 +37,25 @@ void StateComputeModeProperties::clearIsDirty() {
largeGrfMode.isDirty = false;
}
void FrontEndProperties::setProperties(bool isCooperativeKernel, bool disableOverdispatch, const HardwareInfo &hwInfo) {
void FrontEndProperties::setProperties(bool isCooperativeKernel, bool disableOverdispatch, bool engineInstancedDevice, const HardwareInfo &hwInfo) {
clearIsDirty();
this->disableOverdispatch.set(disableOverdispatch ? 1 : 0);
this->disableOverdispatch.set(disableOverdispatch);
this->singleSliceDispatchCcsMode.set(engineInstancedDevice);
}
void FrontEndProperties::setProperties(const FrontEndProperties &properties) {
clearIsDirty();
disableOverdispatch.set(properties.disableOverdispatch.value);
singleSliceDispatchCcsMode.set(properties.singleSliceDispatchCcsMode.value);
}
bool FrontEndProperties::isDirty() {
return disableOverdispatch.isDirty;
return disableOverdispatch.isDirty || singleSliceDispatchCcsMode.isDirty;
}
void FrontEndProperties::clearIsDirty() {
disableOverdispatch.isDirty = false;
singleSliceDispatchCcsMode.isDirty = false;
}

View File

@ -40,7 +40,7 @@ struct PreambleHelper {
static void programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy);
static void programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr);
static void addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType);
static void appendProgramVFEState(const HardwareInfo &hwInfo, const StreamProperties &streamProperties, uint32_t additionalKernelExecInfo, void *cmd);
static void appendProgramVFEState(const HardwareInfo &hwInfo, const StreamProperties &streamProperties, void *cmd);
static void *getSpaceForVfeState(LinearStream *pCommandStream,
const HardwareInfo &hwInfo,
EngineGroupType engineGroupType);
@ -49,7 +49,6 @@ struct PreambleHelper {
uint32_t scratchSize,
uint64_t scratchAddress,
uint32_t maxFrontEndThreads,
uint32_t additionalExecInfo,
const StreamProperties &streamProperties);
static uint64_t getScratchSpaceAddressOffsetForVfeState(LinearStream *pCommandStream, void *pVfeState);
static void programAdditionalFieldsInVfeState(VFE_STATE_TYPE *mediaVfeState, const HardwareInfo &hwInfo);

View File

@ -117,7 +117,7 @@ void PreambleHelper<GfxFamily>::programAdditionalFieldsInVfeState(VFE_STATE_TYPE
}
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::appendProgramVFEState(const HardwareInfo &hwInfo, const StreamProperties &streamProperties, uint32_t additionalKernelExecInfo, void *cmd) {}
void PreambleHelper<GfxFamily>::appendProgramVFEState(const HardwareInfo &hwInfo, const StreamProperties &streamProperties, void *cmd) {}
template <typename GfxFamily>
uint32_t PreambleHelper<GfxFamily>::getScratchSizeValueToProgramMediaVfeState(uint32_t scratchSize) {

View File

@ -42,7 +42,6 @@ void PreambleHelper<GfxFamily>::programVfeState(void *pVfeState,
uint32_t scratchSize,
uint64_t scratchAddress,
uint32_t maxFrontEndThreads,
uint32_t additionalExecInfo,
const StreamProperties &streamProperties) {
using MEDIA_VFE_STATE = typename GfxFamily::MEDIA_VFE_STATE;
@ -59,7 +58,7 @@ void PreambleHelper<GfxFamily>::programVfeState(void *pVfeState,
cmd.setScratchSpaceBasePointerHigh(highAddress);
programAdditionalFieldsInVfeState(&cmd, hwInfo);
appendProgramVFEState(hwInfo, streamProperties, additionalExecInfo, &cmd);
appendProgramVFEState(hwInfo, streamProperties, &cmd);
*pMediaVfeState = cmd;
}

View File

@ -80,7 +80,7 @@ uint32_t PreambleHelper<Family>::getUrbEntryAllocationSize() {
return 0u;
}
template <>
void PreambleHelper<Family>::appendProgramVFEState(const HardwareInfo &hwInfo, const StreamProperties &streamProperties, uint32_t additionalKernelExecInfo, void *cmd);
void PreambleHelper<Family>::appendProgramVFEState(const HardwareInfo &hwInfo, const StreamProperties &streamProperties, void *cmd);
template <>
void *PreambleHelper<Family>::getSpaceForVfeState(LinearStream *pCommandStream,
@ -96,7 +96,6 @@ void PreambleHelper<Family>::programVfeState(void *pVfeState,
uint32_t scratchSize,
uint64_t scratchAddress,
uint32_t maxFrontEndThreads,
uint32_t additionalKernelExecInfo,
const StreamProperties &streamProperties) {
using CFE_STATE = typename Family::CFE_STATE;
@ -108,7 +107,7 @@ void PreambleHelper<Family>::programVfeState(void *pVfeState,
uint32_t lowAddress = uint32_t(0xFFFFFFFF & scratchAddress);
cmd.setScratchSpaceBuffer(lowAddress);
cmd.setMaximumNumberOfThreads(maxFrontEndThreads);
appendProgramVFEState(hwInfo, streamProperties, additionalKernelExecInfo, &cmd);
appendProgramVFEState(hwInfo, streamProperties, &cmd);
if (DebugManager.flags.CFENumberOfWalkers.get() != -1) {
cmd.setNumberOfWalkers(DebugManager.flags.CFENumberOfWalkers.get());

View File

@ -17,10 +17,11 @@ using Family = XeHpFamily;
namespace NEO {
template <>
void PreambleHelper<Family>::appendProgramVFEState(const HardwareInfo &hwInfo, const StreamProperties &streamProperties, uint32_t additionalKernelExecInfo, void *cmd) {
void PreambleHelper<Family>::appendProgramVFEState(const HardwareInfo &hwInfo, const StreamProperties &streamProperties, void *cmd) {
auto command = static_cast<typename Family::CFE_STATE *>(cmd);
command->setComputeOverdispatchDisable(streamProperties.frontEndState.disableOverdispatch.value == 1);
command->setSingleSliceDispatchCcsMode(streamProperties.frontEndState.singleSliceDispatchCcsMode.value);
if (DebugManager.flags.CFEComputeOverdispatchDisable.get() != -1) {
command->setComputeOverdispatchDisable(DebugManager.flags.CFEComputeOverdispatchDisable.get());

View File

@ -61,9 +61,7 @@ GEN11TEST_F(Gen11PreambleVfeState, GivenWaOffWhenProgrammingVfeStateThenProgramm
LinearStream &cs = linearStream;
auto pVfeCmd = PreambleHelper<ICLFamily>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<ICLFamily>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u,
AdditionalKernelExecInfo::NotApplicable,
emptyProperties);
PreambleHelper<ICLFamily>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
parseCommands<ICLFamily>(cs);
@ -83,9 +81,7 @@ GEN11TEST_F(Gen11PreambleVfeState, GivenWaOnWhenProgrammingVfeStateThenProgrammi
LinearStream &cs = linearStream;
auto pVfeCmd = PreambleHelper<ICLFamily>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<ICLFamily>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u,
AdditionalKernelExecInfo::NotApplicable,
emptyProperties);
PreambleHelper<ICLFamily>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
parseCommands<ICLFamily>(cs);

View File

@ -65,9 +65,7 @@ HWTEST2_F(Gen12LpPreambleVfeState, GivenWaOffWhenProgrammingVfeStateThenProgramm
LinearStream &cs = linearStream;
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 672u,
AdditionalKernelExecInfo::NotApplicable,
emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 672u, emptyProperties);
parseCommands<FamilyType>(cs);
@ -89,9 +87,7 @@ HWTEST2_F(Gen12LpPreambleVfeState, givenCcsEngineWhenWaIsSetThenAppropriatePipeC
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::Compute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 672u,
AdditionalKernelExecInfo::NotApplicable,
emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 672u, emptyProperties);
parseCommands<FamilyType>(cs);
@ -112,9 +108,7 @@ HWTEST2_F(Gen12LpPreambleVfeState, givenRcsEngineWhenWaIsSetThenAppropriatePipeC
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 672u,
AdditionalKernelExecInfo::NotApplicable,
emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 672u, emptyProperties);
parseCommands<FamilyType>(cs);

View File

@ -98,8 +98,7 @@ BDWTEST_F(PreambleVfeState, WhenProgrammingVfeStateThenProgrammingIsCorrect) {
LinearStream &cs = linearStream;
auto pVfeCmd = PreambleHelper<BDWFamily>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<BDWFamily>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 168u,
AdditionalKernelExecInfo::NotApplicable, emptyProperties);
PreambleHelper<BDWFamily>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 168u, emptyProperties);
parseCommands<BDWFamily>(cs);

View File

@ -110,9 +110,7 @@ GEN9TEST_F(PreambleVfeState, GivenWaOffWhenProgrammingVfeStateThenProgrammingIsC
LinearStream &cs = linearStream;
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u,
AdditionalKernelExecInfo::NotApplicable,
emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
parseCommands<FamilyType>(cs);
@ -132,9 +130,7 @@ GEN9TEST_F(PreambleVfeState, GivenWaOnWhenProgrammingVfeStateThenProgrammingIsCo
LinearStream &cs = linearStream;
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&linearStream, pPlatform->getClDevice(0)->getHardwareInfo(), EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u,
AdditionalKernelExecInfo::NotApplicable,
emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, pPlatform->getClDevice(0)->getHardwareInfo(), 0u, 0, 168u, emptyProperties);
parseCommands<FamilyType>(cs);

View File

@ -105,9 +105,7 @@ XEHPTEST_F(XeHPPreambleVfeState, WhenProgramVFEStateIsCalledThenCorrectCfeStateA
auto pCfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&preambleStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pCfeCmd, *defaultHwInfo, 1024u, addressToPatch,
10u, AdditionalKernelExecInfo::NotApplicable,
emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pCfeCmd, *defaultHwInfo, 1024u, addressToPatch, 10u, emptyProperties);
EXPECT_GE(reinterpret_cast<uintptr_t>(pCfeCmd), reinterpret_cast<uintptr_t>(preambleStream.getCpuBase()));
EXPECT_LT(reinterpret_cast<uintptr_t>(pCfeCmd), reinterpret_cast<uintptr_t>(preambleStream.getCpuBase()) + preambleStream.getUsed());

View File

@ -23,6 +23,7 @@ std::vector<StreamProperty *> getAllStateComputeModeProperties(StateComputeModeP
std::vector<StreamProperty *> getAllFrontEndProperties(FrontEndProperties &properties) {
std::vector<StreamProperty *> allProperties;
allProperties.push_back(&properties.disableOverdispatch);
allProperties.push_back(&properties.singleSliceDispatchCcsMode);
return allProperties;
}
@ -32,8 +33,11 @@ using namespace NEO;
TEST(StreamPropertiesTests, whenSettingCooperativeKernelPropertiesThenCorrectValueIsSet) {
StreamProperties properties;
for (auto disableOverdispatch : ::testing::Bool()) {
properties.frontEndState.setProperties(false, disableOverdispatch, *defaultHwInfo);
EXPECT_EQ(disableOverdispatch, properties.frontEndState.disableOverdispatch.value);
for (auto isEngineInstanced : ::testing::Bool()) {
for (auto disableOverdispatch : ::testing::Bool()) {
properties.frontEndState.setProperties(false, disableOverdispatch, isEngineInstanced, *defaultHwInfo);
EXPECT_EQ(disableOverdispatch, properties.frontEndState.disableOverdispatch.value);
EXPECT_EQ(isEngineInstanced, properties.frontEndState.singleSliceDispatchCcsMode.value);
}
}
}

View File

@ -226,9 +226,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, PreambleTest, WhenProgramVFEStateIsCalledThenCorrect
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&preambleStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 1024u, addressToPatch,
10u, AdditionalKernelExecInfo::NotApplicable,
emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, *defaultHwInfo, 1024u, addressToPatch, 10u, emptyProperties);
EXPECT_GE(reinterpret_cast<uintptr_t>(pVfeCmd), reinterpret_cast<uintptr_t>(preambleStream.getCpuBase()));
EXPECT_LT(reinterpret_cast<uintptr_t>(pVfeCmd), reinterpret_cast<uintptr_t>(preambleStream.getCpuBase()) + preambleStream.getUsed());
@ -251,9 +249,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, PreambleTest, WhenGetScratchSpaceAddressOffsetForVfe
auto pVfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&preambleStream, mockDevice->getHardwareInfo(), EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, mockDevice->getHardwareInfo(), 1024u, addressToPatch,
10u, AdditionalKernelExecInfo::NotApplicable,
emptyProperties);
PreambleHelper<FamilyType>::programVfeState(pVfeCmd, mockDevice->getHardwareInfo(), 1024u, addressToPatch, 10u, emptyProperties);
auto offset = PreambleHelper<FamilyType>::getScratchSpaceAddressOffsetForVfeState(&preambleStream, pVfeCmd);
EXPECT_NE(0u, offset);