Skip to content

gpu/adapter: fall back to numeric model token when index is out of range - #82

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
certified-retart:feat/adapter-numeric-model-fallback
Nov 23, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
certified-retart:feat/adapter-numeric-model-fallback

Conversation

@certified-retart

Copy link
Copy Markdown
Contributor

Summary

Allows numeric GPU model selectors like XCL_ADAPTER=5070, XCL_ADAPTER=3080, or XCL_ADAPTER=7900 to work naturally without breaking numeric adapter index selection (0, 1, ...).

Previously, Selector::parse turned any integer string into Selector::Index(n) and matched only by adapter index, so XCL_ADAPTER=5070 reported no match even when "NVIDIA GeForce RTX 5070" was present.

Changes

  • crates/xcl/src/gpu/adapter.rs:
    • Require canonical non-negative ASCII digits ("0" or no leading zero, no leading +) for Selector::Index, preserving inputs like "+1" or "007" as Selector::Name.
    • Added contains_numeric_token and select_indices: when Selector::Index(n) is out of range (n >= names.len()), fall back to matching n as a standalone numeric token bounded by non-digits (so 5070 matches RTX 5070, 7900 matches RX 7900XTX, and 770 matches Arc A770, while an out-of-range index like 2 does not falsely match RTX 2080).
    • Wired candidates through select_indices.
  • crates/xcl/src/gpu/adapter_tests.rs:
    • Added unit tests for 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, 80 against RTX 2080).

Verification

  • cargo test -p xcl --lib gpu::adapter::tests -- --test-threads=2: 3 passed; 0 failed.

@ivall
ivall merged commit 2bba48b into xcl-dev:main Nov 23, 2026
ivall added a commit that referenced this pull request Nov 23, 2026
ivall added a commit that referenced this pull request Nov 23, 2026
The previous commit (9284dcd, titled like this one by mistake) is the follow-up to #86:
placed textures that get memory of their own retry with COMMON when the PC refuses the
title's state, as the past-the-end fallback does, instead of falling back to the overlapping
placement.
@ivall

ivall commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Merged. Tested on Windows 11 with an RX 9070 (RDNA4): cargo test --workspace green with the retail samples (shader pack, console DLLs, texture archive), lib tests also with XCL_SPLIT_WAVE64=1; Unicorn Overlord, Minecraft and Fortnite run with this round merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants