Fix: Cycles HIP: Runtime compile missing flags and C++17, improve logging

HIP-RT device:
- Add missing flags from the common flags query to the final compiler options
- Switch logging utility from printf to LOG_INFO_IMPORTANT
- Remove redundant compiler options already covered by common flags

HIP device:
- Add compiler command to logging
- Update C++ standard to C++17 to resolve compiler warnings

Pull Request: https://projects.blender.org/blender/blender/pulls/145284
This commit is contained in:
Sahar A. Kashi
2025-09-10 10:33:44 +02:00
committed by Sergey Sharybin
parent 29d18c45e4
commit 428093af06
2 changed files with 9 additions and 9 deletions

View File

@@ -262,7 +262,7 @@ string HIPDevice::compile_kernel(const uint kernel_features, const char *name, c
const string kernel_md5 = util_md5_string(source_md5 + common_cflags);
const char *const kernel_ext = "genco";
std::string options = "-Wno-parentheses-equality -Wno-unused-value -ffast-math";
std::string options = "-Wno-parentheses-equality -Wno-unused-value -ffast-math -std=c++17";
# ifndef NDEBUG
options.append(" -save-temps");
@@ -332,7 +332,7 @@ string HIPDevice::compile_kernel(const uint kernel_features, const char *name, c
common_cflags.c_str());
LOG_INFO_IMPORTANT << "Compiling " << ((use_adaptive_compilation()) ? "adaptive " : "")
<< "HIP kernel ...";
<< "HIP kernel ... " << command;
# ifdef _WIN32
command = "call " + command;

View File

@@ -222,25 +222,25 @@ string HIPRTDevice::compile_kernel(const uint kernel_features, const char *name,
const char *const kernel_ext = "genco";
string options;
options.append(
"-Wno-parentheses-equality -Wno-unused-value -ffast-math -O3 -std=c++17 -D __HIPRT__");
options.append("-Wno-parentheses-equality -Wno-unused-value -ffast-math -O3 -std=c++17");
options.append(" --offload-arch=").append(arch.c_str());
# ifdef WITH_NANOVDB
options.append(" -D WITH_NANOVDB");
# endif
LOG_INFO_IMPORTANT << "Compiling " << source_path << " and caching to " << fatbin;
double starttime = time_dt();
string compile_command = string_printf("%s %s -I %s -I %s --%s %s -o \"%s\"",
string compile_command = string_printf("%s %s -I %s -I %s --%s %s -o \"%s\" %s",
hipcc,
options.c_str(),
include_path.c_str(),
hiprt_include_path.c_str(),
kernel_ext,
source_path.c_str(),
fatbin.c_str());
fatbin.c_str(),
common_cflags.c_str());
LOG_INFO_IMPORTANT << "Compiling " << ((use_adaptive_compilation()) ? "adaptive " : "")
<< "HIP-RT kernel ... " << compile_command;
# ifdef _WIN32
compile_command = "call " + compile_command;