Add new EngineUsage

Simplify verifying EngineUsage in tryGetEngine function.
Remove unused getGpgpuEnginesCount function.

Related-To: NEO-4940

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2021-08-16 18:24:13 +00:00
committed by Compute-Runtime-Automation
parent fccd22e3c7
commit 63f8c9d98b
29 changed files with 89 additions and 97 deletions

View File

@@ -1874,9 +1874,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWaitOnEvents(uint32_t nu
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamily<gfxCoreFamily>::programSyncBuffer(Kernel &kernel, NEO::Device &device,
const ze_group_count_t *pThreadGroupDimensions) {
auto &hwInfo = device.getHardwareInfo();
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
if (!hwHelper.isCooperativeDispatchSupported(this->engineGroupType, hwInfo.platform.eProductFamily)) {
auto &hwHelper = NEO::HwHelper::get(device.getHardwareInfo().platform.eRenderCoreFamily);
if (!hwHelper.isCooperativeDispatchSupported(this->engineGroupType)) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}

View File

@@ -433,7 +433,8 @@ void CommandQueueHw<gfxCoreFamily>::programFrontEnd(uint64_t scratchAddress, uin
UNRECOVERABLE_IF(csr == nullptr);
auto &hwInfo = device->getHwInfo();
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
auto engineGroupType = hwHelper.getEngineGroupType(csr->getOsContext().getEngineType(), hwInfo);
auto engineGroupType = hwHelper.getEngineGroupType(csr->getOsContext().getEngineType(),
csr->getOsContext().getEngineUsage(), hwInfo);
auto pVfeState = NEO::PreambleHelper<GfxFamily>::getSpaceForVfeState(&commandStream, hwInfo, engineGroupType);
NEO::PreambleHelper<GfxFamily>::programVfeState(pVfeState,
hwInfo,

View File

@@ -165,7 +165,7 @@ ze_result_t DeviceImp::getCommandQueueGroupProperties(uint32_t *pCount,
pCommandQueueGroupProperties[engineGroupCount].flags = ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE |
ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY |
ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS;
if (hwHelper.isCooperativeDispatchSupported(static_cast<NEO::EngineGroupType>(i), hardwareInfo.platform.eProductFamily)) {
if (hwHelper.isCooperativeDispatchSupported(static_cast<NEO::EngineGroupType>(i))) {
pCommandQueueGroupProperties[engineGroupCount].flags |= ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS;
}
pCommandQueueGroupProperties[engineGroupCount].maxMemoryFillPatternSize = std::numeric_limits<size_t>::max();

View File

@@ -1815,7 +1815,7 @@ TEST_F(DeviceTest, givenCooperativeDispatchSupportedWhenQueryingPropertiesFlagsT
if (groupOrdinal >= count) {
continue;
}
auto expectedValue = hwHelper.isCooperativeDispatchSupported(engineGroupType, hwInfo.platform.eProductFamily);
auto expectedValue = hwHelper.isCooperativeDispatchSupported(engineGroupType);
auto actualValue = NEO::isValueSet(properties[groupOrdinal].flags, ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
EXPECT_EQ(expectedValue, actualValue);
}

View File

@@ -5932,13 +5932,6 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue,
auto &device = pCommandQueue->getClDevice();
auto rootDeviceIndex = device.getRootDeviceIndex();
auto &hardwareInfo = device.getHardwareInfo();
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
auto engineGroupType = hwHelper.getEngineGroupType(pCommandQueue->getGpgpuEngine().getEngineType(), hardwareInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo.platform.eProductFamily)) {
retVal = CL_INVALID_COMMAND_QUEUE;
return retVal;
}
pKernel = pMultiDeviceKernel->getKernel(rootDeviceIndex);
size_t globalWorkSize[3];
@@ -5946,6 +5939,22 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue,
globalWorkSize[i] = workgroupCount[i] * localWorkSize[i];
}
if (pKernel->usesSyncBuffer()) {
if (pKernel->getExecutionType() != KernelExecutionType::Concurrent) {
retVal = CL_INVALID_KERNEL;
return retVal;
}
auto &hardwareInfo = device.getHardwareInfo();
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
auto engineGroupType = hwHelper.getEngineGroupType(pCommandQueue->getGpgpuEngine().getEngineType(),
pCommandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType)) {
retVal = CL_INVALID_COMMAND_QUEUE;
return retVal;
}
}
if (pKernel->getExecutionType() == KernelExecutionType::Concurrent) {
size_t requestedNumberOfWorkgroups = 1;
for (size_t i = 0; i < workDim; i++) {
@@ -5958,20 +5967,15 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue,
}
}
if (pKernel->usesSyncBuffer()) {
if (pKernel->getExecutionType() != KernelExecutionType::Concurrent) {
retVal = CL_INVALID_KERNEL;
return retVal;
}
device.getDevice().allocateSyncBufferHandler();
}
if (!pCommandQueue->validateCapabilityForOperation(CL_QUEUE_CAPABILITY_KERNEL_INTEL, numEventsInWaitList, eventWaitList, event)) {
retVal = CL_INVALID_OPERATION;
return retVal;
}
if (pKernel->usesSyncBuffer()) {
device.getDevice().allocateSyncBufferHandler();
}
TakeOwnershipWrapper<MultiDeviceKernel> kernelOwnership(*pMultiDeviceKernel, gtpinIsGTPinInitialized());
if (gtpinIsGTPinInitialized()) {
gtpinNotifyKernelSubmit(kernel, pCommandQueue);

View File

@@ -608,7 +608,7 @@ cl_uint CommandQueue::getQueueFamilyIndex() const {
} else {
const auto &hwInfo = device->getHardwareInfo();
const auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
const auto engineGroupType = hwHelper.getEngineGroupType(gpgpuEngine->getEngineType(), hwInfo);
const auto engineGroupType = hwHelper.getEngineGroupType(gpgpuEngine->getEngineType(), gpgpuEngine->getEngineUsage(), hwInfo);
const auto familyIndex = device->getDevice().getIndexOfNonEmptyEngineGroup(engineGroupType);
return static_cast<cl_uint>(familyIndex);
}
@@ -843,7 +843,8 @@ void CommandQueue::processProperties(const cl_queue_properties *properties) {
auto queueFamily = getDevice().getNonEmptyEngineGroup(selectedQueueFamilyIndex);
const auto &engine = queueFamily->at(selectedQueueIndex);
auto engineType = engine.getEngineType();
this->overrideEngine(engineType);
auto engineUsage = engine.getEngineUsage();
this->overrideEngine(engineType, engineUsage);
this->queueCapabilities = getClDevice().getDeviceInfo().queueFamilyProperties[selectedQueueFamilyIndex].capabilities;
this->queueFamilyIndex = selectedQueueFamilyIndex;
this->queueIndexWithinFamily = selectedQueueIndex;
@@ -853,10 +854,10 @@ void CommandQueue::processProperties(const cl_queue_properties *properties) {
requiresCacheFlushAfterWalker = device && (device->getDeviceInfo().parentDevice != nullptr);
}
void CommandQueue::overrideEngine(aub_stream::EngineType engineType) {
void CommandQueue::overrideEngine(aub_stream::EngineType engineType, EngineUsage engineUsage) {
const HardwareInfo &hwInfo = getDevice().getHardwareInfo();
const HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
const EngineGroupType engineGroupType = hwHelper.getEngineGroupType(engineType, hwInfo);
const EngineGroupType engineGroupType = hwHelper.getEngineGroupType(engineType, engineUsage, hwInfo);
const bool isEngineCopyOnly = hwHelper.isCopyOnlyEngineType(engineGroupType);
if (isEngineCopyOnly) {

View File

@@ -347,7 +347,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
MOCKABLE_VIRTUAL void obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes, bool clearAllDependencies, bool blitEnqueue);
void storeProperties(const cl_queue_properties *properties);
void processProperties(const cl_queue_properties *properties);
void overrideEngine(aub_stream::EngineType engineType);
void overrideEngine(aub_stream::EngineType engineType, EngineUsage engineUsage);
bool bufferCpuCopyAllowed(Buffer *buffer, cl_command_type commandType, cl_bool blocking, size_t size, void *ptr,
cl_uint numEventsInWaitList, const cl_event *eventWaitList);
void providePerformanceHint(TransferProperties &transferProperties);

View File

@@ -1039,8 +1039,9 @@ uint32_t Kernel::getMaxWorkGroupCount(const cl_uint workDim, const size_t *local
auto &hardwareInfo = getHardwareInfo();
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
auto engineGroupType = hwHelper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), hardwareInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo.platform.eProductFamily)) {
auto engineGroupType = hwHelper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(),
commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType)) {
return 0;
}

View File

@@ -1567,7 +1567,7 @@ struct CommandQueueOnSpecificEngineTests : ::testing::Test {
return result;
}
EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, const HardwareInfo &hwInfo) const override {
EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const override {
switch (engineType) {
case aub_stream::ENGINE_RCS:
return EngineGroupType::RenderCompute;
@@ -1850,7 +1850,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, MultiEngineQueueHwTests, givenQueueFamilyPropertyWh
addTestValueIfAvailable(commandQueueTestValues, EngineGroupType::Compute, 3, aub_stream::ENGINE_CCS3, ccsInstances.CCS3Enabled);
for (auto &commandQueueTestValue : commandQueueTestValues) {
if (commandQueueTestValue.properties[1] >= HwHelper::getGpgpuEnginesCount(device->getHardwareInfo())) {
if (commandQueueTestValue.properties[1] >= device->getHardwareInfo().gtSystemInfo.CCSInfo.NumberOfCCSEnabled) {
continue;
}
commandQueueTestValue.clCommandQueue = clCreateCommandQueueWithProperties(&context, device.get(),

View File

@@ -309,8 +309,9 @@ using clEnqueueNDCountKernelTests = api_tests;
TEST_F(clEnqueueNDCountKernelTests, GivenQueueIncapableWhenEnqueuingNDCountKernelINTELThenInvalidOperationIsReturned) {
auto &hwHelper = HwHelper::get(::defaultHwInfo->platform.eRenderCoreFamily);
auto engineGroupType = hwHelper.getEngineGroupType(pCommandQueue->getGpgpuEngine().getEngineType(), *::defaultHwInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType, ::defaultHwInfo->platform.eProductFamily)) {
auto engineGroupType = hwHelper.getEngineGroupType(pCommandQueue->getGpgpuEngine().getEngineType(),
pCommandQueue->getGpgpuEngine().getEngineUsage(), *::defaultHwInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType)) {
GTEST_SKIP();
}
@@ -342,8 +343,9 @@ TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreSetThenClEnqueueNDCountKernel
CommandQueue *pCmdQ2 = createCommandQueue(pClDevice);
HwHelper &hwHelper = HwHelper::get(pClDevice->getDevice().getHardwareInfo().platform.eRenderCoreFamily);
auto engineGroupType = hwHelper.getEngineGroupType(pCmdQ2->getGpgpuEngine().getEngineType(), hardwareInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType, pClDevice->getDevice().getHardwareInfo().platform.eProductFamily)) {
auto engineGroupType = hwHelper.getEngineGroupType(pCmdQ2->getGpgpuEngine().getEngineType(),
pCmdQ2->getGpgpuEngine().getEngineUsage(), hardwareInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType)) {
pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, EngineUsage::LowPriority).osContext;
}
@@ -389,8 +391,9 @@ TEST_F(EnqueueKernelTest, givenKernelWhenNotAllArgsAreSetButSetKernelArgIsCalled
CommandQueue *pCmdQ2 = createCommandQueue(pClDevice);
HwHelper &hwHelper = HwHelper::get(pClDevice->getDevice().getHardwareInfo().platform.eRenderCoreFamily);
auto engineGroupType = hwHelper.getEngineGroupType(pCmdQ2->getGpgpuEngine().getEngineType(), hardwareInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType, pClDevice->getDevice().getHardwareInfo().platform.eProductFamily)) {
auto engineGroupType = hwHelper.getEngineGroupType(pCmdQ2->getGpgpuEngine().getEngineType(),
pCmdQ2->getGpgpuEngine().getEngineUsage(), hardwareInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType)) {
pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, EngineUsage::LowPriority).osContext;
}
@@ -436,8 +439,9 @@ TEST_F(EnqueueKernelTest, givenKernelWhenSetKernelArgIsCalledForEachArgButAtLeas
CommandQueue *pCmdQ2 = createCommandQueue(pClDevice);
HwHelper &hwHelper = HwHelper::get(pClDevice->getDevice().getHardwareInfo().platform.eRenderCoreFamily);
auto engineGroupType = hwHelper.getEngineGroupType(pCmdQ2->getGpgpuEngine().getEngineType(), hardwareInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType, pClDevice->getDevice().getHardwareInfo().platform.eProductFamily)) {
auto engineGroupType = hwHelper.getEngineGroupType(pCmdQ2->getGpgpuEngine().getEngineType(),
pCmdQ2->getGpgpuEngine().getEngineUsage(), hardwareInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType)) {
pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, EngineUsage::LowPriority).osContext;
}

View File

@@ -135,7 +135,8 @@ TEST_F(GetCommandQueueFamilyInfoTests, givenQueueFamilyNotSelectedWhenGettingFam
const auto &hwInfo = context.getDevice(0)->getHardwareInfo();
const auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
const auto engineGroupType = hwHelper.getEngineGroupType(context.getDevice(0)->getDefaultEngine().getEngineType(), hwInfo);
const auto engineGroupType = hwHelper.getEngineGroupType(context.getDevice(0)->getDefaultEngine().getEngineType(),
context.getDevice(0)->getDefaultEngine().getEngineUsage(), hwInfo);
const auto expectedFamilyIndex = context.getDevice(0)->getDevice().getIndexOfNonEmptyEngineGroup(engineGroupType);
cl_uint familyIndex{};

View File

@@ -91,8 +91,9 @@ class SyncBufferHandlerTest : public SyncBufferEnqueueHandlerTest {
}
bool isCooperativeDispatchSupported() {
auto engineGroupType = hwHelper->getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), hardwareInfo);
return hwHelper->isCooperativeDispatchSupported(engineGroupType, commandQueue->getDevice().getHardwareInfo().platform.eProductFamily);
auto engineGroupType = hwHelper->getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(),
commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo);
return hwHelper->isCooperativeDispatchSupported(engineGroupType);
}
const cl_uint workDim = 1;

View File

@@ -25,6 +25,7 @@
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_csr.h"
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
#include "opencl/test/unit_test/mocks/mock_os_context.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
#include "test.h"
@@ -472,7 +473,8 @@ TEST(DeviceCreation, givenFtrSimulationModeFlagTrueWhenNoOtherSimulationFlagsAre
TEST(DeviceCreation, givenDeviceWhenCheckingGpgpuEnginesCountThenNumberGreaterThanZeroIsReturned) {
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
EXPECT_GT(HwHelper::getGpgpuEnginesCount(device->getHardwareInfo()), 0u);
auto &hwHelper = HwHelper::get(renderCoreFamily);
EXPECT_GT(hwHelper.getGpgpuEngineInstances(device->getHardwareInfo()).size(), 0u);
}
TEST(DeviceCreation, givenDeviceWhenCheckingParentDeviceThenCorrectValueIsReturned) {

View File

@@ -689,7 +689,7 @@ class MockHwHelper : public HwHelperHw<GfxFamily> {
return result;
}
EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, const HardwareInfo &hwInfo) const override {
EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const override {
switch (engineType) {
case aub_stream::ENGINE_RCS:
return EngineGroupType::RenderCompute;

View File

@@ -942,13 +942,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelINTELIsExecutedThenGT
size_t localWorkSize[3] = {1, 1, 1};
CommandQueue *commandQueue = nullptr;
WithCastToInternal(cmdQ, &commandQueue);
auto &hwInfo = pDevice->getDevice().getHardwareInfo();
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
auto engineGroupType = hwHelper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), hwInfo);
if (!hwHelper.isCooperativeDispatchSupported(engineGroupType, pDevice->getDevice().getHardwareInfo().platform.eProductFamily)) {
commandQueue->getGpgpuEngine().osContext = commandQueue->getDevice().getEngine(aub_stream::ENGINE_CCS, EngineUsage::LowPriority).osContext;
}
size_t n = pKernel1->getMaxWorkGroupCount(workDim, localWorkSize, commandQueue);
size_t n = 100;
auto buff10 = clCreateBuffer(context, 0, n * sizeof(unsigned int), nullptr, nullptr);
auto buff11 = clCreateBuffer(context, 0, n * sizeof(unsigned int), nullptr, nullptr);

View File

@@ -1155,8 +1155,8 @@ HWTEST_F(HwHelperTest, givenHwHelperWhenAskingForIsaSystemMemoryPlacementThenRet
TEST_F(HwHelperTest, givenInvalidEngineTypeWhenGettingEngineGroupTypeThenThrow) {
HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
EXPECT_ANY_THROW(hwHelper.getEngineGroupType(aub_stream::EngineType::NUM_ENGINES, hardwareInfo));
EXPECT_ANY_THROW(hwHelper.getEngineGroupType(aub_stream::EngineType::ENGINE_VECS, hardwareInfo));
EXPECT_ANY_THROW(hwHelper.getEngineGroupType(aub_stream::EngineType::NUM_ENGINES, EngineUsage::Regular, hardwareInfo));
EXPECT_ANY_THROW(hwHelper.getEngineGroupType(aub_stream::EngineType::ENGINE_VECS, EngineUsage::Regular, hardwareInfo));
}
HWTEST2_F(HwInfoConfigCommonTest, givenDebugFlagSetWhenEnablingBlitterOperationsSupportThenHonorTheFlag, IsAtLeastGen12lp) {
@@ -1343,22 +1343,6 @@ HWTEST_F(HwHelperTest, whenSetRenderCompressedFlagThenProperFlagSet) {
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.RenderCompressed);
}
HWTEST_F(HwHelperTest, givenRcsOrCcsEnabledWhenQueryingGpgpuEngineCountThenReturnCorrectValue) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 3;
hwInfo.featureTable.ftrRcsNode = false;
hwInfo.featureTable.ftrCCSNode = false;
EXPECT_EQ(0u, HwHelper::getGpgpuEnginesCount(hwInfo));
hwInfo.featureTable.ftrCCSNode = true;
EXPECT_EQ(3u, HwHelper::getGpgpuEnginesCount(hwInfo));
hwInfo.featureTable.ftrRcsNode = true;
EXPECT_EQ(4u, HwHelper::getGpgpuEnginesCount(hwInfo));
}
using isXeHpCoreOrBelow = IsAtMostProduct<IGFX_XE_HP_SDV>;
HWTEST2_F(HwHelperTest, givenXeHPAndBelowPlatformWhenCheckingIfAdditionalPipeControlArgsAreRequiredThenReturnFalse, isXeHpCoreOrBelow) {
auto &hwHelper = HwHelper::get(renderCoreFamily);

View File

@@ -13,6 +13,7 @@ class MockOsContext : public OsContext {
public:
using OsContext::checkDirectSubmissionSupportsEngine;
using OsContext::engineType;
using OsContext::engineUsage;
using OsContext::getDeviceBitfield;
MockOsContext(uint32_t contextId, const EngineDescriptor &engineDescriptorHelper)

View File

@@ -937,7 +937,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::programVFEState(LinearStream &cs
}
auto &hwInfo = peekHwInfo();
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
auto engineGroupType = hwHelper.getEngineGroupType(getOsContext().getEngineType(), hwInfo);
auto engineGroupType = hwHelper.getEngineGroupType(getOsContext().getEngineType(), getOsContext().getEngineUsage(), hwInfo);
auto pVfeState = PreambleHelper<GfxFamily>::getSpaceForVfeState(&csr, hwInfo, engineGroupType);
auto disableOverdispatch = hwHelper.isDisableOverdispatchAvailable(hwInfo) &&
(dispatchFlags.additionalKernelExecInfo != AdditionalKernelExecInfo::NotSet);

View File

@@ -300,7 +300,7 @@ bool Device::createEngines() {
void Device::addEngineToEngineGroup(EngineControl &engine) {
const HardwareInfo &hardwareInfo = this->getHardwareInfo();
const HwHelper &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
const EngineGroupType engineGroupType = hwHelper.getEngineGroupType(engine.getEngineType(), hardwareInfo);
const EngineGroupType engineGroupType = hwHelper.getEngineGroupType(engine.getEngineType(), engine.getEngineUsage(), hardwareInfo);
if (!hwHelper.isSubDeviceEngineSupported(hardwareInfo, getDeviceBitfield(), engine.getEngineType())) {
return;
@@ -455,12 +455,12 @@ size_t Device::getIndexOfNonEmptyEngineGroup(EngineGroupType engineGroupType) co
EngineControl *Device::tryGetEngine(aub_stream::EngineType engineType, EngineUsage engineUsage) {
for (auto &engine : engines) {
if (engine.osContext->getEngineType() == engineType &&
engine.osContext->isLowPriority() == (engineUsage == EngineUsage::LowPriority) &&
engine.osContext->isInternalEngine() == (engineUsage == EngineUsage::Internal)) {
if ((engine.getEngineType() == engineType) &&
(engine.getEngineUsage() == engineUsage)) {
return &engine;
}
}
if (DebugManager.flags.OverrideInvalidEngineWithDefault.get()) {
return &engines[0];
}

View File

@@ -197,7 +197,7 @@ const EngineInstancesContainer HwHelperHw<Family>::getGpgpuEngineInstances(const
};
template <>
EngineGroupType HwHelperHw<Family>::getEngineGroupType(aub_stream::EngineType engineType, const HardwareInfo &hwInfo) const {
EngineGroupType HwHelperHw<Family>::getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const {
switch (engineType) {
case aub_stream::ENGINE_RCS:
return EngineGroupType::RenderCompute;

View File

@@ -23,5 +23,6 @@ struct EngineControl {
OsContext *osContext = nullptr;
aub_stream::EngineType &getEngineType() const { return osContext->getEngineType(); }
EngineUsage getEngineUsage() const { return osContext->getEngineUsage(); }
};
} // namespace NEO

View File

@@ -17,6 +17,8 @@ std::string engineUsageToString(EngineUsage usage) {
return "LowPriority";
case EngineUsage::Internal:
return "Internal";
case EngineUsage::Cooperative:
return "Cooperative";
default:
return "Unknown";
}

View File

@@ -25,6 +25,7 @@ enum class EngineUsage : uint32_t {
Regular,
LowPriority,
Internal,
Cooperative,
EngineUsageCount,
};

View File

@@ -65,17 +65,4 @@ uint32_t HwHelper::getSubDevicesCount(const HardwareInfo *pHwInfo) {
}
}
uint32_t HwHelper::getGpgpuEnginesCount(const HardwareInfo &hwInfo) {
uint32_t enginesCount = 0;
if (hwInfo.featureTable.ftrCCSNode) {
enginesCount += hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
}
if (hwInfo.featureTable.ftrRcsNode) {
enginesCount += 1;
}
return enginesCount;
}
} // namespace NEO

View File

@@ -88,7 +88,7 @@ class HwHelper {
bool forceNonAuxMode,
bool useL1Cache) = 0;
virtual const EngineInstancesContainer getGpgpuEngineInstances(const HardwareInfo &hwInfo) const = 0;
virtual EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, const HardwareInfo &hwInfo) const = 0;
virtual EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const = 0;
virtual const StackVec<size_t, 3> getDeviceSubGroupSizes() const = 0;
virtual const StackVec<uint32_t, 6> getThreadsPerEUConfigs() const = 0;
virtual bool getEnableLocalMemory(const HardwareInfo &hwInfo) const = 0;
@@ -126,7 +126,7 @@ class HwHelper {
virtual bool useOnlyGlobalTimestamps() const = 0;
virtual bool useSystemMemoryPlacementForISA(const HardwareInfo &hwInfo) const = 0;
virtual bool packedFormatsSupported() const = 0;
virtual bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const PRODUCT_FAMILY productFamily) const = 0;
virtual bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType) const = 0;
virtual size_t getMaxFillPaternSizeForCopyEngine() const = 0;
virtual bool isCopyOnlyEngineType(EngineGroupType type) const = 0;
virtual bool isSipWANeeded(const HardwareInfo &hwInfo) const = 0;
@@ -134,6 +134,7 @@ class HwHelper {
virtual bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const = 0;
virtual bool isKmdMigrationSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isNewResidencyModelSupported() const = 0;
virtual bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const = 0;
virtual aub_stream::MMIOList getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const = 0;
virtual uint32_t getDefaultRevisionId(const HardwareInfo &hwInfo) const = 0;
@@ -152,7 +153,6 @@ class HwHelper {
virtual bool additionalPipeControlArgsRequired() const = 0;
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
static uint32_t getGpgpuEnginesCount(const HardwareInfo &hwInfo);
static uint32_t getCopyEnginesCount(const HardwareInfo &hwInfo);
protected:
@@ -257,7 +257,7 @@ class HwHelperHw : public HwHelper {
const EngineInstancesContainer getGpgpuEngineInstances(const HardwareInfo &hwInfo) const override;
EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, const HardwareInfo &hwInfo) const override;
EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const override;
const StackVec<size_t, 3> getDeviceSubGroupSizes() const override;
@@ -335,7 +335,7 @@ class HwHelperHw : public HwHelper {
bool packedFormatsSupported() const override;
bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const PRODUCT_FAMILY productFamily) const override;
bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType) const override;
size_t getMaxFillPaternSizeForCopyEngine() const override;
@@ -343,6 +343,8 @@ class HwHelperHw : public HwHelper {
bool isNewResidencyModelSupported() const override;
bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override;
bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const override;
bool isCopyOnlyEngineType(EngineGroupType type) const override;

View File

@@ -592,7 +592,7 @@ bool MemorySynchronizationCommands<GfxFamily>::isPipeControlPriorToPipelineSelec
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const PRODUCT_FAMILY productFamily) const {
bool HwHelperHw<GfxFamily>::isCooperativeDispatchSupported(const EngineGroupType engineGroupType) const {
return true;
}
@@ -606,6 +606,11 @@ bool HwHelperHw<GfxFamily>::isNewResidencyModelSupported() const {
return false;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isCooperativeEngineSupported(const HardwareInfo &hwInfo) const {
return false;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
return false;

View File

@@ -60,7 +60,7 @@ const EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(co
}
template <typename GfxFamily>
EngineGroupType HwHelperHw<GfxFamily>::getEngineGroupType(aub_stream::EngineType engineType, const HardwareInfo &hwInfo) const {
EngineGroupType HwHelperHw<GfxFamily>::getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const {
switch (engineType) {
case aub_stream::ENGINE_RCS:
return EngineGroupType::RenderCompute;

View File

@@ -93,7 +93,7 @@ const EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(co
};
template <typename GfxFamily>
EngineGroupType HwHelperHw<GfxFamily>::getEngineGroupType(aub_stream::EngineType engineType, const HardwareInfo &hwInfo) const {
EngineGroupType HwHelperHw<GfxFamily>::getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const {
if (engineType == aub_stream::ENGINE_RCS) {
return EngineGroupType::RenderCompute;
}

View File

@@ -15,6 +15,7 @@ TEST(EngineNodeHelperTests, givenValidEngineUsageWhenGettingStringRepresentation
EXPECT_EQ(std::string{"Regular"}, EngineHelpers::engineUsageToString(EngineUsage::Regular));
EXPECT_EQ(std::string{"Internal"}, EngineHelpers::engineUsageToString(EngineUsage::Internal));
EXPECT_EQ(std::string{"LowPriority"}, EngineHelpers::engineUsageToString(EngineUsage::LowPriority));
EXPECT_EQ(std::string{"Cooperative"}, EngineHelpers::engineUsageToString(EngineUsage::Cooperative));
}
TEST(EngineNodeHelperTests, givenInValidEngineUsageWhenGettingStringRepresentationThenReturnUnknown) {