Skip to content

Commit 2c770ba

Browse files
Fix setting hwInfo for Level Zero tests
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
1 parent 6255dbf commit 2c770ba

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

level_zero/core/test/unit_tests/main.cpp

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -233,19 +233,37 @@ int main(int argc, char **argv) {
233233
useDefaultListener = true;
234234
}
235235
}
236+
236237
productFamily = hwInfoForTests.platform.eProductFamily;
237238
renderCoreFamily = hwInfoForTests.platform.eRenderCoreFamily;
238-
if (revId == -1) {
239-
revId = hwInfoForTests.platform.usRevId;
239+
uint32_t threadsPerEu = hwInfoConfigFactory[productFamily]->threadsPerEu;
240+
PLATFORM &platform = hwInfoForTests.platform;
241+
if (revId != -1) {
242+
platform.usRevId = revId;
243+
} else {
244+
revId = platform.usRevId;
240245
}
241-
sliceCount = sliceCount > 0 ? sliceCount : hwInfoForTests.gtSystemInfo.SliceCount;
242-
subSlicePerSliceCount = subSlicePerSliceCount > 0 ? subSlicePerSliceCount : (hwInfoForTests.gtSystemInfo.SubSliceCount / sliceCount);
243-
euPerSubSlice = euPerSubSlice > 0 ? euPerSubSlice : hwInfoForTests.gtSystemInfo.MaxEuPerSubSlice;
246+
uint64_t hwInfoConfig = defaultHardwareInfoConfigTable[productFamily];
247+
setHwInfoValuesFromConfig(hwInfoConfig, hwInfoForTests);
244248

245-
hwInfoForTests.platform.usRevId = revId;
246-
hwInfoForTests.gtSystemInfo.SliceCount = sliceCount;
247-
hwInfoForTests.gtSystemInfo.SubSliceCount = hwInfoForTests.gtSystemInfo.SliceCount * subSlicePerSliceCount;
248-
hwInfoForTests.gtSystemInfo.EUCount = hwInfoForTests.gtSystemInfo.SubSliceCount * euPerSubSlice - dieRecovery;
249+
// set Gt and FeatureTable to initial state
250+
hardwareInfoSetup[productFamily](&hwInfoForTests, setupFeatureTableAndWorkaroundTable, hwInfoConfig);
251+
GT_SYSTEM_INFO &gtSystemInfo = hwInfoForTests.gtSystemInfo;
252+
253+
// and adjust dynamic values if not secified
254+
sliceCount = sliceCount > 0 ? sliceCount : gtSystemInfo.SliceCount;
255+
subSlicePerSliceCount = subSlicePerSliceCount > 0 ? subSlicePerSliceCount : (gtSystemInfo.SubSliceCount / sliceCount);
256+
euPerSubSlice = euPerSubSlice > 0 ? euPerSubSlice : gtSystemInfo.MaxEuPerSubSlice;
257+
// clang-format off
258+
gtSystemInfo.SliceCount = sliceCount;
259+
gtSystemInfo.SubSliceCount = gtSystemInfo.SliceCount * subSlicePerSliceCount;
260+
gtSystemInfo.EUCount = gtSystemInfo.SubSliceCount * euPerSubSlice - dieRecovery;
261+
gtSystemInfo.ThreadCount = gtSystemInfo.EUCount * threadsPerEu;
262+
gtSystemInfo.MaxEuPerSubSlice = std::max(gtSystemInfo.MaxEuPerSubSlice, euPerSubSlice);
263+
gtSystemInfo.MaxSlicesSupported = std::max(gtSystemInfo.MaxSlicesSupported, gtSystemInfo.SliceCount);
264+
gtSystemInfo.MaxSubSlicesSupported = std::max(gtSystemInfo.MaxSubSlicesSupported, gtSystemInfo.SubSliceCount);
265+
gtSystemInfo.IsDynamicallyPopulated = false;
266+
// clang-format on
249267

250268
// Platforms with uninitialized factory are not supported
251269
if (L0::commandListFactory[productFamily] == nullptr) {
@@ -306,12 +324,6 @@ int main(int argc, char **argv) {
306324
NEO::GmmInterface::initialize(nullptr, nullptr);
307325
}
308326

309-
uint64_t hwInfoConfig = NEO::defaultHardwareInfoConfigTable[productFamily];
310-
NEO::setHwInfoValuesFromConfig(hwInfoConfig, hwInfoForTests);
311-
312-
// set Gt and FeatureTable to initial state
313-
NEO::hardwareInfoSetup[productFamily](&hwInfoForTests, setupFeatureTableAndWorkaroundTable, hwInfoConfig);
314-
315327
NEO::defaultHwInfo = std::make_unique<NEO::HardwareInfo>();
316328
*NEO::defaultHwInfo = hwInfoForTests;
317329

0 commit comments

Comments
 (0)