mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
feature: add method to adjust hw info for igc
Related-To: NEO-8203 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
9818ef61a5
commit
91b26277a4
@@ -96,12 +96,17 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) {
|
||||
argHelper->printf("Error! IGC device context has not been properly created!\n");
|
||||
return OclocErrorCode::OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
populateIgcPlatform(*igcPlatform, hwInfo);
|
||||
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), hwInfo.gtSystemInfo);
|
||||
|
||||
auto compilerProductHelper = NEO::CompilerProductHelper::create(hwInfo.platform.eProductFamily);
|
||||
populateWithFeatures(igcFtrWa.get(), hwInfo, compilerProductHelper.get());
|
||||
|
||||
auto copyHwInfo = hwInfo;
|
||||
if (compilerProductHelper) {
|
||||
compilerProductHelper->adjustHwInfoForIgc(copyHwInfo);
|
||||
}
|
||||
|
||||
populateIgcPlatform(*igcPlatform, copyHwInfo);
|
||||
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo.get(), copyHwInfo.gtSystemInfo);
|
||||
|
||||
populateWithFeatures(igcFtrWa.get(), copyHwInfo, compilerProductHelper.get());
|
||||
|
||||
initialized = true;
|
||||
return OclocErrorCode::SUCCESS;
|
||||
|
||||
@@ -22,10 +22,12 @@ std::vector<uint8_t> packDeviceBinary(const SingleDeviceBinary binary, std::stri
|
||||
}
|
||||
|
||||
TargetDevice getTargetDevice(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
auto hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
auto initialHwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
|
||||
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
|
||||
TargetDevice targetDevice = {};
|
||||
auto hwInfo = initialHwInfo;
|
||||
compilerProductHelper.adjustHwInfoForIgc(hwInfo);
|
||||
|
||||
targetDevice.coreFamily = hwInfo.platform.eRenderCoreFamily;
|
||||
targetDevice.productFamily = hwInfo.platform.eProductFamily;
|
||||
|
||||
@@ -55,6 +55,7 @@ class CompilerProductHelper {
|
||||
virtual uint32_t getNumThreadsPerEu() const = 0;
|
||||
virtual uint32_t matchRevisionIdWithProductConfig(HardwareIpVersion ipVersion, uint32_t revisionID) const = 0;
|
||||
virtual std::string getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const = 0;
|
||||
virtual void adjustHwInfoForIgc(HardwareInfo &hwInfo) const = 0;
|
||||
|
||||
virtual ~CompilerProductHelper() = default;
|
||||
uint32_t getHwIpVersion(const HardwareInfo &hwInfo) const;
|
||||
@@ -93,6 +94,7 @@ class CompilerProductHelperHw : public CompilerProductHelper {
|
||||
uint32_t getNumThreadsPerEu() const override;
|
||||
uint32_t matchRevisionIdWithProductConfig(HardwareIpVersion ipVersion, uint32_t revisionID) const override;
|
||||
std::string getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const override;
|
||||
void adjustHwInfoForIgc(HardwareInfo &hwInfo) const override;
|
||||
|
||||
~CompilerProductHelperHw() override = default;
|
||||
|
||||
|
||||
@@ -227,4 +227,8 @@ bool CompilerProductHelperHw<gfxProduct>::isBFloat16ConversionSupported(const Re
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
void CompilerProductHelperHw<gfxProduct>::adjustHwInfoForIgc(HardwareInfo &hwInfo) const {
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -27,7 +27,10 @@ enum class enabledIrFormat {
|
||||
template <enabledIrFormat irFormat = enabledIrFormat::NONE>
|
||||
struct MockElfBinaryPatchtokens {
|
||||
MockElfBinaryPatchtokens(const HardwareInfo &hwInfo) : MockElfBinaryPatchtokens(std::string{}, hwInfo){};
|
||||
MockElfBinaryPatchtokens(const std::string &buildOptions, const HardwareInfo &hwInfo) {
|
||||
MockElfBinaryPatchtokens(const std::string &buildOptions, const HardwareInfo &inputHwInfo) {
|
||||
auto hwInfo = inputHwInfo;
|
||||
auto compilerProductHelper = NEO::CompilerProductHelper::create(hwInfo.platform.eProductFamily);
|
||||
compilerProductHelper->adjustHwInfoForIgc(hwInfo);
|
||||
mockDevBinaryHeader.Device = hwInfo.platform.eRenderCoreFamily;
|
||||
mockDevBinaryHeader.GPUPointerSizeInBytes = sizeof(void *);
|
||||
mockDevBinaryHeader.Version = iOpenCL::CURRENT_ICBE_VERSION;
|
||||
@@ -62,4 +65,4 @@ struct MockElfBinaryPatchtokens {
|
||||
static constexpr size_t mockDataSize = 0x10;
|
||||
iOpenCL::SProgramBinaryHeader mockDevBinaryHeader = iOpenCL::SProgramBinaryHeader{iOpenCL::MAGIC_CL, 0, 0, 0, 0, 0, 0};
|
||||
std::vector<uint8_t> storage;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -84,10 +84,13 @@ inline uint32_t pushBackArgInfoToken(std::vector<uint8_t> &outStream,
|
||||
|
||||
struct ValidEmptyProgram : NEO::PatchTokenBinary::ProgramFromPatchtokens {
|
||||
ValidEmptyProgram() {
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
auto compilerProductHelper = NEO::CompilerProductHelper::create(hwInfo.platform.eProductFamily);
|
||||
compilerProductHelper->adjustHwInfoForIgc(hwInfo);
|
||||
iOpenCL::SProgramBinaryHeader headerTok = {};
|
||||
headerTok.Magic = iOpenCL::MAGIC_CL;
|
||||
headerTok.Version = iOpenCL::CURRENT_ICBE_VERSION;
|
||||
headerTok.Device = NEO::defaultHwInfo->platform.eRenderCoreFamily;
|
||||
headerTok.Device = hwInfo.platform.eRenderCoreFamily;
|
||||
headerTok.GPUPointerSizeInBytes = sizeof(uintptr_t);
|
||||
this->decodeStatus = NEO::DecodeError::Success;
|
||||
|
||||
|
||||
@@ -88,6 +88,9 @@ TEST(KernelArgDumper, givenEmptyKernelArgThenProperlyCreatesDump) {
|
||||
}
|
||||
|
||||
TEST(ProgramDumper, givenProgramWithPatchtokensThenProperlyCreatesDump) {
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
auto compilerProductHelper = NEO::CompilerProductHelper::create(hwInfo.platform.eProductFamily);
|
||||
compilerProductHelper->adjustHwInfoForIgc(hwInfo);
|
||||
using namespace iOpenCL;
|
||||
PatchTokensTestData::ValidProgramWithConstantSurfaceAndPointer progWithConst = {};
|
||||
PatchTokensTestData::ValidProgramWithGlobalSurfaceAndPointer progWithGlobal = {};
|
||||
@@ -136,7 +139,7 @@ struct SProgramBinaryHeader {
|
||||
<< CURRENT_ICBE_VERSION << R"===(
|
||||
|
||||
uint32_t Device; // = )==="
|
||||
<< NEO::defaultHwInfo->platform.eRenderCoreFamily << R"===(
|
||||
<< hwInfo.platform.eRenderCoreFamily << R"===(
|
||||
uint32_t GPUPointerSizeInBytes; // = )==="
|
||||
<< progWithConst.header->GPUPointerSizeInBytes << R"===(
|
||||
|
||||
@@ -264,6 +267,9 @@ Kernels section size : 0
|
||||
}
|
||||
|
||||
TEST(ProgramDumper, givenProgramWithKernelThenProperlyCreatesDump) {
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
auto compilerProductHelper = NEO::CompilerProductHelper::create(hwInfo.platform.eProductFamily);
|
||||
compilerProductHelper->adjustHwInfoForIgc(hwInfo);
|
||||
PatchTokensTestData::ValidProgramWithKernelUsingSlm program;
|
||||
std::string generated = NEO::PatchTokenBinary::asString(program);
|
||||
std::stringstream expected;
|
||||
@@ -275,7 +281,7 @@ struct SProgramBinaryHeader {
|
||||
<< iOpenCL::CURRENT_ICBE_VERSION << R"===(
|
||||
|
||||
uint32_t Device; // = )==="
|
||||
<< NEO::defaultHwInfo->platform.eRenderCoreFamily << R"===(
|
||||
<< hwInfo.platform.eRenderCoreFamily << R"===(
|
||||
uint32_t GPUPointerSizeInBytes; // = )==="
|
||||
<< program.header->GPUPointerSizeInBytes << R"===(
|
||||
|
||||
@@ -341,6 +347,9 @@ Kernel-scope tokens section size : )==="
|
||||
}
|
||||
|
||||
TEST(ProgramDumper, givenProgramWithMultipleKerneslThenProperlyCreatesDump) {
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
auto compilerProductHelper = NEO::CompilerProductHelper::create(hwInfo.platform.eProductFamily);
|
||||
compilerProductHelper->adjustHwInfoForIgc(hwInfo);
|
||||
PatchTokensTestData::ValidProgramWithKernelUsingSlm program;
|
||||
program.kernels.push_back(program.kernels[0]);
|
||||
program.kernels[1].tokens.allocateLocalSurface = nullptr;
|
||||
@@ -358,7 +367,7 @@ struct SProgramBinaryHeader {
|
||||
<< iOpenCL::CURRENT_ICBE_VERSION << R"===(
|
||||
|
||||
uint32_t Device; // = )==="
|
||||
<< NEO::defaultHwInfo->platform.eRenderCoreFamily << R"===(
|
||||
<< hwInfo.platform.eRenderCoreFamily << R"===(
|
||||
uint32_t GPUPointerSizeInBytes; // = )==="
|
||||
<< program.header->GPUPointerSizeInBytes << R"===(
|
||||
|
||||
|
||||
@@ -71,6 +71,8 @@ TEST(ZebinValidateTargetTest, givenTargetDeviceCreatedUsingHelperFunctionWhenVal
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
auto hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
auto targetDevice = getTargetDevice(rootDeviceEnvironment);
|
||||
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
|
||||
compilerProductHelper.adjustHwInfoForIgc(hwInfo);
|
||||
|
||||
EXPECT_TRUE(validateTargetDevice(targetDevice, NEO::Elf::EI_CLASS_32, hwInfo.platform.eProductFamily, hwInfo.platform.eRenderCoreFamily, AOT::UNKNOWN_ISA, {}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user