mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
Add helper engines to EngineInstanced Device
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
274fe055e9
commit
4fb5ceeb89
@@ -1552,8 +1552,8 @@ struct CommandQueueOnSpecificEngineTests : ::testing::Test {
|
|||||||
template <typename GfxFamily, int rcsCount, int ccsCount, int bcsCount>
|
template <typename GfxFamily, int rcsCount, int ccsCount, int bcsCount>
|
||||||
class MockHwHelper : public HwHelperHw<GfxFamily> {
|
class MockHwHelper : public HwHelperHw<GfxFamily> {
|
||||||
public:
|
public:
|
||||||
const HwHelper::EngineInstancesContainer getGpgpuEngineInstances(const HardwareInfo &hwInfo) const override {
|
const EngineInstancesContainer getGpgpuEngineInstances(const HardwareInfo &hwInfo) const override {
|
||||||
HwHelper::EngineInstancesContainer result{};
|
EngineInstancesContainer result{};
|
||||||
for (int i = 0; i < rcsCount; i++) {
|
for (int i = 0; i < rcsCount; i++) {
|
||||||
result.push_back({aub_stream::ENGINE_RCS, EngineUsage::Regular});
|
result.push_back({aub_stream::ENGINE_RCS, EngineUsage::Regular});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -678,8 +678,8 @@ TEST(GetDeviceInfo, WhenQueryingGenericAddressSpaceSupportThenProperValueIsRetur
|
|||||||
template <typename GfxFamily, int ccsCount, int bcsCount>
|
template <typename GfxFamily, int ccsCount, int bcsCount>
|
||||||
class MockHwHelper : public HwHelperHw<GfxFamily> {
|
class MockHwHelper : public HwHelperHw<GfxFamily> {
|
||||||
public:
|
public:
|
||||||
const HwHelper::EngineInstancesContainer getGpgpuEngineInstances(const HardwareInfo &hwInfo) const override {
|
const EngineInstancesContainer getGpgpuEngineInstances(const HardwareInfo &hwInfo) const override {
|
||||||
HwHelper::EngineInstancesContainer result{};
|
EngineInstancesContainer result{};
|
||||||
for (int i = 0; i < ccsCount; i++) {
|
for (int i = 0; i < ccsCount; i++) {
|
||||||
result.push_back({aub_stream::ENGINE_CCS, EngineUsage::Regular});
|
result.push_back({aub_stream::ENGINE_CCS, EngineUsage::Regular});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,7 +366,14 @@ struct EngineInstancedDeviceTests : public ::testing::Test {
|
|||||||
|
|
||||||
template <typename MockDeviceT>
|
template <typename MockDeviceT>
|
||||||
bool hasEngineInstancedEngines(MockDeviceT *device, aub_stream::EngineType engineType) {
|
bool hasEngineInstancedEngines(MockDeviceT *device, aub_stream::EngineType engineType) {
|
||||||
bool ccsFound = false;
|
bool regularCcsFound = false;
|
||||||
|
bool internalCcsFound = false;
|
||||||
|
bool lowPriorityCcsFound = false;
|
||||||
|
|
||||||
|
OsContext *defaultOsContext = device->getDefaultEngine().osContext;
|
||||||
|
EXPECT_EQ(engineType, defaultOsContext->getEngineType());
|
||||||
|
EXPECT_EQ(EngineUsage::Regular, defaultOsContext->getEngineUsage());
|
||||||
|
EXPECT_TRUE(defaultOsContext->isDefaultContext());
|
||||||
|
|
||||||
for (auto &engine : device->engines) {
|
for (auto &engine : device->engines) {
|
||||||
if ((engine.getEngineType() != engineType) && !EngineHelpers::isBcs(engine.getEngineType())) {
|
if ((engine.getEngineType() != engineType) && !EngineHelpers::isBcs(engine.getEngineType())) {
|
||||||
@@ -377,17 +384,25 @@ struct EngineInstancedDeviceTests : public ::testing::Test {
|
|||||||
|
|
||||||
auto osContext = engine.osContext;
|
auto osContext = engine.osContext;
|
||||||
|
|
||||||
if ((engine.getEngineType() == engineType) &&
|
if (engine.getEngineType() == engineType) {
|
||||||
osContext->isDefaultContext() &&
|
if (osContext->isRegular()) {
|
||||||
osContext->isRegular() &&
|
EXPECT_FALSE(regularCcsFound);
|
||||||
!osContext->isLowPriority() &&
|
regularCcsFound = true;
|
||||||
!osContext->isInternalEngine()) {
|
} else if (osContext->isLowPriority()) {
|
||||||
EXPECT_FALSE(ccsFound);
|
EXPECT_FALSE(lowPriorityCcsFound);
|
||||||
ccsFound = true;
|
lowPriorityCcsFound = true;
|
||||||
|
} else if (osContext->isInternalEngine()) {
|
||||||
|
EXPECT_FALSE(internalCcsFound);
|
||||||
|
internalCcsFound = true;
|
||||||
|
} else {
|
||||||
|
EXPECT_TRUE(false);
|
||||||
|
}
|
||||||
|
} else if (!EngineHelpers::isBcs(engine.getEngineType())) {
|
||||||
|
EXPECT_TRUE(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ccsFound;
|
return (regularCcsFound && internalCcsFound && lowPriorityCcsFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
|
|||||||
@@ -261,21 +261,36 @@ bool Device::createDeviceImpl() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Device::engineSupported(const EngineTypeUsage &engineTypeUsage) const {
|
void Device::translateToEngineInstanced(EngineInstancesContainer &engineInstancesContainer) {
|
||||||
if (engineInstanced) {
|
EngineInstancesContainer newEngines;
|
||||||
return (EngineHelpers::isBcs(engineTypeUsage.first) || (engineTypeUsage.first == this->engineInstancedType));
|
|
||||||
|
for (auto &engine : engineInstancesContainer) {
|
||||||
|
if (EngineHelpers::isBcs(engine.first) || (engine.first == this->engineInstancedType) || (engine.second != EngineUsage::Regular)) {
|
||||||
|
newEngines.push_back(engine);
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override non-Regular (internal, low priority, ..) to engineInstancedType
|
||||||
|
if (newEngines.rbegin()->second != EngineUsage::Regular && !EngineHelpers::isBcs(newEngines.rbegin()->first)) {
|
||||||
|
newEngines.rbegin()->first = this->engineInstancedType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
std::swap(newEngines, engineInstancesContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Device::createEngines() {
|
bool Device::createEngines() {
|
||||||
auto &hwInfo = getHardwareInfo();
|
auto &hwInfo = getHardwareInfo();
|
||||||
auto gpgpuEngines = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo);
|
auto gpgpuEngines = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo);
|
||||||
|
|
||||||
|
if (engineInstanced) {
|
||||||
|
translateToEngineInstanced(gpgpuEngines);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t deviceCsrIndex = 0;
|
uint32_t deviceCsrIndex = 0;
|
||||||
for (auto &engine : gpgpuEngines) {
|
for (auto &engine : gpgpuEngines) {
|
||||||
if (engineSupported(engine) && !createEngine(deviceCsrIndex++, engine)) {
|
if (!createEngine(deviceCsrIndex++, engine)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -307,7 +322,7 @@ bool Device::createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsa
|
|||||||
const auto &hwInfo = getHardwareInfo();
|
const auto &hwInfo = getHardwareInfo();
|
||||||
const auto engineType = engineTypeUsage.first;
|
const auto engineType = engineTypeUsage.first;
|
||||||
const auto engineUsage = engineTypeUsage.second;
|
const auto engineUsage = engineTypeUsage.second;
|
||||||
const auto defaultEngineType = getChosenEngineType(hwInfo);
|
const auto defaultEngineType = engineInstanced ? this->engineInstancedType : getChosenEngineType(hwInfo);
|
||||||
const bool isDefaultEngine = defaultEngineType == engineType && engineUsage == EngineUsage::Regular;
|
const bool isDefaultEngine = defaultEngineType == engineType && engineUsage == EngineUsage::Regular;
|
||||||
const bool createAsEngineInstanced = engineInstanced && EngineHelpers::isCcs(engineType);
|
const bool createAsEngineInstanced = engineInstanced && EngineHelpers::isCcs(engineType);
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,6 @@ class Device : public ReferenceTrackedObject<Device> {
|
|||||||
virtual bool createEngines();
|
virtual bool createEngines();
|
||||||
|
|
||||||
void addEngineToEngineGroup(EngineControl &engine);
|
void addEngineToEngineGroup(EngineControl &engine);
|
||||||
bool engineSupported(const EngineTypeUsage &engineTypeUsage) const;
|
|
||||||
MOCKABLE_VIRTUAL bool createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsage);
|
MOCKABLE_VIRTUAL bool createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsage);
|
||||||
MOCKABLE_VIRTUAL std::unique_ptr<CommandStreamReceiver> createCommandStreamReceiver() const;
|
MOCKABLE_VIRTUAL std::unique_ptr<CommandStreamReceiver> createCommandStreamReceiver() const;
|
||||||
MOCKABLE_VIRTUAL SubDevice *createSubDevice(uint32_t subDeviceIndex);
|
MOCKABLE_VIRTUAL SubDevice *createSubDevice(uint32_t subDeviceIndex);
|
||||||
@@ -156,6 +155,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
|||||||
virtual bool genericSubDevicesAllowed();
|
virtual bool genericSubDevicesAllowed();
|
||||||
bool engineInstancedSubDevicesAllowed();
|
bool engineInstancedSubDevicesAllowed();
|
||||||
void setAsEngineInstanced();
|
void setAsEngineInstanced();
|
||||||
|
void translateToEngineInstanced(EngineInstancesContainer &engineInstancesContainer);
|
||||||
|
|
||||||
DeviceInfo deviceInfo = {};
|
DeviceInfo deviceInfo = {};
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ uint32_t HwHelperHw<Family>::getMetricsLibraryGenId() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
const HwHelper::EngineInstancesContainer HwHelperHw<Family>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
const EngineInstancesContainer HwHelperHw<Family>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
||||||
auto defaultEngine = getChosenEngineType(hwInfo);
|
auto defaultEngine = getChosenEngineType(hwInfo);
|
||||||
|
|
||||||
EngineInstancesContainer engines = {
|
EngineInstancesContainer engines = {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "shared/source/command_stream/preemption_mode.h"
|
#include "shared/source/command_stream/preemption_mode.h"
|
||||||
#include "shared/source/helpers/common_types.h"
|
#include "shared/source/helpers/common_types.h"
|
||||||
|
#include "shared/source/utilities/stackvec.h"
|
||||||
|
|
||||||
#include "engine_node.h"
|
#include "engine_node.h"
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ enum class EngineUsage : uint32_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
using EngineTypeUsage = std::pair<aub_stream::EngineType, EngineUsage>;
|
using EngineTypeUsage = std::pair<aub_stream::EngineType, EngineUsage>;
|
||||||
|
using EngineInstancesContainer = StackVec<EngineTypeUsage, 32>;
|
||||||
|
|
||||||
struct EngineDescriptor {
|
struct EngineDescriptor {
|
||||||
EngineDescriptor() = delete;
|
EngineDescriptor() = delete;
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ enum class LocalMemoryAccessMode {
|
|||||||
|
|
||||||
class HwHelper {
|
class HwHelper {
|
||||||
public:
|
public:
|
||||||
using EngineInstancesContainer = StackVec<EngineTypeUsage, 32>;
|
|
||||||
static HwHelper &get(GFXCORE_FAMILY gfxCore);
|
static HwHelper &get(GFXCORE_FAMILY gfxCore);
|
||||||
virtual uint32_t getBindingTableStateSurfaceStatePointer(const void *pBindingTable, uint32_t index) = 0;
|
virtual uint32_t getBindingTableStateSurfaceStatePointer(const void *pBindingTable, uint32_t index) = 0;
|
||||||
virtual size_t getBindingTableStateSize() const = 0;
|
virtual size_t getBindingTableStateSize() const = 0;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ bool HwHelperHw<GfxFamily>::timestampPacketWriteSupported() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
const HwHelper::EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
const EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
||||||
return {
|
return {
|
||||||
{aub_stream::ENGINE_RCS, EngineUsage::Regular},
|
{aub_stream::ENGINE_RCS, EngineUsage::Regular},
|
||||||
{aub_stream::ENGINE_RCS, EngineUsage::LowPriority},
|
{aub_stream::ENGINE_RCS, EngineUsage::LowPriority},
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ bool HwHelperHw<GfxFamily>::timestampPacketWriteSupported() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
const HwHelper::EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
const EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
||||||
auto defaultEngine = getChosenEngineType(hwInfo);
|
auto defaultEngine = getChosenEngineType(hwInfo);
|
||||||
|
|
||||||
EngineInstancesContainer engines;
|
EngineInstancesContainer engines;
|
||||||
|
|||||||
Reference in New Issue
Block a user