Fix OCL SubDevice creation
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
parent
3a5067c83f
commit
4865b2b9e8
|
@ -35,23 +35,24 @@ ClDevice::ClDevice(Device &device, ClDevice &rootClDevice, Platform *platform) :
|
|||
compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(deviceInfo.deviceExtensions, emptyOpenClCFeatures);
|
||||
compilerExtensionsWithFeatures = convertEnabledExtensionsToCompilerInternalOptions(deviceInfo.deviceExtensions, deviceInfo.openclCFeatures);
|
||||
|
||||
auto numAvailableDevices = device.getNumSubDevices();
|
||||
if (numAvailableDevices > 1) {
|
||||
for (uint32_t i = 0; i < numAvailableDevices; i++) {
|
||||
auto &coreSubDevice = static_cast<SubDevice &>(*device.getSubDevice(i));
|
||||
auto pClSubDevice = std::make_unique<ClDevice>(coreSubDevice, rootClDevice, platform);
|
||||
pClSubDevice->incRefInternal();
|
||||
pClSubDevice->decRefApi();
|
||||
|
||||
auto &deviceInfo = pClSubDevice->deviceInfo;
|
||||
deviceInfo.parentDevice = this;
|
||||
deviceInfo.partitionType[0] = CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN;
|
||||
deviceInfo.partitionType[1] = CL_DEVICE_AFFINITY_DOMAIN_NUMA;
|
||||
deviceInfo.partitionType[2] = 0;
|
||||
|
||||
subDevices.push_back(std::move(pClSubDevice));
|
||||
for (auto &subDevice : device.getSubDevices()) {
|
||||
if (!subDevice) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto pClSubDevice = std::make_unique<ClDevice>(*subDevice, rootClDevice, platform);
|
||||
pClSubDevice->incRefInternal();
|
||||
pClSubDevice->decRefApi();
|
||||
|
||||
auto &deviceInfo = pClSubDevice->deviceInfo;
|
||||
deviceInfo.parentDevice = this;
|
||||
deviceInfo.partitionType[0] = CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN;
|
||||
deviceInfo.partitionType[1] = CL_DEVICE_AFFINITY_DOMAIN_NUMA;
|
||||
deviceInfo.partitionType[2] = 0;
|
||||
|
||||
subDevices.push_back(std::move(pClSubDevice));
|
||||
}
|
||||
|
||||
if (getSharedDeviceInfo().debuggerActive && getSourceLevelDebugger()) {
|
||||
auto osInterface = device.getRootDeviceEnvironment().osInterface.get();
|
||||
getSourceLevelDebugger()->notifyNewDevice(osInterface ? osInterface->getDriverModel()->getDeviceHandle() : 0);
|
||||
|
|
|
@ -850,6 +850,23 @@ TEST_F(EngineInstancedDeviceTests, givenAffinityMaskForSecondLevelOnSingleTileDe
|
|||
EXPECT_EQ(0u, rootDevice->getNumSubDevices());
|
||||
}
|
||||
|
||||
TEST_F(EngineInstancedDeviceTests, givenAffinityMaskWhenCreatingClSubDevicesThenSkipDisabledDevices) {
|
||||
constexpr uint32_t genericDevicesCount = 3;
|
||||
constexpr uint32_t ccsCount = 1;
|
||||
|
||||
DebugManager.flags.ZE_AFFINITY_MASK.set("0.0,0.2");
|
||||
|
||||
if (!createDevices(genericDevicesCount, ccsCount)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
auto clRootDevice = std::make_unique<ClDevice>(*rootDevice, nullptr);
|
||||
|
||||
ASSERT_EQ(2u, clRootDevice->getNumSubDevices());
|
||||
EXPECT_EQ(0b1u, clRootDevice->getSubDevice(0)->getDeviceBitfield().to_ulong());
|
||||
EXPECT_EQ(0b100u, clRootDevice->getSubDevice(1)->getDeviceBitfield().to_ulong());
|
||||
}
|
||||
|
||||
HWTEST2_F(EngineInstancedDeviceTests, givenEngineInstancedDeviceWhenProgrammingCfeStateThenSetSingleSliceDispatch, IsAtLeastXeHpCore) {
|
||||
using CFE_STATE = typename FamilyType::CFE_STATE;
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
|||
void initializeRayTracing();
|
||||
|
||||
virtual uint64_t getGlobalMemorySize(uint32_t deviceBitfield) const;
|
||||
const std::vector<SubDevice *> getSubDevices() const { return subdevices; }
|
||||
|
||||
protected:
|
||||
Device() = delete;
|
||||
|
|
Loading…
Reference in New Issue