Revert "SWDEV-425605 - Add new comgr compile to reloc"

This reverts commit 551cdcd4cfc1a9bb8b8ebfd315320629baf05655.

Reason for revert: breaks windows-psdb

Change-Id: I8b2fcaf0d0be09a9364e386127cabafb68a67e0d
This commit is contained in:
Jatin Jaikishan Chaudhary
2024-01-22 11:49:01 -05:00
کامیت شده توسط Maneesh Gupta
والد c4b9442fc4
کامیت baf61b6a02
4فایلهای تغییر یافته به همراه74 افزوده شده و 100 حذف شده
@@ -585,86 +585,6 @@ bool createAction(amd_comgr_action_info_t& action, std::vector<std::string>& opt
return AMD_COMGR_STATUS_SUCCESS;
}
bool compileToExecutable(const amd_comgr_data_set_t compileInputs, const std::string& isa,
std::vector<std::string>& compileOptions, std::string& buildLog,
std::vector<char>& exe) {
amd_comgr_language_t lang = AMD_COMGR_LANGUAGE_HIP;
amd_comgr_action_info_t action;
amd_comgr_data_set_t reloc;
amd_comgr_data_set_t output;
amd_comgr_data_set_t input = compileInputs;
if (auto res = createAction(action, compileOptions, isa, lang); res != AMD_COMGR_STATUS_SUCCESS) {
return false;
}
if (auto res = amd::Comgr::create_data_set(&reloc); res != AMD_COMGR_STATUS_SUCCESS) {
amd::Comgr::destroy_action_info(action);
return false;
}
if (auto res = amd::Comgr::create_data_set(&output); res != AMD_COMGR_STATUS_SUCCESS) {
amd::Comgr::destroy_action_info(action);
amd::Comgr::destroy_data_set(reloc);
return false;
}
if (auto res = amd::Comgr::do_action(AMD_COMGR_ACTION_COMPILE_SOURCE_TO_RELOCATABLE, action,
input, reloc);
res != AMD_COMGR_STATUS_SUCCESS) {
extractBuildLog(reloc, buildLog);
amd::Comgr::destroy_action_info(action);
amd::Comgr::destroy_data_set(reloc);
amd::Comgr::destroy_data_set(output);
return false;
}
if (!extractBuildLog(reloc, buildLog)) {
amd::Comgr::destroy_action_info(action);
amd::Comgr::destroy_data_set(reloc);
amd::Comgr::destroy_data_set(output);
return false;
}
amd::Comgr::destroy_action_info(action);
if (auto res = createAction(action, compileOptions, isa, lang); res != AMD_COMGR_STATUS_SUCCESS) {
amd::Comgr::destroy_action_info(action);
amd::Comgr::destroy_data_set(reloc);
amd::Comgr::destroy_data_set(output);
return false;
}
if (auto res = amd::Comgr::do_action(AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE, action,
reloc, output);
res != AMD_COMGR_STATUS_SUCCESS) {
extractBuildLog(output, buildLog);
amd::Comgr::destroy_action_info(action);
amd::Comgr::destroy_data_set(output);
amd::Comgr::destroy_data_set(reloc);
return false;
}
if (!extractBuildLog(output, buildLog)) {
amd::Comgr::destroy_action_info(action);
amd::Comgr::destroy_data_set(output);
amd::Comgr::destroy_data_set(reloc);
return false;
}
if (!extractByteCodeBinary(output, AMD_COMGR_DATA_KIND_EXECUTABLE, exe)) {
amd::Comgr::destroy_action_info(action);
amd::Comgr::destroy_data_set(output);
amd::Comgr::destroy_data_set(reloc);
return false;
}
// Clean up
amd::Comgr::destroy_action_info(action);
amd::Comgr::destroy_data_set(output);
amd::Comgr::destroy_data_set(reloc);
return true;
}
bool compileToBitCode(const amd_comgr_data_set_t compileInputs, const std::string& isa,
std::vector<std::string>& compileOptions, std::string& buildLog,
std::vector<char>& LLVMBitcode) {
@@ -726,7 +646,8 @@ bool linkLLVMBitcode(const amd_comgr_data_set_t linkInputs, const std::string& i
return false;
}
if (auto res = amd::Comgr::do_action(AMD_COMGR_ACTION_LINK_BC_TO_BC, action, linkInputs, output);
if (auto res =
amd::Comgr::do_action(AMD_COMGR_ACTION_LINK_BC_TO_BC, action, linkInputs, output);
res != AMD_COMGR_STATUS_SUCCESS) {
amd::Comgr::destroy_action_info(action);
amd::Comgr::destroy_data_set(output);
@@ -994,9 +915,9 @@ bool fillMangledNames(std::vector<char>& dataVec, std::map<std::string, std::str
return false;
}
for (auto& it : mangledNames) {
for (auto &it : mangledNames) {
size_t Size;
char* data = const_cast<char*>(it.first.data());
char *data = const_cast<char*>(it.first.data());
if (auto res = amd::Comgr::map_name_expression_to_symbol_name(dataObject, &Size, data, NULL)) {
amd::Comgr::release_data(dataObject);
@@ -1004,8 +925,7 @@ bool fillMangledNames(std::vector<char>& dataVec, std::map<std::string, std::str
}
std::unique_ptr<char[]> mName(new char[Size]());
if (auto res =
amd::Comgr::map_name_expression_to_symbol_name(dataObject, &Size, data, mName.get())) {
if (auto res = amd::Comgr::map_name_expression_to_symbol_name(dataObject, &Size, data, mName.get())) {
amd::Comgr::release_data(dataObject);
return false;
}