Repository navigation
fix(amd-topo): format vram with LC_ALL=C for decimal-comma locales - #6076
Closed
vaibhavsrv wants to merge 1 commit into
Closed
vaibhavsrv wants to merge 1 commit into
vaibhavsrv wants to merge 1 commit into
Conversation
This was referenced Sep 20, 2026
Collaborator
|
Thanks for this contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5648
Why this matters
In
ods/installers/lib/amd-topo.sh,detect_amd_topo()converts each GPU's raw VRAM byte count into gigabytes using an unadornedawkcall:vram_gb=$(awk -v bytes="$vram_bytes" 'BEGIN { printf "%.1f", bytes / 1073741824 }')Because
printf "%.1f"obeys the active environment'sLC_NUMERICrules, running on hosts or containers configured with decimal-comma locales (de_DE,fr_FR,es_ES,pt_BR, etc.) causesawkto emit comma-formatted floats (e.g.24,0instead of24.0). This value is subsequently fed as field 3 into the per-GPU TSV, whichjqconverts viamemory_gb: (.[2] | tonumber). Becausejqstrictly expects standard JSON numbers,tonumberthrows an uncaught error:jq: error (at <stdin>:1): Expected value before ',' at line 1, column 3 (while parsing '24,0')This causes the entire AMD topology JSON detection to fail on decimal-comma systems.
This fix scopes the VRAM calculation to
LC_ALL=C awk, exactly mirroring the CPU-budget formatting standard established in #1662 (tests/test-locale-safe-cpu-formatting.sh). Dot-decimal locales remain unaffected, and decimal-comma locales cleanly produce parseable floating-point numbers.Validation
LC_ALL=de_DE.UTF-8,awkformatted 24GB VRAM as24,0, which causedjq 'tonumber'to fail withExpected value before ','.ods/tests/test_amd_topo_vram_locale.pyunder simulated comma locales confirms thatLC_ALL=Cguarantees dot-decimal formatting (24.0), andjqparses the JSON output with exit code 0.test_amd_topo_vram_locale.pypasses cleanly (exit code 0). Wired into Linux CI workflow under Manifest Compatibility Checks.Overlap check
resolve-compose-stack.sh. This PR focuses strictly on AMD hardware detection inamd-topo.sh.Risk / AI disclosure
AI-assisted investigation, implementation, and test regressions. This aligns VRAM formatting with existing project locale-safety standards (
LC_ALL=C). Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.Follow-up integration evidence
Composed with #5871, #5951, #5952, and #5953 at HEAD without conflicts. Production and test diffs passed together; AMD topology and installer compatibility suites remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.