SWDEV-381625 - Parse compiler and linker options from environment variable.
Change-Id: Id5a012b678e5973c4b64dff84444a909aefae006
[ROCm/clr commit: 6a0f80a03d]
Dieser Commit ist enthalten in:
committet von
Karthik Jayaprakash
Ursprung
db1e03f276
Commit
76cc68ff80
@@ -109,6 +109,19 @@ bool RTCProgram::findIsa() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// RTC Compile Program Member Functions
|
||||
void RTCProgram::AppendOptions(const std::string app_env_var, std::vector<std::string>* options) {
|
||||
|
||||
if (options == nullptr) {
|
||||
LogError("Append options passed is nullptr.");
|
||||
return;
|
||||
}
|
||||
|
||||
std::stringstream ss(app_env_var);
|
||||
std::istream_iterator<std::string> begin{ss}, end;
|
||||
options->insert(options->end(), begin, end);
|
||||
}
|
||||
|
||||
// RTC Compile Program Member Functions
|
||||
RTCCompileProgram::RTCCompileProgram(std::string name_) : RTCProgram(name_), fgpu_rdc_(false) {
|
||||
if ((amd::Comgr::create_data_set(&compile_input_) != AMD_COMGR_STATUS_SUCCESS) ||
|
||||
@@ -150,6 +163,7 @@ RTCCompileProgram::RTCCompileProgram(std::string name_) : RTCProgram(name_), fgp
|
||||
compile_options_.push_back("-fms-extensions");
|
||||
compile_options_.push_back("-fms-compatibility");
|
||||
#endif
|
||||
AppendCompileOptions();
|
||||
|
||||
exe_options_.push_back("-O3");
|
||||
}
|
||||
@@ -669,9 +683,10 @@ bool RTCLinkProgram::LinkComplete(void** bin_out, size_t* size_out) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AppendLinkerOptions();
|
||||
|
||||
std::vector<char> linked_llvm_bitcode;
|
||||
std::vector<std::string> linkopts;
|
||||
if (!linkLLVMBitcode(link_input_, isa_, linkopts, build_log_, linked_llvm_bitcode)) {
|
||||
if (!linkLLVMBitcode(link_input_, isa_, link_options_, build_log_, linked_llvm_bitcode)) {
|
||||
LogError("Error in hiprtc: unable to add device libs to linked bitcode");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -122,6 +122,7 @@ class RTCProgram {
|
||||
|
||||
// Member Functions
|
||||
bool findIsa();
|
||||
static void AppendOptions(std::string app_env_var, std::vector<std::string>* options);
|
||||
|
||||
// Data Members
|
||||
std::string name_;
|
||||
@@ -157,6 +158,9 @@ class RTCCompileProgram : public RTCProgram {
|
||||
bool transformOptions(std::vector<std::string>& compile_options);
|
||||
bool findLLVMOptions(const std::vector<std::string>& options,
|
||||
std::vector<std::string>& llvm_options);
|
||||
void AppendCompileOptions() {
|
||||
AppendOptions(HIPRTC_COMPILE_OPTIONS_APPEND, &compile_options_);
|
||||
}
|
||||
|
||||
RTCCompileProgram() = delete;
|
||||
RTCCompileProgram(RTCCompileProgram&) = delete;
|
||||
@@ -285,6 +289,9 @@ class RTCLinkProgram : public RTCProgram {
|
||||
bool AddLinkerData(void* image_ptr, size_t image_size, std::string link_file_name,
|
||||
hiprtcJITInputType input_type);
|
||||
bool LinkComplete(void** bin_out, size_t* size_out);
|
||||
void AppendLinkerOptions() {
|
||||
AppendOptions(HIPRTC_LINK_OPTIONS_APPEND, &link_options_);
|
||||
}
|
||||
};
|
||||
|
||||
// Thread Local Storage Variables Aggregator Class
|
||||
|
||||
@@ -245,7 +245,11 @@ release(bool, HIP_FORCE_DEV_KERNARG, 0, \
|
||||
release(uint, DEBUG_CLR_GRAPH_MAX_AQL_BUFFER_SIZE, 32, \
|
||||
"Size of AQL buffering queue") \
|
||||
release(bool, DEBUG_CLR_GRAPH_ENABLE_BUFFERING, false, \
|
||||
"Enable/Disable graph AQL buffering")
|
||||
"Enable/Disable graph AQL buffering") \
|
||||
release(cstring, HIPRTC_COMPILE_OPTIONS_APPEND, "", \
|
||||
"Set compile options needed for hiprtc compilation") \
|
||||
release(cstring, HIPRTC_LINK_OPTIONS_APPEND, "", \
|
||||
"Set link options needed for hiprtc compilation") \
|
||||
|
||||
namespace amd {
|
||||
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren