Refactor: Cycles: Replace remaining fprintf with logging

Pull Request: https://projects.blender.org/blender/blender/pulls/140244
This commit is contained in:
Brecht Van Lommel
2025-06-22 22:23:52 +02:00
parent b9d7bab6e6
commit cf36acbc0c
28 changed files with 121 additions and 125 deletions

View File

@@ -4,8 +4,10 @@
#ifdef WITH_HIPRT
# include "device/hiprt/device_impl.h"
# include <iomanip>
# include "device/hip/util.h"
# include "device/hiprt/device_impl.h"
# include "kernel/device/hiprt/globals.h"
# include "util/log.h"
@@ -152,9 +154,9 @@ string HIPRTDevice::compile_kernel(const uint kernel_features, const char *name,
if (!use_adaptive_compilation()) {
const string fatbin = path_get(string_printf("lib/%s_rt_%s.hipfb.zst", name, arch.c_str()));
VLOG(1) << "Testing for pre-compiled kernel " << fatbin << ".";
LOG(INFO) << "Testing for pre-compiled kernel " << fatbin << ".";
if (path_exists(fatbin)) {
VLOG(1) << "Using precompiled kernel.";
LOG(INFO) << "Using precompiled kernel.";
return fatbin;
}
}
@@ -171,9 +173,9 @@ string HIPRTDevice::compile_kernel(const uint kernel_features, const char *name,
const string fatbin = path_cache_get(path_join("kernels", fatbin_file));
const string hiprt_include_path = path_join(source_path, "kernel/device/hiprt");
VLOG(1) << "Testing for locally compiled kernel " << fatbin << ".";
LOG(INFO) << "Testing for locally compiled kernel " << fatbin << ".";
if (path_exists(fatbin)) {
VLOG(1) << "Using locally compiled kernel.";
LOG(INFO) << "Using locally compiled kernel.";
return fatbin;
}
@@ -208,11 +210,8 @@ string HIPRTDevice::compile_kernel(const uint kernel_features, const char *name,
const int hipcc_hip_version = hipewCompilerVersion();
LOG(INFO) << "Found hipcc " << hipcc << ", HIP version " << hipcc_hip_version << ".";
if (hipcc_hip_version < 40) {
printf(
"Unsupported HIP version %d.%d detected, "
"you need HIP 4.0 or newer.\n",
hipcc_hip_version / 10,
hipcc_hip_version % 10);
LOG(WARNING) << "Unsupported HIP version " << hipcc_hip_version / 10 << "."
<< hipcc_hip_version % 10 << ", you need HIP 4.0 or newer.\n";
return string();
}
@@ -235,7 +234,7 @@ string HIPRTDevice::compile_kernel(const uint kernel_features, const char *name,
options.append(" -D WITH_NANOVDB");
# endif
printf("Compiling %s and caching to %s", source_path.c_str(), fatbin.c_str());
LOG(INFO_IMPORTANT) << "Compiling " << source_path << " and caching to " << fatbin;
double starttime = time_dt();
@@ -258,7 +257,8 @@ string HIPRTDevice::compile_kernel(const uint kernel_features, const char *name,
return string();
}
printf("Kernel compilation finished in %.2lfs.\n", time_dt() - starttime);
LOG(INFO_IMPORTANT) << "Kernel compilation finished in " << std::fixed << std::setprecision(2)
<< time_dt() - starttime << "s";
return fatbin;
}
@@ -267,7 +267,7 @@ bool HIPRTDevice::load_kernels(const uint kernel_features)
{
if (hipModule) {
if (use_adaptive_compilation()) {
VLOG(1) << "Skipping HIP kernel reload for adaptive compilation, not currently supported.";
LOG(INFO) << "Skipping HIP kernel reload for adaptive compilation, not currently supported.";
}
return true;
}