From 7f9651d4bb34c70391280ddb60cbec49e927b2a9 Mon Sep 17 00:00:00 2001 From: Jatin Chaudhary Date: Wed, 28 Feb 2024 23:37:03 +0000 Subject: [PATCH] SWDEV-441629 - add some missing hiprtc link options Change-Id: I10019823e212c6d4de6df30c0fe1c20d9e992f29 --- hipamd/src/hiprtc/hiprtcInternal.cpp | 14 ++++++++++---- hipamd/src/hiprtc/hiprtcInternal.hpp | 9 +++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/hipamd/src/hiprtc/hiprtcInternal.cpp b/hipamd/src/hiprtc/hiprtcInternal.cpp index eaa9e4b80f..de597272aa 100644 --- a/hipamd/src/hiprtc/hiprtcInternal.cpp +++ b/hipamd/src/hiprtc/hiprtcInternal.cpp @@ -37,10 +37,17 @@ std::unordered_setRTCLinkProgram::linker_set_; std::vector getLinkOptions(const LinkArguments& args) { std::vector res; - auto irArgCount = args.linkerIRArgCount(); + + { // process optimization level + std::string opt("-O"); + opt += std::to_string(args.optimization_level_); + res.push_back(opt); + } + + const auto irArgCount = args.linker_ir2isa_args_count_; if (irArgCount > 0) { res.reserve(irArgCount); - auto irArg = args.linkerIRArg(); + const auto irArg = args.linker_ir2isa_args_; for (size_t i = 0; i < irArgCount; i++) { res.emplace_back(std::string(irArg[i])); } @@ -636,7 +643,6 @@ bool RTCLinkProgram::LinkComplete(void** bin_out, size_t* size_out) { } std::vector exe_options = getLinkOptions(link_args_); - exe_options.push_back("-O3"); LogPrintfInfo("Exe options forwarded to compiler: %s", [&]() { std::string ret; @@ -648,7 +654,7 @@ bool RTCLinkProgram::LinkComplete(void** bin_out, size_t* size_out) { }() .c_str()); if (!createExecutable(exec_input_, isa_, exe_options, build_log_, executable_)) { - LogError("Error in hiprtc: unable to create exectuable"); + LogPrintfInfo("Error in hiprtc: unable to create exectuable: %s", build_log_.c_str()); return false; } diff --git a/hipamd/src/hiprtc/hiprtcInternal.hpp b/hipamd/src/hiprtc/hiprtcInternal.hpp index f653e75d6f..0a54bfd5f1 100644 --- a/hipamd/src/hiprtc/hiprtcInternal.hpp +++ b/hipamd/src/hiprtc/hiprtcInternal.hpp @@ -247,14 +247,11 @@ struct LinkArguments { global_symbol_count_{0}, lto_{0}, ftz_{0}, - prec_div_{0}, - prec_sqrt_{0}, - fma_{0}, + prec_div_{1}, + prec_sqrt_{1}, + fma_{1}, linker_ir2isa_args_{nullptr}, linker_ir2isa_args_count_{0} {} - - size_t linkerIRArgCount() const { return linker_ir2isa_args_count_; } - const char** linkerIRArg() const { return linker_ir2isa_args_; } }; class RTCLinkProgram : public RTCProgram {