Update sub devices related DeviceInfo
Set correct values for devices without sub devices. Change-Id: Ibb2abf12a7fccba48470395a81b15e876fbb8c4d Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
parent
201ff85711
commit
4987ac71c4
|
@ -211,9 +211,15 @@ void Device::initializeCaps() {
|
|||
deviceInfo.compilerAvailable = CL_TRUE;
|
||||
deviceInfo.parentDevice = nullptr;
|
||||
deviceInfo.partitionMaxSubDevices = HwHelper::getSubDevicesCount(&hwInfo);
|
||||
if (deviceInfo.partitionMaxSubDevices > 1) {
|
||||
deviceInfo.partitionProperties[0] = CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN;
|
||||
deviceInfo.partitionProperties[1] = 0;
|
||||
deviceInfo.partitionAffinityDomain = CL_DEVICE_AFFINITY_DOMAIN_NUMA | CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE;
|
||||
} else {
|
||||
deviceInfo.partitionMaxSubDevices = 0;
|
||||
deviceInfo.partitionProperties[0] = 0;
|
||||
deviceInfo.partitionAffinityDomain = 0;
|
||||
}
|
||||
deviceInfo.partitionType[0] = 0;
|
||||
deviceInfo.preferredVectorWidthChar = 16;
|
||||
deviceInfo.preferredVectorWidthShort = 8;
|
||||
|
|
|
@ -124,6 +124,12 @@ struct clCreateSubDevicesDeviceInfoTests : clCreateSubDevicesTests {
|
|||
cl_device_partition_property expectedSubDevicePartitionType[3] =
|
||||
{CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN, CL_DEVICE_AFFINITY_DOMAIN_NUMA, 0};
|
||||
|
||||
cl_device_id expectedRootDeviceWithoutSubDevicesParentDevice = nullptr;
|
||||
cl_device_affinity_domain expectedRootDeviceWithoutSubDevicesPartitionAffinityDomain = 0;
|
||||
cl_uint expectedRootDeviceWithoutSubDevicesPartitionMaxSubDevices = 0;
|
||||
cl_device_partition_property expectedRootDeviceWithoutSubDevicesPartitionProperties[2] = {0};
|
||||
cl_device_partition_property expectedRootDeviceWithoutSubDevicesPartitionType[3] = {0};
|
||||
|
||||
cl_device_id parentDevice;
|
||||
cl_device_affinity_domain partitionAffinityDomain;
|
||||
cl_uint partitionMaxSubDevices;
|
||||
|
@ -157,6 +163,17 @@ TEST_F(clCreateSubDevicesDeviceInfoTests, WhenGettingSubDeviceRelatedDeviceInfoT
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(clCreateSubDevicesDeviceInfoTests, GivenRootDeviceWithoutSubDevicesWhenGettingSubDeviceRelatedDeviceInfoThenCorrectValuesAreSet) {
|
||||
setup(1);
|
||||
|
||||
auto &rootDeviceInfo = device->getDeviceInfo();
|
||||
EXPECT_EQ(expectedRootDeviceWithoutSubDevicesParentDevice, rootDeviceInfo.parentDevice);
|
||||
EXPECT_EQ(expectedRootDeviceWithoutSubDevicesPartitionAffinityDomain, rootDeviceInfo.partitionAffinityDomain);
|
||||
EXPECT_EQ(expectedRootDeviceWithoutSubDevicesPartitionMaxSubDevices, rootDeviceInfo.partitionMaxSubDevices);
|
||||
EXPECT_EQ(expectedRootDeviceWithoutSubDevicesPartitionProperties[0], rootDeviceInfo.partitionProperties[0]);
|
||||
EXPECT_EQ(expectedRootDeviceWithoutSubDevicesPartitionType[0], rootDeviceInfo.partitionType[0]);
|
||||
}
|
||||
|
||||
TEST_F(clCreateSubDevicesDeviceInfoTests, WhenGettingSubDeviceRelatedDeviceInfoViaApiThenCorrectValuesAreSet) {
|
||||
setup(4);
|
||||
|
||||
|
@ -198,4 +215,23 @@ TEST_F(clCreateSubDevicesDeviceInfoTests, WhenGettingSubDeviceRelatedDeviceInfoV
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(clCreateSubDevicesDeviceInfoTests, GivenRootDeviceWithoutSubDevicesWhenGettingSubDeviceRelatedDeviceInfoViaApiThenCorrectValuesAreSet) {
|
||||
setup(1);
|
||||
|
||||
clGetDeviceInfo(device.get(), CL_DEVICE_PARENT_DEVICE, sizeof(parentDevice), &parentDevice, nullptr);
|
||||
EXPECT_EQ(expectedRootDeviceWithoutSubDevicesParentDevice, parentDevice);
|
||||
|
||||
clGetDeviceInfo(device.get(), CL_DEVICE_PARTITION_AFFINITY_DOMAIN, sizeof(partitionAffinityDomain), &partitionAffinityDomain, nullptr);
|
||||
EXPECT_EQ(expectedRootDeviceWithoutSubDevicesPartitionAffinityDomain, partitionAffinityDomain);
|
||||
|
||||
clGetDeviceInfo(device.get(), CL_DEVICE_PARTITION_MAX_SUB_DEVICES, sizeof(partitionMaxSubDevices), &partitionMaxSubDevices, nullptr);
|
||||
EXPECT_EQ(expectedRootDeviceWithoutSubDevicesPartitionMaxSubDevices, partitionMaxSubDevices);
|
||||
|
||||
clGetDeviceInfo(device.get(), CL_DEVICE_PARTITION_PROPERTIES, sizeof(partitionProperties), &partitionProperties, nullptr);
|
||||
EXPECT_EQ(expectedRootDeviceWithoutSubDevicesPartitionProperties[0], partitionProperties[0]);
|
||||
|
||||
clGetDeviceInfo(device.get(), CL_DEVICE_PARTITION_TYPE, sizeof(partitionType), &partitionType, nullptr);
|
||||
EXPECT_EQ(expectedRootDeviceWithoutSubDevicesPartitionType[0], partitionType[0]);
|
||||
}
|
||||
|
||||
} // namespace ULT
|
||||
|
|
Loading…
Reference in New Issue