Remove PCH code: the code related to PCH is dead and not used (#66)

cherry-pick of compute/ec/clr/+/1184122

Co-authored-by: Juan Manuel Martinez Caamaño <juamarti@amd.com>
This commit is contained in:
MartinezFernandez, Juan
2025-03-28 10:36:19 +01:00
gecommit door GitHub
bovenliggende 8d90b44a1b
commit f580632174
4 gewijzigde bestanden met toevoegingen van 14 en 61 verwijderingen
+7 -45
Bestand weergeven
@@ -129,10 +129,9 @@ void Program::clear() {
// ================================================================================================
bool Program::compileImpl(const std::string& sourceCode,
const std::vector<const std::string*>& headers,
const char** headerIncludeNames, amd::option::Options* options,
const std::vector<std::string>& preCompiledHeaders) {
const char** headerIncludeNames, amd::option::Options* options) {
if (isLC()) {
return compileImplLC(sourceCode, headers, headerIncludeNames, options, preCompiledHeaders);
return compileImplLC(sourceCode, headers, headerIncludeNames, options);
} else {
return compileImplHSAIL(sourceCode, headers, headerIncludeNames, options);
}
@@ -223,33 +222,6 @@ amd_comgr_status_t Program::extractByteCodeBinary(const amd_comgr_data_set_t inD
return AMD_COMGR_STATUS_SUCCESS;
}
amd_comgr_status_t Program::addPreCompiledHeader(
amd_comgr_data_set_t* dataSet, const std::vector<std::string>& preCompiledHeaders) {
amd_comgr_status_t status = AMD_COMGR_STATUS_SUCCESS;
if (preCompiledHeaders.size() > 0) {
for (auto& i : preCompiledHeaders) {
amd_comgr_data_t pch_data;
status = amd::Comgr::create_data(AMD_COMGR_DATA_KIND_PRECOMPILED_HEADER, &pch_data);
if (status != AMD_COMGR_STATUS_SUCCESS) {
return status;
}
status = amd::Comgr::set_data(pch_data, i.size(), i.c_str());
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::set_data_name(pch_data, "PreCompiledHeader");
}
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::data_set_add(*dataSet, pch_data);
}
amd::Comgr::release_data(pch_data);
}
}
return status;
}
amd_comgr_status_t Program::addCodeObjData(const char *source,
const size_t size,
const amd_comgr_data_kind_t type,
@@ -604,8 +576,7 @@ static std::size_t getOCLOptionsHash(const amd::option::Options &options) {
bool Program::compileImplLC(const std::string& sourceCode,
const std::vector<const std::string*>& headers,
const char** headerIncludeNames, amd::option::Options* options,
const std::vector<std::string>& preCompiledHeaders) {
const char** headerIncludeNames, amd::option::Options* options) {
#if defined(USE_COMGR_LIBRARY)
const char* xLang = options->oVariables->XLang;
if (xLang != nullptr) {
@@ -626,13 +597,6 @@ bool Program::compileImplLC(const std::string& sourceCode,
return false;
}
if (preCompiledHeaders.size() > 0)
if (addPreCompiledHeader(&inputs, preCompiledHeaders) != AMD_COMGR_STATUS_SUCCESS) {
buildLog_ += "Error: COMGR failed to add precompiled Headers.\n";
amd::Comgr::destroy_data_set(inputs);
return false;
}
if (addCodeObjData(sourceCode.c_str(), sourceCode.length(), AMD_COMGR_DATA_KIND_SOURCE,
"CompileSource", &inputs) != AMD_COMGR_STATUS_SUCCESS) {
buildLog_ += "Error: COMGR fails to create data from source.\n";
@@ -1518,7 +1482,7 @@ int32_t Program::compile(const std::string& sourceCode,
// Compile the source code if any
if ((buildStatus_ == CL_BUILD_IN_PROGRESS) && !sourceCode.empty() &&
!compileImpl(sourceCode, headers, headerIncludeNames, options, {})) {
!compileImpl(sourceCode, headers, headerIncludeNames, options)) {
buildStatus_ = CL_BUILD_ERROR;
if (buildLog_.empty()) {
buildLog_ = "Internal error: Compilation failed.";
@@ -1753,8 +1717,7 @@ bool Program::trySubstObjFile(const char *SubstCfgFile,
}
int32_t Program::build(const std::string& sourceCode, const char* origOptions,
amd::option::Options* options,
const std::vector<std::string>& preCompiledHeaders) {
amd::option::Options* options) {
if (AMD_OCL_SUBST_OBJFILE != NULL &&
trySubstObjFile(AMD_OCL_SUBST_OBJFILE, sourceCode, options)) {
return buildError();
@@ -1799,10 +1762,9 @@ int32_t Program::build(const std::string& sourceCode, const char* origOptions,
bool compileStatus = true;
if ((buildStatus_ == CL_BUILD_IN_PROGRESS) && !sourceCode.empty()) {
if (!headerIncludeNames.empty()) {
compileStatus =
compileImpl(sourceCode, headers, &headerIncludeNames[0], options, preCompiledHeaders);
compileStatus = compileImpl(sourceCode, headers, &headerIncludeNames[0], options);
} else {
compileStatus = compileImpl(sourceCode, headers, nullptr, options, preCompiledHeaders);
compileStatus = compileImpl(sourceCode, headers, nullptr, options);
}
}
if (!compileStatus) {