SWDEV-483241 - Add a compile option to avoid including default hiprtc header

Change-Id: Ic23b41395588e6183abac36cb7543da02b0aba29
Dieser Commit ist enthalten in:
Satyanvesh Dittakavi
2024-09-19 19:19:14 +00:00
Ursprung e36666e536
Commit 522ae8ead4
2 geänderte Dateien mit 22 neuen und 7 gelöschten Zeilen
+22 -3
Datei anzeigen
@@ -116,16 +116,35 @@ hiprtcResult hiprtcCompileProgram(hiprtcProgram prog, int numOptions, const char
auto* rtcProgram = hiprtc::RTCCompileProgram::as_RTCCompileProgram(prog);
bool fgpu_rdc = false;
std::vector<std::string> opt;
bool no_builtin_header = false;
std::vector<std::string> opt, compile_options;
opt.reserve(numOptions);
compile_options.reserve(numOptions + 4);
for (int i = 0; i < numOptions; i++) {
if (std::string(options[i]) == std::string("-fgpu-rdc")) {
fgpu_rdc = true;
}
opt.push_back(std::string(options[i]));
if (std::string(options[i]) != std::string("--hiprtc-no-builtin-header")) {
opt.push_back(std::string(options[i]));
} else {
no_builtin_header = true;
}
}
if (!rtcProgram->compile(opt, fgpu_rdc)) {
// Do not include the default hiprtc header if the app passes --hiprtc-no-builtin-header option.
// This is to avoid conflicts with std type traits defined in hiprtc header. Once the actual fix
// to move type traits to __hip_internal namespace is made in 7.0, this option can be removed.
if (!no_builtin_header) {
compile_options.push_back("-D__HIPCC_RTC__");
compile_options.push_back("-nogpuinc");
compile_options.push_back("-include");
compile_options.push_back("hiprtc_runtime.h");
}
compile_options.insert(std::end(compile_options), std::begin(opt), std::end(opt));
if (!rtcProgram->compile(compile_options, fgpu_rdc)) {
HIPRTC_RETURN(HIPRTC_ERROR_COMPILATION);
}
-4
Datei anzeigen
@@ -184,11 +184,7 @@ RTCCompileProgram::RTCCompileProgram(std::string name_) : RTCProgram(name_), fgp
compile_options_.push_back(hipVerMajor);
compile_options_.push_back(hipVerMinor);
compile_options_.push_back(hipVerPatch);
compile_options_.push_back("-D__HIPCC_RTC__");
compile_options_.push_back("-include");
compile_options_.push_back("hiprtc_runtime.h");
compile_options_.push_back("-std=c++14");
compile_options_.push_back("-nogpuinc");
compile_options_.push_back("-Wno-gnu-line-marker");
compile_options_.push_back("-Wno-missing-prototypes");
#ifdef _WIN32