Skip to content

Commit 2e6fc92

Browse files
pwilmaCompute-Runtime-Automation
authored andcommitted
Initialize hwInfo in ocloc before passing it to IGC
Related-To: NEO-3735 Change-Id: Ice69f6b21b960bda8fe4aa9667bc03cc3dbbc086 Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
1 parent be5364a commit 2e6fc92

File tree

3 files changed

+39
-35
lines changed

3 files changed

+39
-35
lines changed

opencl/test/unit_test/offline_compiler/offline_compiler_tests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,9 @@ TEST(OfflineCompilerTest, getHardwareInfo) {
667667
ASSERT_NE(nullptr, mockOfflineCompiler);
668668

669669
EXPECT_EQ(CL_INVALID_DEVICE, mockOfflineCompiler->getHardwareInfo("invalid"));
670+
EXPECT_EQ(0u, mockOfflineCompiler->getHardwareInfo().gtSystemInfo.SliceCount);
670671
EXPECT_EQ(CL_SUCCESS, mockOfflineCompiler->getHardwareInfo(gEnvironment->devicePrefix.c_str()));
672+
EXPECT_NE(0u, mockOfflineCompiler->getHardwareInfo().gtSystemInfo.SliceCount);
671673
}
672674

673675
TEST(OfflineCompilerTest, storeBinary) {

shared/offline_compiler/source/offline_compiler.cpp

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,11 @@ int OfflineCompiler::getHardwareInfo(const char *pDeviceName) {
216216
for (unsigned int productId = 0; productId < IGFX_MAX_PRODUCT; ++productId) {
217217
if (hardwarePrefix[productId] && (0 == strcmp(pDeviceName, hardwarePrefix[productId]))) {
218218
if (hardwareInfoTable[productId]) {
219-
hwInfo = hardwareInfoTable[productId];
219+
hwInfo = *hardwareInfoTable[productId];
220+
hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, true, 0x0);
220221
familyNameWithType.clear();
221-
familyNameWithType.append(familyName[hwInfo->platform.eRenderCoreFamily]);
222-
familyNameWithType.append(hwInfo->capabilityTable.platformType);
222+
familyNameWithType.append(familyName[hwInfo.platform.eRenderCoreFamily]);
223+
familyNameWithType.append(hwInfo.capabilityTable.platformType);
223224
retVal = SUCCESS;
224225
break;
225226
}
@@ -352,7 +353,7 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
352353
return OUT_OF_HOST_MEMORY;
353354
}
354355

355-
fclDeviceCtx->SetOclApiVersion(hwInfo->capabilityTable.clVersionSupport * 10);
356+
fclDeviceCtx->SetOclApiVersion(hwInfo.capabilityTable.clVersionSupport * 10);
356357
preferredIntermediateRepresentation = fclDeviceCtx->GetPreferredIntermediateRepresentation();
357358
} else {
358359
if (!isQuiet()) {
@@ -393,46 +394,46 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
393394
if (this->igcDeviceCtx == nullptr) {
394395
return OUT_OF_HOST_MEMORY;
395396
}
396-
this->igcDeviceCtx->SetProfilingTimerResolution(static_cast<float>(hwInfo->capabilityTable.defaultProfilingTimerResolution));
397+
this->igcDeviceCtx->SetProfilingTimerResolution(static_cast<float>(hwInfo.capabilityTable.defaultProfilingTimerResolution));
397398
auto igcPlatform = this->igcDeviceCtx->GetPlatformHandle();
398399
auto igcGtSystemInfo = this->igcDeviceCtx->GetGTSystemInfoHandle();
399400
auto igcFeWa = this->igcDeviceCtx->GetIgcFeaturesAndWorkaroundsHandle();
400401
if ((igcPlatform == nullptr) || (igcGtSystemInfo == nullptr) || (igcFeWa == nullptr)) {
401402
return OUT_OF_HOST_MEMORY;
402403
}
403-
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform.get(), hwInfo->platform);
404-
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), hwInfo->gtSystemInfo);
404+
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform.get(), hwInfo.platform);
405+
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), hwInfo.gtSystemInfo);
405406
// populate with features
406-
igcFeWa.get()->SetFtrDesktop(hwInfo->featureTable.ftrDesktop);
407-
igcFeWa.get()->SetFtrChannelSwizzlingXOREnabled(hwInfo->featureTable.ftrChannelSwizzlingXOREnabled);
407+
igcFeWa.get()->SetFtrDesktop(hwInfo.featureTable.ftrDesktop);
408+
igcFeWa.get()->SetFtrChannelSwizzlingXOREnabled(hwInfo.featureTable.ftrChannelSwizzlingXOREnabled);
408409

409-
igcFeWa.get()->SetFtrGtBigDie(hwInfo->featureTable.ftrGtBigDie);
410-
igcFeWa.get()->SetFtrGtMediumDie(hwInfo->featureTable.ftrGtMediumDie);
411-
igcFeWa.get()->SetFtrGtSmallDie(hwInfo->featureTable.ftrGtSmallDie);
410+
igcFeWa.get()->SetFtrGtBigDie(hwInfo.featureTable.ftrGtBigDie);
411+
igcFeWa.get()->SetFtrGtMediumDie(hwInfo.featureTable.ftrGtMediumDie);
412+
igcFeWa.get()->SetFtrGtSmallDie(hwInfo.featureTable.ftrGtSmallDie);
412413

413-
igcFeWa.get()->SetFtrGT1(hwInfo->featureTable.ftrGT1);
414-
igcFeWa.get()->SetFtrGT1_5(hwInfo->featureTable.ftrGT1_5);
415-
igcFeWa.get()->SetFtrGT2(hwInfo->featureTable.ftrGT2);
416-
igcFeWa.get()->SetFtrGT3(hwInfo->featureTable.ftrGT3);
417-
igcFeWa.get()->SetFtrGT4(hwInfo->featureTable.ftrGT4);
414+
igcFeWa.get()->SetFtrGT1(hwInfo.featureTable.ftrGT1);
415+
igcFeWa.get()->SetFtrGT1_5(hwInfo.featureTable.ftrGT1_5);
416+
igcFeWa.get()->SetFtrGT2(hwInfo.featureTable.ftrGT2);
417+
igcFeWa.get()->SetFtrGT3(hwInfo.featureTable.ftrGT3);
418+
igcFeWa.get()->SetFtrGT4(hwInfo.featureTable.ftrGT4);
418419

419-
igcFeWa.get()->SetFtrIVBM0M1Platform(hwInfo->featureTable.ftrIVBM0M1Platform);
420-
igcFeWa.get()->SetFtrGTL(hwInfo->featureTable.ftrGT1);
421-
igcFeWa.get()->SetFtrGTM(hwInfo->featureTable.ftrGT2);
422-
igcFeWa.get()->SetFtrGTH(hwInfo->featureTable.ftrGT3);
420+
igcFeWa.get()->SetFtrIVBM0M1Platform(hwInfo.featureTable.ftrIVBM0M1Platform);
421+
igcFeWa.get()->SetFtrGTL(hwInfo.featureTable.ftrGT1);
422+
igcFeWa.get()->SetFtrGTM(hwInfo.featureTable.ftrGT2);
423+
igcFeWa.get()->SetFtrGTH(hwInfo.featureTable.ftrGT3);
423424

424-
igcFeWa.get()->SetFtrSGTPVSKUStrapPresent(hwInfo->featureTable.ftrSGTPVSKUStrapPresent);
425-
igcFeWa.get()->SetFtrGTA(hwInfo->featureTable.ftrGTA);
426-
igcFeWa.get()->SetFtrGTC(hwInfo->featureTable.ftrGTC);
427-
igcFeWa.get()->SetFtrGTX(hwInfo->featureTable.ftrGTX);
428-
igcFeWa.get()->SetFtr5Slice(hwInfo->featureTable.ftr5Slice);
425+
igcFeWa.get()->SetFtrSGTPVSKUStrapPresent(hwInfo.featureTable.ftrSGTPVSKUStrapPresent);
426+
igcFeWa.get()->SetFtrGTA(hwInfo.featureTable.ftrGTA);
427+
igcFeWa.get()->SetFtrGTC(hwInfo.featureTable.ftrGTC);
428+
igcFeWa.get()->SetFtrGTX(hwInfo.featureTable.ftrGTX);
429+
igcFeWa.get()->SetFtr5Slice(hwInfo.featureTable.ftr5Slice);
429430

430-
igcFeWa.get()->SetFtrGpGpuMidThreadLevelPreempt(hwInfo->featureTable.ftrGpGpuMidThreadLevelPreempt);
431-
igcFeWa.get()->SetFtrIoMmuPageFaulting(hwInfo->featureTable.ftrIoMmuPageFaulting);
432-
igcFeWa.get()->SetFtrWddm2Svm(hwInfo->featureTable.ftrWddm2Svm);
433-
igcFeWa.get()->SetFtrPooledEuEnabled(hwInfo->featureTable.ftrPooledEuEnabled);
431+
igcFeWa.get()->SetFtrGpGpuMidThreadLevelPreempt(hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt);
432+
igcFeWa.get()->SetFtrIoMmuPageFaulting(hwInfo.featureTable.ftrIoMmuPageFaulting);
433+
igcFeWa.get()->SetFtrWddm2Svm(hwInfo.featureTable.ftrWddm2Svm);
434+
igcFeWa.get()->SetFtrPooledEuEnabled(hwInfo.featureTable.ftrPooledEuEnabled);
434435

435-
igcFeWa.get()->SetFtrResourceStreamer(hwInfo->featureTable.ftrResourceStreamer);
436+
igcFeWa.get()->SetFtrResourceStreamer(hwInfo.featureTable.ftrResourceStreamer);
436437

437438
return retVal;
438439
}
@@ -525,11 +526,11 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
525526
if (retVal != SUCCESS) {
526527
argHelper->printf("Error: Cannot get HW Info for device %s.\n", deviceName.c_str());
527528
} else {
528-
std::string extensionsList = getExtensionsList(*hwInfo);
529+
std::string extensionsList = getExtensionsList(hwInfo);
529530
CompilerOptions::concatenateAppend(internalOptions, convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str()));
530531

531532
StackVec<cl_name_version, 12> openclCFeatures;
532-
getOpenclCFeaturesList(*hwInfo, openclCFeatures);
533+
getOpenclCFeaturesList(hwInfo, openclCFeatures);
533534
CompilerOptions::concatenateAppend(internalOptions, convertEnabledOclCFeaturesToCompilerInternalOptions(openclCFeatures));
534535
}
535536
}

shared/offline_compiler/source/offline_compiler.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#pragma once
99

1010
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
11+
#include "shared/source/helpers/hw_info.h"
1112
#include "shared/source/os_interface/os_library.h"
1213
#include "shared/source/utilities/arrayref.h"
1314
#include "shared/source/utilities/const_stringref.h"
@@ -66,7 +67,7 @@ class OfflineCompiler {
6667

6768
static std::string getFileNameTrunk(std::string &filePath);
6869
const HardwareInfo &getHardwareInfo() const {
69-
return *hwInfo;
70+
return hwInfo;
7071
}
7172

7273
protected:
@@ -94,7 +95,7 @@ class OfflineCompiler {
9495
return suffix;
9596
}
9697
MOCKABLE_VIRTUAL void writeOutAllFiles();
97-
const HardwareInfo *hwInfo = nullptr;
98+
HardwareInfo hwInfo;
9899

99100
std::string deviceName;
100101
std::string familyNameWithType;

0 commit comments

Comments
 (0)