Skip to content

Commit 8fffdcc

Browse files
Add adjustPlatformCoreFamilyForIgc helper
Change-Id: Ic372e76c1024ca9e585bef15fab29827d33122f3 Signed-off-by: Kamil Kopryk <[email protected]> Related-To: NEO-4865
1 parent 5b50575 commit 8fffdcc

File tree

11 files changed

+47
-14
lines changed

11 files changed

+47
-14
lines changed

level_zero/core/source/module/module_imp.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,13 @@ bool ModuleTranslationUnit::createFromNativeBinary(const char *input, size_t inp
115115
auto productAbbreviation = NEO::hardwarePrefix[device->getNEODevice()->getHardwareInfo().platform.eProductFamily];
116116

117117
NEO::TargetDevice targetDevice = {};
118-
targetDevice.coreFamily = device->getNEODevice()->getHardwareInfo().platform.eRenderCoreFamily;
119-
targetDevice.stepping = device->getNEODevice()->getHardwareInfo().platform.usRevId;
118+
119+
auto copyHwInfo = device->getNEODevice()->getHardwareInfo();
120+
auto &hwHelper = NEO::HwHelper::get(copyHwInfo.platform.eRenderCoreFamily);
121+
hwHelper.adjustPlatformCoreFamilyForIgc(copyHwInfo);
122+
123+
targetDevice.coreFamily = copyHwInfo.platform.eRenderCoreFamily;
124+
targetDevice.stepping = copyHwInfo.platform.usRevId;
120125
targetDevice.maxPointerSizeInBytes = sizeof(uintptr_t);
121126
std::string decodeErrors;
122127
std::string decodeWarnings;

opencl/source/program/program.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,13 @@ cl_int Program::createProgramFromBinary(
168168
auto productAbbreviation = hardwarePrefix[pDevice->getHardwareInfo().platform.eProductFamily];
169169

170170
TargetDevice targetDevice = {};
171-
targetDevice.coreFamily = pDevice->getHardwareInfo().platform.eRenderCoreFamily;
172-
targetDevice.stepping = pDevice->getHardwareInfo().platform.usRevId;
171+
172+
auto copyHwInfo = pDevice->getHardwareInfo();
173+
auto &hwHelper = HwHelper::get(copyHwInfo.platform.eRenderCoreFamily);
174+
hwHelper.adjustPlatformCoreFamilyForIgc(copyHwInfo);
175+
targetDevice.coreFamily = copyHwInfo.platform.eRenderCoreFamily;
176+
177+
targetDevice.stepping = copyHwInfo.platform.usRevId;
173178
targetDevice.maxPointerSizeInBytes = sizeof(uintptr_t);
174179
std::string decodeErrors;
175180
std::string decodeWarnings;

opencl/test/unit_test/program/process_elf_binary_tests.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
1919
#include "opencl/test/unit_test/mocks/mock_program.h"
20+
#include "test.h"
2021

2122
#include "compiler_options.h"
2223
#include "gtest/gtest.h"
@@ -235,7 +236,7 @@ TEST_F(ProcessElfBinaryTests, GivenNonEmptyBuildOptionsWhenCreatingProgramFromBi
235236
EXPECT_STREQ(buildOptionsNotEmpty.c_str(), options.c_str());
236237
}
237238

238-
TEST_F(ProcessElfBinaryTests, GivenBinaryWhenIncompatiblePatchtokenVerionThenProramCreationFails) {
239+
HWTEST_F(ProcessElfBinaryTests, GivenBinaryWhenIncompatiblePatchtokenVerionThenProramCreationFails) {
239240
PatchTokensTestData::ValidEmptyProgram programTokens;
240241
{
241242
NEO::Elf::ElfEncoder<> elfEncoder;

opencl/test/unit_test/program/program_tests.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,8 +2721,9 @@ TEST_F(ProgramTests, WhenProgramIsCreatedThenItsDeviceIsProperlySet) {
27212721
MockProgram programWithDeviceWithValidSpecializedDevice{executionEnvironment, nullptr, false, &validClDevice.getDevice()};
27222722
EXPECT_TRUE(wasValidClDeviceUsed(programWithDeviceWithValidSpecializedDevice));
27232723
}
2724+
using CreateProgramFromBinaryTests2 = ::testing::Test;
27242725

2725-
TEST(CreateProgramFromBinaryTests, givenBinaryProgramWhenKernelRebulildIsForcedThenDeviceBinaryIsNotUsed) {
2726+
HWTEST_F(CreateProgramFromBinaryTests2, givenBinaryProgramWhenKernelRebulildIsForcedThenDeviceBinaryIsNotUsed) {
27262727
DebugManagerStateRestore dbgRestorer;
27272728
DebugManager.flags.RebuildPrecompiledKernels.set(true);
27282729
cl_int retVal = CL_INVALID_BINARY;
@@ -2743,7 +2744,7 @@ TEST(CreateProgramFromBinaryTests, givenBinaryProgramWhenKernelRebulildIsForcedT
27432744
EXPECT_EQ(0U, pProgram->packedDeviceBinarySize);
27442745
}
27452746

2746-
TEST(CreateProgramFromBinaryTests, givenBinaryProgramWhenKernelRebulildIsNotForcedThenDeviceBinaryIsUsed) {
2747+
HWTEST_F(CreateProgramFromBinaryTests2, givenBinaryProgramWhenKernelRebulildIsNotForcedThenDeviceBinaryIsUsed) {
27472748
cl_int retVal = CL_INVALID_BINARY;
27482749

27492750
PatchTokensTestData::ValidEmptyProgram programTokens;
@@ -3058,4 +3059,4 @@ TEST(ProgramReplaceDeviceBinary, GivenBinaryZebinThenUseAsBothPackedAndUnpackedB
30583059
ASSERT_NE(nullptr, program.unpackedDeviceBinary);
30593060
EXPECT_EQ(0, memcmp(program.packedDeviceBinary.get(), zebin.storage.data(), program.packedDeviceBinarySize));
30603061
EXPECT_EQ(0, memcmp(program.unpackedDeviceBinary.get(), zebin.storage.data(), program.unpackedDeviceBinarySize));
3061-
}
3062+
}

shared/offline_compiler/source/extra_settings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ void OfflineCompiler::resolveExtraSettings() {
1616
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::forceEmuInt32DivRemSP);
1717
}
1818
}
19+
20+
void OfflineCompiler::adjustExtraSettings(HardwareInfo &hwInfo) {
21+
}
1922
} // namespace NEO

shared/offline_compiler/source/offline_compiler.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,12 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
425425
if ((igcPlatform == nullptr) || (igcGtSystemInfo == nullptr) || (igcFeWa == nullptr)) {
426426
return OUT_OF_HOST_MEMORY;
427427
}
428-
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform.get(), hwInfo.platform);
429-
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), hwInfo.gtSystemInfo);
428+
429+
auto copyHwInfo = hwInfo;
430+
adjustExtraSettings(copyHwInfo);
431+
432+
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform.get(), copyHwInfo.platform);
433+
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), copyHwInfo.gtSystemInfo);
430434
// populate with features
431435
igcFeWa.get()->SetFtrDesktop(hwInfo.featureTable.ftrDesktop);
432436
igcFeWa.get()->SetFtrChannelSwizzlingXOREnabled(hwInfo.featureTable.ftrChannelSwizzlingXOREnabled);

shared/offline_compiler/source/offline_compiler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class OfflineCompiler {
8383
int parseCommandLine(size_t numArgs, const std::vector<std::string> &allArgs);
8484
void setStatelessToStatefullBufferOffsetFlag();
8585
void resolveExtraSettings();
86+
void adjustExtraSettings(HardwareInfo &hwInfo);
8687
void parseDebugSettings();
8788
void storeBinary(char *&pDst, size_t &dstSize, const void *pSrc, const size_t srcSize);
8889
MOCKABLE_VIRTUAL int buildSourceCode();

shared/source/compiler_interface/compiler_interface.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "shared/source/compiler_interface/compiler_interface.inl"
1212
#include "shared/source/debug_settings/debug_settings_manager.h"
1313
#include "shared/source/device/device.h"
14+
#include "shared/source/helpers/hw_helper.h"
1415
#include "shared/source/helpers/hw_info.h"
1516

1617
#include "opencl/source/os_interface/os_inc_base.h"
@@ -330,7 +331,6 @@ TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device &
330331

331332
bool CompilerInterface::loadFcl() {
332333
return NEO::loadCompiler<IGC::FclOclDeviceCtx>(Os::frontEndDllName, fclLib, fclMain);
333-
;
334334
}
335335

336336
bool CompilerInterface::loadIgc() {
@@ -400,8 +400,13 @@ IGC::IgcOclDeviceCtxTagOCL *CompilerInterface::getIgcDeviceCtx(const Device &dev
400400
if (productFamily != "unk") {
401401
getHwInfoForPlatformString(productFamily, hwInfo);
402402
}
403-
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform, hwInfo->platform);
404-
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo, hwInfo->gtSystemInfo);
403+
404+
auto &hwHelper = NEO::HwHelper::get(hwInfo->platform.eRenderCoreFamily);
405+
auto copyHwInfo = *hwInfo;
406+
hwHelper.adjustPlatformCoreFamilyForIgc(copyHwInfo);
407+
408+
IGC::PlatformHelper::PopulateInterfaceWith(*igcPlatform, copyHwInfo.platform);
409+
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo, copyHwInfo.gtSystemInfo);
405410

406411
igcFeWa.get()->SetFtrDesktop(device.getHardwareInfo().featureTable.ftrDesktop);
407412
igcFeWa.get()->SetFtrChannelSwizzlingXOREnabled(device.getHardwareInfo().featureTable.ftrChannelSwizzlingXOREnabled);

shared/source/helpers/hw_helper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ class HwHelper {
123123
virtual bool isSpecialWorkgroupSizeRequired(const HardwareInfo &hwInfo, bool isSimulation) const = 0;
124124
virtual uint32_t getGlobalTimeStampBits() const = 0;
125125
virtual uint32_t getDefaultThreadArbitrationPolicy() const = 0;
126+
virtual void adjustPlatformCoreFamilyForIgc(HardwareInfo &hwInfo) = 0;
126127

127128
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
128129
static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
@@ -311,6 +312,8 @@ class HwHelperHw : public HwHelper {
311312

312313
uint32_t getDefaultThreadArbitrationPolicy() const override;
313314

315+
void adjustPlatformCoreFamilyForIgc(HardwareInfo &hwInfo) override;
316+
314317
protected:
315318
LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;
316319

shared/source/helpers/hw_helper_base.inl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ bool HwHelperHw<Family>::getEnableLocalMemory(const HardwareInfo &hwInfo) const
179179
return OSInterface::osEnableLocalMemory && isLocalMemoryEnabled(hwInfo);
180180
}
181181

182+
template <typename Family>
183+
void HwHelperHw<Family>::adjustPlatformCoreFamilyForIgc(HardwareInfo &hwInfo) {
184+
}
185+
182186
template <typename Family>
183187
AuxTranslationMode HwHelperHw<Family>::getAuxTranslationMode() {
184188
if (DebugManager.flags.ForceAuxTranslationMode.get() != -1) {

0 commit comments

Comments
 (0)