Fix AMD_LOG_LEVEL_SIZE env variable (#2463)

AMD_LOG_LEVEL_SIZE is being used in a global variable.
This always uses the default value of 2048 because the
HIP runtime doesn't have the opportunity to load
environment variables at the point where global variables
are initialized.

The solution is to use AMD_LOG_LEVEL_SIZE inside
truncate_log_file() function.
Este commit está contenido en:
Fábio Mestre
2026-01-13 09:57:49 +00:00
cometido por GitHub
padre 35a5274b84
commit 61325db1c8
+2 -1
Ver fichero
@@ -40,13 +40,14 @@
namespace amd {
FILE* outFile = stderr;
const size_t maxLogSize = AMD_LOG_LEVEL_SIZE * Mi;
// ================================================================================================
void truncate_log_file() {
if (outFile != stderr) {
fseek(outFile, 0, SEEK_END);
long size = ftell(outFile);
const size_t maxLogSize = AMD_LOG_LEVEL_SIZE * Mi;
if (size > maxLogSize) {
if (nullptr == freopen(NULL, "w", outFile)) {
outFile = stderr;