mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 17:29:14 +08:00
Revert "feature: adding support for custom compiler backends"
This reverts commit 8098bcc48d.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6de2f1a9c9
commit
2098e64dc1
@@ -52,9 +52,6 @@ void TranslationOutput::makeCopy(MemAndSize &dst, CIF::Builtins::BufferSimple *s
|
||||
|
||||
CompilerInterface::CompilerInterface()
|
||||
: cache() {
|
||||
if (debugManager.flags.FinalizerInputType.get() != 0) {
|
||||
this->finalizerInputType = debugManager.flags.FinalizerInputType.get();
|
||||
}
|
||||
}
|
||||
CompilerInterface::~CompilerInterface() = default;
|
||||
|
||||
@@ -62,7 +59,7 @@ TranslationOutput::ErrorCode CompilerInterface::build(
|
||||
const NEO::Device &device,
|
||||
const TranslationInput &input,
|
||||
TranslationOutput &output) {
|
||||
if (false == isCompilerAvailable(&device, input.srcType, input.outType)) {
|
||||
if (false == isCompilerAvailable(input.srcType, input.outType)) {
|
||||
return TranslationOutput::ErrorCode::compilerNotAvailable;
|
||||
}
|
||||
|
||||
@@ -85,11 +82,10 @@ TranslationOutput::ErrorCode CompilerInterface::build(
|
||||
|
||||
std::string kernelFileHash;
|
||||
if (cachingMode == CachingMode::Direct) {
|
||||
const auto &igc = *getIgc(&device);
|
||||
kernelFileHash = cache->getCachedFileName(device.getHardwareInfo(),
|
||||
input.src,
|
||||
input.apiOptions,
|
||||
input.internalOptions, ArrayRef<const char>(), ArrayRef<const char>(), igc.revision, igc.libSize, igc.libMTime);
|
||||
input.internalOptions, ArrayRef<const char>(), ArrayRef<const char>(), igcRevision, igcLibSize, igcLibMTime);
|
||||
|
||||
bool success = CompilerCacheHelper::loadCacheAndSetOutput(*cache, kernelFileHash, output, device);
|
||||
if (success) {
|
||||
@@ -97,15 +93,12 @@ TranslationOutput::ErrorCode CompilerInterface::build(
|
||||
}
|
||||
}
|
||||
|
||||
const auto &igc = *getIgc(&device);
|
||||
auto *igcMain = igc.entryPoint.get();
|
||||
auto inSrc = CIF::Builtins::CreateConstBuffer(igcMain.get(), input.src.begin(), input.src.size());
|
||||
auto fclOptions = CIF::Builtins::CreateConstBuffer(igcMain.get(), input.apiOptions.begin(), input.apiOptions.size());
|
||||
auto fclInternalOptions = CIF::Builtins::CreateConstBuffer(igcMain.get(), input.internalOptions.begin(), input.internalOptions.size());
|
||||
|
||||
auto inSrc = CIF::Builtins::CreateConstBuffer(igcMain, input.src.begin(), input.src.size());
|
||||
auto fclOptions = CIF::Builtins::CreateConstBuffer(igcMain, input.apiOptions.begin(), input.apiOptions.size());
|
||||
auto fclInternalOptions = CIF::Builtins::CreateConstBuffer(igcMain, input.internalOptions.begin(), input.internalOptions.size());
|
||||
|
||||
auto idsBuffer = CIF::Builtins::CreateConstBuffer(igcMain, nullptr, 0);
|
||||
auto valuesBuffer = CIF::Builtins::CreateConstBuffer(igcMain, nullptr, 0);
|
||||
auto idsBuffer = CIF::Builtins::CreateConstBuffer(igcMain.get(), nullptr, 0);
|
||||
auto valuesBuffer = CIF::Builtins::CreateConstBuffer(igcMain.get(), nullptr, 0);
|
||||
for (const auto &specConst : input.specializedValues) {
|
||||
idsBuffer->PushBackRawCopy(specConst.first);
|
||||
valuesBuffer->PushBackRawCopy(specConst.second);
|
||||
@@ -147,10 +140,9 @@ TranslationOutput::ErrorCode CompilerInterface::build(
|
||||
const ArrayRef<const char> irRef(intermediateRepresentation->GetMemory<char>(), intermediateRepresentation->GetSize<char>());
|
||||
const ArrayRef<const char> specIdsRef(idsBuffer->GetMemory<char>(), idsBuffer->GetSize<char>());
|
||||
const ArrayRef<const char> specValuesRef(valuesBuffer->GetMemory<char>(), valuesBuffer->GetSize<char>());
|
||||
const auto &igc = *getIgc(&device);
|
||||
kernelFileHash = cache->getCachedFileName(device.getHardwareInfo(), irRef,
|
||||
input.apiOptions,
|
||||
input.internalOptions, specIdsRef, specValuesRef, igc.revision, igc.libSize, igc.libMTime);
|
||||
input.internalOptions, specIdsRef, specValuesRef, igcRevision, igcLibSize, igcLibMTime);
|
||||
|
||||
bool success = CompilerCacheHelper::loadCacheAndSetOutput(*cache, kernelFileHash, output, device);
|
||||
if (success) {
|
||||
@@ -158,43 +150,23 @@ TranslationOutput::ErrorCode CompilerInterface::build(
|
||||
}
|
||||
}
|
||||
|
||||
auto igcOutputType = IGC::CodeType::oclGenBin;
|
||||
if (this->finalizerInputType != IGC::CodeType::undefined) {
|
||||
igcOutputType = this->finalizerInputType;
|
||||
}
|
||||
auto igcTranslationCtx = createIgcTranslationCtx(device, intermediateCodeType, IGC::CodeType::oclGenBin);
|
||||
|
||||
auto igcTranslationCtx = createIgcTranslationCtx(device, intermediateCodeType, igcOutputType);
|
||||
auto igcOutput = translate(igcTranslationCtx.get(), intermediateRepresentation.get(), idsBuffer.get(), valuesBuffer.get(),
|
||||
fclOptions.get(), fclInternalOptions.get(), input.gtPinInput);
|
||||
|
||||
auto buildOutput = translate(igcTranslationCtx.get(), intermediateRepresentation.get(), idsBuffer.get(), valuesBuffer.get(),
|
||||
fclOptions.get(), fclInternalOptions.get(), input.gtPinInput);
|
||||
|
||||
if (buildOutput == nullptr) {
|
||||
if (igcOutput == nullptr) {
|
||||
return TranslationOutput::ErrorCode::unknownError;
|
||||
}
|
||||
|
||||
TranslationOutput::makeCopy(output.backendCompilerLog, buildOutput->GetBuildLog());
|
||||
TranslationOutput::makeCopy(output.backendCompilerLog, igcOutput->GetBuildLog());
|
||||
|
||||
if (buildOutput->Successful() == false) {
|
||||
if (igcOutput->Successful() == false) {
|
||||
return TranslationOutput::ErrorCode::buildFailure;
|
||||
}
|
||||
|
||||
if (igcOutputType == this->finalizerInputType) {
|
||||
TranslationOutput::makeCopy(output.finalizerInputRepresentation, buildOutput->GetOutput());
|
||||
|
||||
auto finalizerTranslationCtx = createFinalizerTranslationCtx(device, this->finalizerInputType, IGC::CodeType::oclGenBin);
|
||||
|
||||
auto finalizerOutput = translate(finalizerTranslationCtx.get(), buildOutput->GetOutput(),
|
||||
fclOptions.get(), fclInternalOptions.get(), nullptr);
|
||||
buildOutput = std::move(finalizerOutput);
|
||||
|
||||
TranslationOutput::append(output.backendCompilerLog, buildOutput->GetBuildLog(), "\n", 0);
|
||||
if (buildOutput->Successful() == false) {
|
||||
return TranslationOutput::ErrorCode::buildFailure;
|
||||
}
|
||||
}
|
||||
|
||||
TranslationOutput::makeCopy(output.deviceBinary, buildOutput->GetOutput());
|
||||
TranslationOutput::makeCopy(output.debugData, buildOutput->GetDebugData());
|
||||
TranslationOutput::makeCopy(output.deviceBinary, igcOutput->GetOutput());
|
||||
TranslationOutput::makeCopy(output.debugData, igcOutput->GetDebugData());
|
||||
|
||||
if (cache != nullptr && cache->getConfig().enabled) {
|
||||
CompilerCacheHelper::packAndCacheBinary(*cache, kernelFileHash, NEO::getTargetDevice(device.getRootDeviceEnvironment()), output);
|
||||
@@ -212,7 +184,7 @@ TranslationOutput::ErrorCode CompilerInterface::compile(
|
||||
return TranslationOutput::ErrorCode::alreadyCompiled;
|
||||
}
|
||||
|
||||
if (false == isCompilerAvailable(&device, input.srcType, input.outType)) {
|
||||
if (false == isCompilerAvailable(input.srcType, input.outType)) {
|
||||
return TranslationOutput::ErrorCode::compilerNotAvailable;
|
||||
}
|
||||
|
||||
@@ -222,10 +194,9 @@ TranslationOutput::ErrorCode CompilerInterface::compile(
|
||||
outType = getPreferredIntermediateRepresentation(device);
|
||||
}
|
||||
|
||||
auto *fclMain = fcl.entryPoint.get();
|
||||
auto fclSrc = CIF::Builtins::CreateConstBuffer(fclMain, input.src.begin(), input.src.size());
|
||||
auto fclOptions = CIF::Builtins::CreateConstBuffer(fclMain, input.apiOptions.begin(), input.apiOptions.size());
|
||||
auto fclInternalOptions = CIF::Builtins::CreateConstBuffer(fclMain, input.internalOptions.begin(), input.internalOptions.size());
|
||||
auto fclSrc = CIF::Builtins::CreateConstBuffer(fclMain.get(), input.src.begin(), input.src.size());
|
||||
auto fclOptions = CIF::Builtins::CreateConstBuffer(fclMain.get(), input.apiOptions.begin(), input.apiOptions.size());
|
||||
auto fclInternalOptions = CIF::Builtins::CreateConstBuffer(fclMain.get(), input.internalOptions.begin(), input.internalOptions.size());
|
||||
|
||||
auto fclTranslationCtx = createFclTranslationCtx(device, input.srcType, outType);
|
||||
|
||||
@@ -252,14 +223,13 @@ TranslationOutput::ErrorCode CompilerInterface::link(
|
||||
const NEO::Device &device,
|
||||
const TranslationInput &input,
|
||||
TranslationOutput &output) {
|
||||
if (false == isCompilerAvailable(&device, input.srcType, input.outType)) {
|
||||
if (false == isCompilerAvailable(input.srcType, input.outType)) {
|
||||
return TranslationOutput::ErrorCode::compilerNotAvailable;
|
||||
}
|
||||
|
||||
auto *igcMain = getIgc(&device)->entryPoint.get();
|
||||
auto inSrc = CIF::Builtins::CreateConstBuffer(igcMain, input.src.begin(), input.src.size());
|
||||
auto igcOptions = CIF::Builtins::CreateConstBuffer(igcMain, input.apiOptions.begin(), input.apiOptions.size());
|
||||
auto igcInternalOptions = CIF::Builtins::CreateConstBuffer(igcMain, input.internalOptions.begin(), input.internalOptions.size());
|
||||
auto inSrc = CIF::Builtins::CreateConstBuffer(igcMain.get(), input.src.begin(), input.src.size());
|
||||
auto igcOptions = CIF::Builtins::CreateConstBuffer(igcMain.get(), input.apiOptions.begin(), input.apiOptions.size());
|
||||
auto igcInternalOptions = CIF::Builtins::CreateConstBuffer(igcMain.get(), input.internalOptions.begin(), input.internalOptions.size());
|
||||
|
||||
if (inSrc == nullptr) {
|
||||
return TranslationOutput::ErrorCode::unknownError;
|
||||
@@ -299,16 +269,15 @@ TranslationOutput::ErrorCode CompilerInterface::link(
|
||||
}
|
||||
|
||||
TranslationOutput::ErrorCode CompilerInterface::getSpecConstantsInfo(const NEO::Device &device, ArrayRef<const char> srcSpirV, SpecConstantInfo &output) {
|
||||
if (false == isIgcAvailable(&device)) {
|
||||
if (false == isIgcAvailable()) {
|
||||
return TranslationOutput::ErrorCode::compilerNotAvailable;
|
||||
}
|
||||
|
||||
auto igcTranslationCtx = createIgcTranslationCtx(device, IGC::CodeType::spirV, IGC::CodeType::oclGenBin);
|
||||
|
||||
auto *igcMain = getIgc(&device)->entryPoint.get();
|
||||
auto inSrc = CIF::Builtins::CreateConstBuffer(igcMain, srcSpirV.begin(), srcSpirV.size());
|
||||
output.idsBuffer = CIF::Builtins::CreateConstBuffer(igcMain, nullptr, 0);
|
||||
output.sizesBuffer = CIF::Builtins::CreateConstBuffer(igcMain, nullptr, 0);
|
||||
auto inSrc = CIF::Builtins::CreateConstBuffer(igcMain.get(), srcSpirV.begin(), srcSpirV.size());
|
||||
output.idsBuffer = CIF::Builtins::CreateConstBuffer(igcMain.get(), nullptr, 0);
|
||||
output.sizesBuffer = CIF::Builtins::CreateConstBuffer(igcMain.get(), nullptr, 0);
|
||||
|
||||
auto retVal = getSpecConstantsInfoImpl(igcTranslationCtx.get(), inSrc.get(), output.idsBuffer.get(), output.sizesBuffer.get());
|
||||
|
||||
@@ -323,14 +292,13 @@ TranslationOutput::ErrorCode CompilerInterface::createLibrary(
|
||||
NEO::Device &device,
|
||||
const TranslationInput &input,
|
||||
TranslationOutput &output) {
|
||||
if (false == isIgcAvailable(&device)) {
|
||||
if (false == isIgcAvailable()) {
|
||||
return TranslationOutput::ErrorCode::compilerNotAvailable;
|
||||
}
|
||||
|
||||
auto *igcMain = getIgc(&device)->entryPoint.get();
|
||||
auto igcSrc = CIF::Builtins::CreateConstBuffer(igcMain, input.src.begin(), input.src.size());
|
||||
auto igcOptions = CIF::Builtins::CreateConstBuffer(igcMain, input.apiOptions.begin(), input.apiOptions.size());
|
||||
auto igcInternalOptions = CIF::Builtins::CreateConstBuffer(igcMain, input.internalOptions.begin(), input.internalOptions.size());
|
||||
auto igcSrc = CIF::Builtins::CreateConstBuffer(igcMain.get(), input.src.begin(), input.src.size());
|
||||
auto igcOptions = CIF::Builtins::CreateConstBuffer(igcMain.get(), input.apiOptions.begin(), input.apiOptions.size());
|
||||
auto igcInternalOptions = CIF::Builtins::CreateConstBuffer(igcMain.get(), input.internalOptions.begin(), input.internalOptions.size());
|
||||
|
||||
auto intermediateRepresentation = IGC::CodeType::llvmBc;
|
||||
auto igcTranslationCtx = createIgcTranslationCtx(device, IGC::CodeType::elf, intermediateRepresentation);
|
||||
@@ -356,7 +324,7 @@ TranslationOutput::ErrorCode CompilerInterface::createLibrary(
|
||||
|
||||
TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device &device, SipKernelType type, std::vector<char> &retBinary,
|
||||
std::vector<char> &stateSaveAreaHeader) {
|
||||
if (false == isIgcAvailable(&device)) {
|
||||
if (false == isIgcAvailable()) {
|
||||
return TranslationOutput::ErrorCode::compilerNotAvailable;
|
||||
}
|
||||
|
||||
@@ -390,7 +358,6 @@ TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device &
|
||||
return TranslationOutput::ErrorCode::unknownError;
|
||||
}
|
||||
|
||||
auto *igcMain = getIgc(&device)->entryPoint.get();
|
||||
auto systemRoutineBuffer = igcMain->CreateBuiltin<CIF::Builtins::BufferLatest>();
|
||||
auto stateSaveAreaBuffer = igcMain->CreateBuiltin<CIF::Builtins::BufferLatest>();
|
||||
|
||||
@@ -414,41 +381,37 @@ CIF::RAII::UPtr_t<IGC::IgcFeaturesAndWorkaroundsTagOCL> CompilerInterface::getIg
|
||||
}
|
||||
|
||||
bool CompilerInterface::loadFcl() {
|
||||
return NEO::loadCompiler<IGC::FclOclDeviceCtx>(Os::frontEndDllName, fcl.library, fcl.entryPoint);
|
||||
return NEO::loadCompiler<IGC::FclOclDeviceCtx>(Os::frontEndDllName, fclLib, fclMain);
|
||||
}
|
||||
|
||||
bool CompilerInterface::loadIgcBasedCompiler(CompilerLibraryEntry &entry, const char *libName) {
|
||||
bool result = NEO::loadCompiler<IGC::IgcOclDeviceCtx>(libName, entry.library, entry.entryPoint);
|
||||
bool CompilerInterface::loadIgc() {
|
||||
bool result = NEO::loadCompiler<IGC::IgcOclDeviceCtx>(Os::igcDllName, igcLib, igcMain);
|
||||
|
||||
if (result) {
|
||||
std::string libPath = entry.library->getFullPath();
|
||||
entry.libSize = NEO::getFileSize(libPath);
|
||||
entry.libMTime = NEO::getFileModificationTime(libPath);
|
||||
std::string igcPath = igcLib->getFullPath();
|
||||
igcLibSize = NEO::getFileSize(igcPath);
|
||||
igcLibMTime = NEO::getFileModificationTime(igcPath);
|
||||
|
||||
auto igcDeviceCtx3 = entry.entryPoint->CreateInterface<IGC::IgcOclDeviceCtx<3>>();
|
||||
auto igcDeviceCtx3 = igcMain->CreateInterface<IGC::IgcOclDeviceCtx<3>>();
|
||||
if (igcDeviceCtx3) {
|
||||
entry.revision = igcDeviceCtx3->GetIGCRevision();
|
||||
igcRevision = igcDeviceCtx3->GetIGCRevision();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CompilerInterface::loadFinalizer(CompilerLibraryEntry &entry, const char *libName) {
|
||||
std::string finalizerLibName = libName;
|
||||
if (debugManager.flags.FinalizerLibraryName.get() != "unk") {
|
||||
finalizerLibName = debugManager.flags.FinalizerLibraryName.get();
|
||||
}
|
||||
|
||||
return NEO::loadCompiler<IGC::IgcOclDeviceCtx>(libName, entry.library, entry.entryPoint);
|
||||
}
|
||||
|
||||
bool CompilerInterface::initialize(std::unique_ptr<CompilerCache> &&cache, bool requireFcl) {
|
||||
bool fclAvailable = requireFcl ? this->loadFcl() : false;
|
||||
bool igcAvailable = this->loadIgcBasedCompiler(defaultIgc, Os::igcDllName);
|
||||
bool igcAvailable = this->loadIgc();
|
||||
bool compilerVersionCorrect = true;
|
||||
|
||||
if (!debugManager.flags.ZebinIgnoreIcbeVersion.get()) {
|
||||
compilerVersionCorrect = verifyIcbeVersion();
|
||||
}
|
||||
|
||||
this->cache.swap(cache);
|
||||
|
||||
return this->cache && igcAvailable && (fclAvailable || (false == requireFcl));
|
||||
return this->cache && igcAvailable && (fclAvailable || (false == requireFcl)) && compilerVersionCorrect;
|
||||
}
|
||||
|
||||
IGC::FclOclDeviceCtxTagOCL *CompilerInterface::getFclDeviceCtx(const Device &device) {
|
||||
@@ -458,12 +421,12 @@ IGC::FclOclDeviceCtxTagOCL *CompilerInterface::getFclDeviceCtx(const Device &dev
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
if (fcl.entryPoint == nullptr) {
|
||||
if (fclMain == nullptr) {
|
||||
DEBUG_BREAK_IF(true); // compiler not available
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto newDeviceCtx = fcl.entryPoint->CreateInterface<IGC::FclOclDeviceCtxTagOCL>();
|
||||
auto newDeviceCtx = fclMain->CreateInterface<IGC::FclOclDeviceCtxTagOCL>();
|
||||
if (newDeviceCtx == nullptr) {
|
||||
DEBUG_BREAK_IF(true); // could not create device context
|
||||
return nullptr;
|
||||
@@ -490,12 +453,10 @@ IGC::IgcOclDeviceCtxTagOCL *CompilerInterface::getIgcDeviceCtx(const Device &dev
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
auto *igc = getIgc(&device);
|
||||
if (igc == nullptr) {
|
||||
if (igcMain == nullptr) {
|
||||
DEBUG_BREAK_IF(true); // compiler not available
|
||||
return nullptr;
|
||||
}
|
||||
auto *igcMain = igc->entryPoint.get();
|
||||
|
||||
auto newDeviceCtx = igcMain->CreateInterface<IGC::IgcOclDeviceCtxTagOCL>();
|
||||
if (newDeviceCtx == nullptr) {
|
||||
@@ -529,51 +490,6 @@ IGC::IgcOclDeviceCtxTagOCL *CompilerInterface::getIgcDeviceCtx(const Device &dev
|
||||
return igcDeviceContexts[&device].get();
|
||||
}
|
||||
|
||||
IGC::IgcOclDeviceCtxTagOCL *CompilerInterface::getFinalizerDeviceCtx(const Device &device) {
|
||||
auto ulock = this->lock();
|
||||
auto it = finalizerDeviceContexts.find(&device);
|
||||
if (it != finalizerDeviceContexts.end()) {
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
auto finalizer = this->getFinalizer(&device);
|
||||
if (finalizer == nullptr) {
|
||||
DEBUG_BREAK_IF(true); // compiler not available
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto newDeviceCtx = finalizer->entryPoint->CreateInterface<IGC::IgcOclDeviceCtxTagOCL>();
|
||||
if (newDeviceCtx == nullptr) {
|
||||
DEBUG_BREAK_IF(true); // could not create device context
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
newDeviceCtx->SetProfilingTimerResolution(static_cast<float>(device.getDeviceInfo().outProfilingTimerResolution));
|
||||
auto igcPlatform = newDeviceCtx->GetPlatformHandle();
|
||||
auto igcGtSystemInfo = newDeviceCtx->GetGTSystemInfoHandle();
|
||||
auto igcFtrWa = newDeviceCtx->GetIgcFeaturesAndWorkaroundsHandle();
|
||||
if (false == NEO::areNotNullptr(igcPlatform.get(), igcGtSystemInfo.get(), igcFtrWa.get())) {
|
||||
DEBUG_BREAK_IF(true); // could not acquire handles to device descriptors
|
||||
return nullptr;
|
||||
}
|
||||
const HardwareInfo *hwInfo = &device.getHardwareInfo();
|
||||
auto productFamily = debugManager.flags.ForceCompilerUsePlatform.get();
|
||||
if (productFamily != "unk") {
|
||||
getHwInfoForPlatformString(productFamily, hwInfo);
|
||||
}
|
||||
|
||||
populateIgcPlatform(*igcPlatform, *hwInfo);
|
||||
IGC::GtSysInfoHelper::PopulateInterfaceWith(*igcGtSystemInfo, hwInfo->gtSystemInfo);
|
||||
|
||||
auto &compilerProductHelper = device.getCompilerProductHelper();
|
||||
igcFtrWa->SetFtrGpGpuMidThreadLevelPreempt(compilerProductHelper.isMidThreadPreemptionSupported(*hwInfo));
|
||||
igcFtrWa->SetFtrWddm2Svm(device.getHardwareInfo().featureTable.flags.ftrWddm2Svm);
|
||||
igcFtrWa->SetFtrPooledEuEnabled(device.getHardwareInfo().featureTable.flags.ftrPooledEuEnabled);
|
||||
|
||||
finalizerDeviceContexts[&device] = std::move(newDeviceCtx);
|
||||
return finalizerDeviceContexts[&device].get();
|
||||
}
|
||||
|
||||
IGC::CodeType::CodeType_t CompilerInterface::getPreferredIntermediateRepresentation(const Device &device) {
|
||||
return getFclDeviceCtx(device)->GetPreferredIntermediateRepresentation();
|
||||
}
|
||||
@@ -605,18 +521,50 @@ CIF::RAII::UPtr_t<IGC::IgcOclTranslationCtxTagOCL> CompilerInterface::createIgcT
|
||||
return deviceCtx->CreateTranslationCtx(inType, outType);
|
||||
}
|
||||
|
||||
CIF::RAII::UPtr_t<IGC::IgcOclTranslationCtxTagOCL> CompilerInterface::createFinalizerTranslationCtx(const Device &device, IGC::CodeType::CodeType_t inType, IGC::CodeType::CodeType_t outType) {
|
||||
auto deviceCtx = getFinalizerDeviceCtx(device);
|
||||
if (deviceCtx == nullptr) {
|
||||
DEBUG_BREAK_IF(true); // could not create device context
|
||||
return nullptr;
|
||||
template <template <CIF::Version_t> class EntryPointT>
|
||||
void checkIcbeVersion(CIF::CIFMain *main, const char *libName, bool &ret) {
|
||||
if (false == main->IsCompatible<EntryPointT>()) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Installed Compiler Library %s is incompatible\n", libName);
|
||||
DEBUG_BREAK_IF(true); // given compiler library is not compatible
|
||||
ret = false;
|
||||
return;
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return deviceCtx->CreateTranslationCtx(inType, outType);
|
||||
template <>
|
||||
std::once_flag &CompilerInterface::getIcbeVersionCallOnceFlag<IGC::IgcOclDeviceCtx>() {
|
||||
return igcIcbeCheckVersionCallOnce;
|
||||
}
|
||||
|
||||
template <>
|
||||
std::once_flag &CompilerInterface::getIcbeVersionCallOnceFlag<IGC::FclOclDeviceCtx>() {
|
||||
return fclIcbeCheckVersionCallOnce;
|
||||
}
|
||||
|
||||
template <template <CIF::Version_t> class EntryPointT>
|
||||
bool CompilerInterface::checkIcbeVersionOnce(CIF::CIFMain *main, const char *libName) {
|
||||
bool ret = true;
|
||||
std::call_once(getIcbeVersionCallOnceFlag<EntryPointT>(), checkIcbeVersion<EntryPointT>, main, libName, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CompilerInterface::verifyIcbeVersion() {
|
||||
bool versionIsCorrect = true;
|
||||
if (isFclAvailable()) {
|
||||
versionIsCorrect = checkIcbeVersionOnce<IGC::FclOclDeviceCtx>(fclMain.get(), Os::frontEndDllName);
|
||||
}
|
||||
if (isIgcAvailable()) {
|
||||
versionIsCorrect &= checkIcbeVersionOnce<IGC::IgcOclDeviceCtx>(igcMain.get(), Os::igcDllName);
|
||||
}
|
||||
return versionIsCorrect;
|
||||
}
|
||||
|
||||
bool CompilerInterface::addOptionDisableZebin(std::string &options, std::string &internalOptions) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::disableZebin);
|
||||
if (!verifyIcbeVersion()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -624,47 +572,8 @@ bool CompilerInterface::disableZebin(std::string &options, std::string &internal
|
||||
return addOptionDisableZebin(options, internalOptions);
|
||||
}
|
||||
|
||||
bool CompilerInterface::isIgcAvailable(const Device *device) {
|
||||
return nullptr != getIgc(device);
|
||||
}
|
||||
|
||||
bool CompilerInterface::isFinalizerAvailable(const Device *device) {
|
||||
return nullptr != getFinalizer(device);
|
||||
}
|
||||
|
||||
const CompilerInterface::CompilerLibraryEntry *CompilerInterface::getIgc(const Device *device) {
|
||||
if (nullptr == device) {
|
||||
if (defaultIgc.entryPoint == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return &defaultIgc;
|
||||
}
|
||||
return getIgc(device->getCompilerProductHelper().getCustomIgcLibraryName());
|
||||
}
|
||||
|
||||
const CompilerInterface::CompilerLibraryEntry *CompilerInterface::getFinalizer(const Device *device) {
|
||||
if (nullptr == device) {
|
||||
return nullptr;
|
||||
}
|
||||
return getFinalizer(device->getCompilerProductHelper().getFinalizerLibraryName());
|
||||
}
|
||||
|
||||
const CompilerInterface::CompilerLibraryEntry *CompilerInterface::getCustomCompilerLibrary(const char *libName) {
|
||||
auto it = customCompilerLibraries.find(libName);
|
||||
if (it != customCompilerLibraries.end()) {
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
CompilerLibraryEntry newEntry = {};
|
||||
this->loadIgcBasedCompiler(newEntry, libName);
|
||||
if (newEntry.entryPoint == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
customCompilerLibraries[libName].reset(new CompilerLibraryEntry(std::move(newEntry)));
|
||||
|
||||
return customCompilerLibraries[libName].get();
|
||||
}
|
||||
template bool CompilerInterface::checkIcbeVersionOnce<IGC::FclOclDeviceCtx>(CIF::CIFMain *main, const char *libName);
|
||||
template bool CompilerInterface::checkIcbeVersionOnce<IGC::IgcOclDeviceCtx>(CIF::CIFMain *main, const char *libName);
|
||||
|
||||
void CompilerCacheHelper::packAndCacheBinary(CompilerCache &compilerCache, const std::string &kernelFileHash, const NEO::TargetDevice &targetDevice, const NEO::TranslationOutput &translationOutput) {
|
||||
NEO::SingleDeviceBinary singleDeviceBinary = {};
|
||||
|
||||
Reference in New Issue
Block a user