mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
Add ze_eu_count_t to get total number of EUs
Related-To: LOCI-2667 Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2e9925c231
commit
24c18beada
@@ -562,6 +562,19 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
|
||||
std::string name = getNEODevice()->getDeviceInfo().name;
|
||||
memcpy_s(pDeviceProperties->name, name.length(), name.c_str(), name.length());
|
||||
|
||||
if (pDeviceProperties->pNext) {
|
||||
ze_base_desc_t *extendedDesc = reinterpret_cast<ze_base_desc_t *>(pDeviceProperties->pNext);
|
||||
if (extendedDesc->stype == ZE_STRUCTURE_TYPE_EU_COUNT_EXT) {
|
||||
ze_eu_count_ext_t *ze_eu_count_desc = reinterpret_cast<ze_eu_count_ext_t *>(extendedDesc);
|
||||
uint32_t numTotalEUs = hardwareInfo.gtSystemInfo.MaxEuPerSubSlice * hardwareInfo.gtSystemInfo.SubSliceCount * hardwareInfo.gtSystemInfo.SliceCount;
|
||||
|
||||
if (isImplicitScalingCapable()) {
|
||||
numTotalEUs *= neoDevice->getNumGenericSubDevices();
|
||||
}
|
||||
ze_eu_count_desc->numTotalEUs = numTotalEUs;
|
||||
}
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
SUCCESS_OR_TERMINATE(zeContextDestroy(context));
|
||||
|
||||
std::cout << "\nZello World Results validation " << (outputValidationSuccessful ? "PASSED" : "FAILED") << "\n";
|
||||
std::cout << "\nZello World GPU Results validation " << (outputValidationSuccessful ? "PASSED" : "FAILED") << "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -966,6 +966,34 @@ TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDevicePropertiesCalledThenA
|
||||
EXPECT_NE(deviceProperties.maxMemAllocSize, devicePropertiesBefore.maxMemAllocSize);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, WhenRequestingZeEuCountThenExpectedEUsAreReturned) {
|
||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
ze_eu_count_ext_t ze_eu_count_desc = {ZE_STRUCTURE_TYPE_EU_COUNT_EXT};
|
||||
deviceProperties.pNext = &ze_eu_count_desc;
|
||||
|
||||
uint32_t maxEuPerSubSlice = 48;
|
||||
uint32_t subSliceCount = 8;
|
||||
uint32_t sliceCount = 1;
|
||||
|
||||
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.MaxEuPerSubSlice = maxEuPerSubSlice;
|
||||
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SubSliceCount = subSliceCount;
|
||||
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount = sliceCount;
|
||||
|
||||
device->getProperties(&deviceProperties);
|
||||
|
||||
uint32_t expectedEUs = maxEuPerSubSlice * subSliceCount * sliceCount;
|
||||
|
||||
EXPECT_EQ(expectedEUs, ze_eu_count_desc.numTotalEUs);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, WhenRequestingZeEuCountWithIncorrectStypeThenPNextIsIgnored) {
|
||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
ze_eu_count_ext_t ze_eu_count_desc = {ZE_STRUCTURE_TYPE_SCHEDULING_HINT_EXP_PROPERTIES};
|
||||
deviceProperties.pNext = &ze_eu_count_desc;
|
||||
device->getProperties(&deviceProperties);
|
||||
EXPECT_EQ(0u, ze_eu_count_desc.numTotalEUs);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, WhenGettingDevicePropertiesThenSubslicesPerSliceIsBasedOnSubslicesSupported) {
|
||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
deviceProperties.type = ZE_DEVICE_TYPE_GPU;
|
||||
@@ -1640,6 +1668,27 @@ TEST_F(MultipleDevicesDisabledImplicitScalingTest, whenCallingGetMemoryPropertie
|
||||
EXPECT_EQ(memProperties.totalSize, device0->getNEODevice()->getDeviceInfo().globalMemSize / numSubDevices);
|
||||
}
|
||||
|
||||
TEST_F(MultipleDevicesEnabledImplicitScalingTest, WhenRequestingZeEuCountThenExpectedEUsAreReturned) {
|
||||
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
ze_eu_count_ext_t ze_eu_count_desc = {ZE_STRUCTURE_TYPE_EU_COUNT_EXT};
|
||||
deviceProperties.pNext = &ze_eu_count_desc;
|
||||
|
||||
uint32_t maxEuPerSubSlice = 48;
|
||||
uint32_t subSliceCount = 8;
|
||||
uint32_t sliceCount = 1;
|
||||
|
||||
L0::Device *device = driverHandle->devices[0];
|
||||
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.MaxEuPerSubSlice = maxEuPerSubSlice;
|
||||
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SubSliceCount = subSliceCount;
|
||||
device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo()->gtSystemInfo.SliceCount = sliceCount;
|
||||
|
||||
device->getProperties(&deviceProperties);
|
||||
|
||||
uint32_t expectedEUs = maxEuPerSubSlice * subSliceCount * sliceCount;
|
||||
|
||||
EXPECT_EQ(expectedEUs * numSubDevices, ze_eu_count_desc.numTotalEUs);
|
||||
}
|
||||
|
||||
TEST_F(MultipleDevicesEnabledImplicitScalingTest, whenCallingGetMemoryPropertiesWithSubDevicesThenCorrectSizeReturned) {
|
||||
L0::Device *device0 = driverHandle->devices[0];
|
||||
uint32_t count = 1;
|
||||
|
||||
Reference in New Issue
Block a user