Repository navigation
gpu/adapter: fall back to numeric model token when index is out of range - #82
Merged
ivall merged 1 commit intoNov 23, 2026
Conversation
Collaborator
|
Merged. Tested on Windows 11 with an RX 9070 (RDNA4): |
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.
Summary
Allows numeric GPU model selectors like
XCL_ADAPTER=5070,XCL_ADAPTER=3080, orXCL_ADAPTER=7900to work naturally without breaking numeric adapter index selection (0,1, ...).Previously,
Selector::parseturned any integer string intoSelector::Index(n)and matched only by adapter index, soXCL_ADAPTER=5070reported no match even when"NVIDIA GeForce RTX 5070"was present.Changes
crates/xcl/src/gpu/adapter.rs:"0"or no leading zero, no leading+) forSelector::Index, preserving inputs like"+1"or"007"asSelector::Name.contains_numeric_tokenandselect_indices: whenSelector::Index(n)is out of range (n >= names.len()), fall back to matchingnas a standalone numeric token bounded by non-digits (so5070matchesRTX 5070,7900matchesRX 7900XTX, and770matchesArc A770, while an out-of-range index like2does not falsely matchRTX 2080).candidatesthroughselect_indices.crates/xcl/src/gpu/adapter_tests.rs:0,007,+1, in-range index precedence, out-of-range model fallback (5070,7900,770) with Unicode™/®names, empty adapter lists, and non-digit token boundary rejection (2,208,80againstRTX 2080).Verification
cargo test -p xcl --lib gpu::adapter::tests -- --test-threads=2: 3 passed; 0 failed.