Repository navigation
fix(amd-topo): guard non-numeric byte counts in amd_memory_type - #6323
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 23, 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.
Why this matters
In
ods/installers/lib/amd-topo.sh,amd_memory_type()classifies whether an AMD GPU topology exhibits discrete or unified memory by performing integer division in Bash arithmetic ($(( gtt_bytes / 1073741824 ))and$(( vram_bytes / 1073741824 ))). When topology discovery encounters missing sysfs entries, unpopulated driver nodes, or placeholder text such as"N/A", Bash underset -euo pipefailhalts withunbound variableor arithmetic syntax errors, terminating multi-GPU topology discovery before fallbacks can be evaluated.This patch adds surgical regex guards
[[ "$vram_bytes" =~ ^[0-9]+$ ]] || vram_bytes=0and[[ "$gtt_bytes" =~ ^[0-9]+$ ]] || gtt_bytes=0inamd_memory_type(). Any non-numeric or missing input safely defaults to 0 bytes and cleanly falls back to"discrete". Existing APU threshold logic and valid topology detection remain untouched.Validation
amd_memory_type "invalid" "N/A"failed withline 50: N: unbound variableand non-zero exit code.discretewith exit code 0; valid discrete and unified byte counts continue to evaluate correctly.Overlap check
fix(pixel-inference): validate top_logprobs integer bounds) — inference API parameter bounds; zero shell installer overlap.fix: export AMD GPU indices safely with defaults) — GPU index export environment formatting, separate from memory type topology classification.fix(amd-topo): format vram with LC_ALL=C for decimal-comma locales) — decimal formatting in topology JSON output, adjacent helper.Risk / AI disclosure
Follow-up integration evidence