mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 18:06:32 +08:00
refactor: remove ReturnSubDevicesAsApiDevices from OCL and L0
Related-To: NEO-9437 Signed-off-by: Baj, Tomasz <tomasz.baj@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0b37a05329
commit
10a97548c2
@@ -870,8 +870,7 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
|
||||
|
||||
if (isSubdevice) {
|
||||
DriverHandleImp *driverHandleImp = static_cast<DriverHandleImp *>(driverHandle);
|
||||
const auto &isReturnSubDevicesAsApiDevices = NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.get();
|
||||
if (isReturnSubDevicesAsApiDevices != 1 && driverHandleImp->deviceHierarchyMode != L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_FLAT) {
|
||||
if (driverHandleImp->deviceHierarchyMode != L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_FLAT) {
|
||||
pDeviceProperties->flags |= ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,10 +373,6 @@ ze_result_t DriverHandleImp::parseAffinityMaskCombined(uint32_t *pCount, ze_devi
|
||||
ze_result_t DriverHandleImp::getDevice(uint32_t *pCount, ze_device_handle_t *phDevices) {
|
||||
bool exposeSubDevices = false;
|
||||
|
||||
if (NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.get() != -1) {
|
||||
exposeSubDevices = NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.get();
|
||||
}
|
||||
|
||||
// If the user has requested FLAT device hierarchy model, then report all the sub devices as devices.
|
||||
if (this->deviceHierarchyMode == L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_FLAT || this->deviceHierarchyMode == L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_COMBINED) {
|
||||
exposeSubDevices = true;
|
||||
@@ -899,8 +895,8 @@ ze_result_t DriverHandleImp::fabricVertexGetExp(uint32_t *pCount, ze_fabric_vert
|
||||
}
|
||||
|
||||
bool exposeSubDevices = false;
|
||||
if (NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.get() != -1) {
|
||||
exposeSubDevices = NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.get();
|
||||
if (deviceHierarchyMode == L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_FLAT) {
|
||||
exposeSubDevices = true;
|
||||
}
|
||||
|
||||
if (*pCount == 0) {
|
||||
|
||||
@@ -4853,106 +4853,6 @@ TEST(DeviceReturnCompositeHierarchyTest, GivenCompositeHierarchyIsSetThenGetRoot
|
||||
multiDeviceFixture.tearDown();
|
||||
}
|
||||
|
||||
TEST(DeviceReturnSubDevicesAsApiDevicesTest, GivenReturnSubDevicesAsApiDevicesIsSetThenFlagsOfDevicePropertiesIsCorrect) {
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::DebugManager.flags.ZE_AFFINITY_MASK.set("0,1.1,2");
|
||||
NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.set(1);
|
||||
MultiDeviceFixture multiDeviceFixture{};
|
||||
multiDeviceFixture.setUp();
|
||||
|
||||
uint32_t count = 0;
|
||||
std::vector<ze_device_handle_t> hDevices;
|
||||
EXPECT_EQ(multiDeviceFixture.driverHandle->getDevice(&count, nullptr), ZE_RESULT_SUCCESS);
|
||||
|
||||
// mask is "0,1.1,2", but with ReturnSubDevicesAsApiDevices 1.1
|
||||
// is not valid, so expected count is 2.
|
||||
EXPECT_EQ(count, 2u);
|
||||
|
||||
hDevices.resize(count);
|
||||
EXPECT_EQ(multiDeviceFixture.driverHandle->getDevice(&count, hDevices.data()), ZE_RESULT_SUCCESS);
|
||||
|
||||
for (auto &hDevice : hDevices) {
|
||||
ze_device_properties_t deviceProperties{};
|
||||
deviceProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;
|
||||
EXPECT_EQ(Device::fromHandle(hDevice)->getProperties(&deviceProperties), ZE_RESULT_SUCCESS);
|
||||
EXPECT_NE(ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE, deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE);
|
||||
|
||||
uint32_t subDeviceCount = 0;
|
||||
EXPECT_EQ(Device::fromHandle(hDevice)->getSubDevices(&subDeviceCount, nullptr), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(subDeviceCount, 0u);
|
||||
}
|
||||
|
||||
multiDeviceFixture.tearDown();
|
||||
}
|
||||
|
||||
TEST(DeviceReturnSubDevicesAsApiDevicesTest, GivenReturnSubDevicesAsApiDevicesIsNotSetThenFlagsOfDevicePropertiesIsCorrect) {
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.set(0);
|
||||
MultiDeviceFixture multiDeviceFixture{};
|
||||
multiDeviceFixture.setUp();
|
||||
|
||||
uint32_t count = 0;
|
||||
std::vector<ze_device_handle_t> hDevices;
|
||||
EXPECT_EQ(multiDeviceFixture.driverHandle->getDevice(&count, nullptr), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(count, multiDeviceFixture.numRootDevices);
|
||||
|
||||
hDevices.resize(count);
|
||||
EXPECT_EQ(multiDeviceFixture.driverHandle->getDevice(&count, hDevices.data()), ZE_RESULT_SUCCESS);
|
||||
|
||||
for (auto &hDevice : hDevices) {
|
||||
|
||||
uint32_t subDeviceCount = 0;
|
||||
EXPECT_EQ(Device::fromHandle(hDevice)->getSubDevices(&subDeviceCount, nullptr), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(subDeviceCount, multiDeviceFixture.numSubDevices);
|
||||
std::vector<ze_device_handle_t> hSubDevices(multiDeviceFixture.numSubDevices);
|
||||
EXPECT_EQ(Device::fromHandle(hDevice)->getSubDevices(&subDeviceCount, hSubDevices.data()), ZE_RESULT_SUCCESS);
|
||||
|
||||
for (auto &hSubDevice : hSubDevices) {
|
||||
ze_device_properties_t deviceProperties{};
|
||||
deviceProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;
|
||||
EXPECT_EQ(Device::fromHandle(hSubDevice)->getProperties(&deviceProperties), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE, deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE);
|
||||
}
|
||||
}
|
||||
|
||||
multiDeviceFixture.tearDown();
|
||||
}
|
||||
|
||||
TEST(DeviceReturnSubDevicesAsApiDevicesTest, GivenReturnSubDevicesAsApiDevicesIsDefaultSetThenFlagsOfDevicePropertiesIsCorrect) {
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.set(-1);
|
||||
MultiDeviceFixture multiDeviceFixture{};
|
||||
multiDeviceFixture.setUp();
|
||||
|
||||
uint32_t count = 0;
|
||||
std::vector<ze_device_handle_t> hDevices;
|
||||
EXPECT_EQ(multiDeviceFixture.driverHandle->getDevice(&count, nullptr), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(count, multiDeviceFixture.numRootDevices);
|
||||
|
||||
hDevices.resize(count);
|
||||
EXPECT_EQ(multiDeviceFixture.driverHandle->getDevice(&count, hDevices.data()), ZE_RESULT_SUCCESS);
|
||||
|
||||
for (auto &hDevice : hDevices) {
|
||||
|
||||
uint32_t subDeviceCount = 0;
|
||||
EXPECT_EQ(Device::fromHandle(hDevice)->getSubDevices(&subDeviceCount, nullptr), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(subDeviceCount, multiDeviceFixture.numSubDevices);
|
||||
std::vector<ze_device_handle_t> hSubDevices(multiDeviceFixture.numSubDevices);
|
||||
EXPECT_EQ(Device::fromHandle(hDevice)->getSubDevices(&subDeviceCount, hSubDevices.data()), ZE_RESULT_SUCCESS);
|
||||
|
||||
for (auto &hSubDevice : hSubDevices) {
|
||||
ze_device_properties_t deviceProperties{};
|
||||
deviceProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;
|
||||
EXPECT_EQ(Device::fromHandle(hSubDevice)->getProperties(&deviceProperties), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE, deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE);
|
||||
}
|
||||
}
|
||||
|
||||
multiDeviceFixture.tearDown();
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, GivenValidDeviceWhenQueryingKernelTimestampsProptertiesThenCorrectPropertiesIsReturned) {
|
||||
ze_device_properties_t devProps;
|
||||
ze_event_query_kernel_timestamps_ext_properties_t tsProps;
|
||||
|
||||
@@ -2539,9 +2539,8 @@ TEST_F(TimestampEventCreate, givenEventWhenQueryKernelTimestampThenNotReadyRetur
|
||||
EXPECT_EQ(0u, resultTimestamp.global.kernelEnd);
|
||||
}
|
||||
|
||||
TEST_F(EventPoolCreateMultiDevice, givenReturnSubDevicesAsApiDevicesWhenCallZeGetDevicesThenSubDevicesAreReturnedAsSeparateDevices) {
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.set(1);
|
||||
TEST_F(EventPoolCreateMultiDevice, givenFlatHierarchyWhenCallZeGetDevicesThenSubDevicesAreReturnedAsSeparateDevices) {
|
||||
this->driverHandle->deviceHierarchyMode = L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_FLAT;
|
||||
|
||||
uint32_t deviceCount = 0;
|
||||
ze_result_t result = zeDeviceGet(driverHandle.get(), &deviceCount, nullptr);
|
||||
|
||||
@@ -216,27 +216,26 @@ TEST_F(FabricVertexFixture, GivenDevicesAreCreatedWhenFabricVertexIsNotSetToDevi
|
||||
EXPECT_EQ(hVertex, nullptr);
|
||||
}
|
||||
|
||||
class FabricVertexSubdeviceAsDeviceTestFixture : public MultiDeviceFixture,
|
||||
public ::testing::Test {
|
||||
class FabricVertexFlatDeviceTestFixture : public MultiDeviceFixtureHierarchy,
|
||||
public ::testing::Test {
|
||||
void SetUp() override {
|
||||
NEO::DebugManager.flags.ZE_AFFINITY_MASK.set("0,1.1,2");
|
||||
NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.set(1);
|
||||
MultiDeviceFixture::setUp();
|
||||
MultiDeviceFixtureHierarchy::setUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
MultiDeviceFixture::tearDown();
|
||||
MultiDeviceFixtureHierarchy::tearDown();
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
TEST_F(FabricVertexSubdeviceAsDeviceTestFixture, GivenReturnSubDevicesAsApiDevicesIsSetWhenFabricVerticesGetExpIsCalledCorrectVerticesAreReturned) {
|
||||
TEST_F(FabricVertexFlatDeviceTestFixture, GivenFlatHierarchyWhenFabricVerticesGetExpIsCalledCorrectVerticesAreReturned) {
|
||||
uint32_t count = 0;
|
||||
std::vector<ze_fabric_vertex_handle_t> phVertices;
|
||||
EXPECT_EQ(driverHandle->fabricVertexGetExp(&count, nullptr), ZE_RESULT_SUCCESS);
|
||||
// only 2 vertexes for mask "0,1.1,2":
|
||||
// 0 and 2
|
||||
// 1.1 is ignored with ReturnSubDevicesAsApiDevices
|
||||
// 1.1 is ignored in FlatHierarchy
|
||||
uint32_t expectedVertexes = 2u;
|
||||
EXPECT_EQ(count, expectedVertexes);
|
||||
|
||||
@@ -260,7 +259,6 @@ class FabricVertexTestFixture : public MultiDeviceFixture,
|
||||
public ::testing::Test {
|
||||
void SetUp() override {
|
||||
NEO::DebugManager.flags.ZE_AFFINITY_MASK.set("0,1.1,2");
|
||||
NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.set(0);
|
||||
MultiDeviceFixture::setUp();
|
||||
}
|
||||
|
||||
@@ -270,10 +268,9 @@ class FabricVertexTestFixture : public MultiDeviceFixture,
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
TEST_F(FabricVertexTestFixture, GivenReturnSubDevicesAsApiDevicesIsSetToFalseWhenFabricVerticesGetExpIsCalledCorrectVerticesAreReturned) {
|
||||
TEST_F(FabricVertexTestFixture, GivenCompositeHierarchyWhenFabricVerticesGetExpIsCalledCorrectVerticesAreReturned) {
|
||||
uint32_t count = 0;
|
||||
std::vector<ze_fabric_vertex_handle_t> phVertices;
|
||||
NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.set(0);
|
||||
EXPECT_EQ(driverHandle->fabricVertexGetExp(&count, nullptr), ZE_RESULT_SUCCESS);
|
||||
uint32_t expectedVertexes = 3u;
|
||||
EXPECT_EQ(count, expectedVertexes);
|
||||
@@ -321,10 +318,10 @@ TEST_F(FabricVertexTestFixture, GivenReturnSubDevicesAsApiDevicesIsSetToFalseWhe
|
||||
EXPECT_EQ(countSubDevices, numSubDevices);
|
||||
}
|
||||
|
||||
TEST_F(FabricVertexTestFixture, GivenReturnSubDevicesAsApiDevicesIsSetToTrueWhenFabricVerticesGetExpIsCalledCorrectVerticesAreReturned) {
|
||||
TEST_F(FabricVertexTestFixture, GivenFlatHierarchyWhenFabricVerticesGetExpIsCalledCorrectVerticesAreReturned) {
|
||||
uint32_t count = 0;
|
||||
std::vector<ze_fabric_vertex_handle_t> phVertices;
|
||||
NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.set(1);
|
||||
this->driverHandle->deviceHierarchyMode = L0::L0DeviceHierarchyMode::L0_DEVICE_HIERARCHY_FLAT;
|
||||
EXPECT_EQ(driverHandle->fabricVertexGetExp(&count, nullptr), ZE_RESULT_SUCCESS);
|
||||
uint32_t expectedVertexes = 5u;
|
||||
EXPECT_EQ(count, expectedVertexes);
|
||||
|
||||
Reference in New Issue
Block a user