mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Unify Device methods
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
60772197a4
commit
75e8dc499e
@ -533,7 +533,7 @@ TEST_F(EngineInstancedDeviceTests, givenEngineInstancedSubDeviceWhenEngineCreati
|
||||
subDevice->failOnCreateEngine = true;
|
||||
subDevice->engineInstancedType = gpgpuEngines[0].first;
|
||||
|
||||
EXPECT_FALSE(subDevice->createEnginesForEngineInstancedDevice());
|
||||
EXPECT_FALSE(subDevice->createEngines());
|
||||
}
|
||||
|
||||
TEST_F(EngineInstancedDeviceTests, givenAffinityMaskSetWhenCreatingDevicesThenFilterMaskedDevices) {
|
||||
|
@ -229,13 +229,23 @@ bool Device::createDeviceImpl() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Device::engineSupported(const EngineTypeUsage &engineTypeUsage) const {
|
||||
if (engineInstanced) {
|
||||
return (EngineHelpers::isBcs(engineTypeUsage.first) || (engineTypeUsage.first == this->engineInstancedType));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Device::createEngines() {
|
||||
auto &hwInfo = getHardwareInfo();
|
||||
auto gpgpuEngines = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo);
|
||||
|
||||
this->engineGroups.resize(static_cast<uint32_t>(EngineGroupType::MaxEngineGroups));
|
||||
for (uint32_t deviceCsrIndex = 0; deviceCsrIndex < gpgpuEngines.size(); deviceCsrIndex++) {
|
||||
if (!createEngine(deviceCsrIndex, gpgpuEngines[deviceCsrIndex])) {
|
||||
|
||||
uint32_t deviceCsrIndex = 0;
|
||||
for (auto &engine : gpgpuEngines) {
|
||||
if (engineSupported(engine) && !createEngine(deviceCsrIndex++, engine)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,9 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
|
||||
MOCKABLE_VIRTUAL bool createDeviceImpl();
|
||||
virtual bool createEngines();
|
||||
|
||||
void addEngineToEngineGroup(EngineControl &engine);
|
||||
bool engineSupported(const EngineTypeUsage &engineTypeUsage) const;
|
||||
MOCKABLE_VIRTUAL bool createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsage);
|
||||
MOCKABLE_VIRTUAL std::unique_ptr<CommandStreamReceiver> createCommandStreamReceiver() const;
|
||||
MOCKABLE_VIRTUAL SubDevice *createSubDevice(uint32_t subDeviceIndex);
|
||||
|
@ -50,30 +50,4 @@ uint64_t SubDevice::getGlobalMemorySize(uint32_t deviceBitfield) const {
|
||||
return globalMemorySize / rootDevice.getNumAvailableDevices();
|
||||
}
|
||||
|
||||
bool SubDevice::createEngines() {
|
||||
if (engineInstanced) {
|
||||
return createEnginesForEngineInstancedDevice();
|
||||
}
|
||||
|
||||
return Device::createEngines();
|
||||
}
|
||||
|
||||
bool SubDevice::createEnginesForEngineInstancedDevice() {
|
||||
this->engineGroups.resize(static_cast<uint32_t>(EngineGroupType::MaxEngineGroups));
|
||||
|
||||
auto &hwInfo = getHardwareInfo();
|
||||
auto gpgpuEngines = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo);
|
||||
|
||||
uint32_t deviceCsrIndex = 0;
|
||||
|
||||
for (auto &engine : gpgpuEngines) {
|
||||
if (EngineHelpers::isBcs(engine.first) || (engine.first == this->engineInstancedType)) {
|
||||
if (!createEngine(deviceCsrIndex++, engine)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -27,8 +27,6 @@ class SubDevice : public Device {
|
||||
protected:
|
||||
uint64_t getGlobalMemorySize(uint32_t deviceBitfield) const override;
|
||||
bool genericSubDevicesAllowed() override { return false; };
|
||||
bool createEngines() override;
|
||||
bool createEnginesForEngineInstancedDevice();
|
||||
|
||||
RootDevice &rootDevice;
|
||||
const uint32_t subDeviceIndex;
|
||||
|
@ -28,9 +28,9 @@ extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executio
|
||||
const DeviceBitfield deviceBitfield);
|
||||
|
||||
struct MockSubDevice : public SubDevice {
|
||||
using Device::createEngines;
|
||||
using Device::engineInstancedType;
|
||||
using Device::engines;
|
||||
using SubDevice::createEnginesForEngineInstancedDevice;
|
||||
using SubDevice::engineInstanced;
|
||||
using SubDevice::getDeviceBitfield;
|
||||
using SubDevice::getGlobalMemorySize;
|
||||
|
Reference in New Issue
Block a user