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>
[ROCm/clr commit: f580632174]
This commit is contained in:
committed by
GitHub
szülő
d49a2a51d6
commit
966157cd5b
@@ -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) {
|
||||
|
||||
@@ -194,7 +194,7 @@ class Program : public amd::HeapObject {
|
||||
|
||||
//! Build the device program.
|
||||
int32_t build(const std::string& sourceCode, const char* origOptions,
|
||||
amd::option::Options* options, const std::vector<std::string>& preCompiledHeaders);
|
||||
amd::option::Options* options);
|
||||
|
||||
//! Load the device program.
|
||||
bool load();
|
||||
@@ -319,11 +319,10 @@ class Program : public amd::HeapObject {
|
||||
*
|
||||
* \return True if we successefully compiled a GPU program
|
||||
*/
|
||||
virtual bool compileImpl(
|
||||
const std::string& sourceCode, //!< the program's source code
|
||||
const std::vector<const std::string*>& headers, const char** headerIncludeNames,
|
||||
amd::option::Options* options, //!< compile options's object
|
||||
const std::vector<std::string>& preCompiledHeaders //!< precompiled headers
|
||||
virtual bool compileImpl(const std::string& sourceCode, //!< the program's source code
|
||||
const std::vector<const std::string*>& headers,
|
||||
const char** headerIncludeNames,
|
||||
amd::option::Options* options //!< compile options's object
|
||||
);
|
||||
|
||||
//! Link the device program.
|
||||
@@ -406,8 +405,7 @@ class Program : public amd::HeapObject {
|
||||
|
||||
//! Compile the device program with LC path
|
||||
bool 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);
|
||||
|
||||
//! Compile the device program with HSAIL path
|
||||
bool compileImplHSAIL(const std::string& sourceCode,
|
||||
@@ -447,10 +445,6 @@ class Program : public amd::HeapObject {
|
||||
const size_t size, const amd_comgr_data_kind_t type,
|
||||
const char* name, amd_comgr_data_set_t* dataSet);
|
||||
|
||||
//! Add precompiled headers to the data set
|
||||
amd_comgr_status_t addPreCompiledHeader(amd_comgr_data_set_t* dataSet,
|
||||
const std::vector<std::string>& preCompiledHeaders);
|
||||
|
||||
//! Create action for the specified language, target and options
|
||||
amd_comgr_status_t createAction(const amd_comgr_language_t oclver,
|
||||
const std::vector<std::string>& options, amd_comgr_action_info_t* action,
|
||||
|
||||
@@ -555,7 +555,7 @@ int32_t Program::build(const std::vector<Device*>& devices, const char* options,
|
||||
if (devProgram->buildStatus() != CL_BUILD_NONE) {
|
||||
continue;
|
||||
}
|
||||
int32_t result = devProgram->build(sourceCode_, options, &parsedOptions, precompiledHeaders_);
|
||||
int32_t result = devProgram->build(sourceCode_, options, &parsedOptions);
|
||||
|
||||
// Check if the previous device failed a build
|
||||
if ((result != CL_SUCCESS) && (retval != CL_SUCCESS)) {
|
||||
|
||||
@@ -106,7 +106,6 @@ class Program : public RuntimeObject {
|
||||
|
||||
std::vector<std::string> headerNames_;
|
||||
std::vector<std::string> headers_;
|
||||
std::vector<std::string> precompiledHeaders_; //!< Precompiled Headers
|
||||
std::string sourceCode_; //!< Strings that make up the source code
|
||||
Language language_; //!< Input source language
|
||||
devicebinary_t binary_; //!< The binary image, provided by the app
|
||||
@@ -180,8 +179,6 @@ class Program : public RuntimeObject {
|
||||
//! Append to source code.
|
||||
void appendToSource(const char* newCode) { sourceCode_.append(newCode); }
|
||||
|
||||
void addPreCompiledHeader(const std::string& pch) { precompiledHeaders_.push_back(pch); }
|
||||
|
||||
//! Return the program log.
|
||||
const std::string& programLog() const { return programLog_; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user