LDS bounds exemption: whole 16-digit hashes only, and with_program restores the thread state (follow-up to #938) #2368
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2368"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Victorywillbeours222 on 2026-11-29T12:24:39Z.
Follow-up to #938 (face programs exempt from
VICTORY_LDS_BOUNDS). It fixes the two points @Yuanzer raised in the review there, which were still open on main.1.
VICTORY_LDS_BOUNDS_EXEMPTmatches whole hashes, not prefixesBefore this,
lds_bounds_exempt()usedstarts_with, soVICTORY_LDS_BOUNDS_EXEMPT=atook the bounds off every program whose hash starts witha.Now:
eq_ignore_ascii_case).eprintln!line names the ignored entries when the list is first read, so this happens once per process.0, empty andallmean what they meant before: none, none, and every program.exempt_list,exempt), so they can be tested without setting the env var.2.
with_programrestores the thread state on return and on unwindwith_programnow saves what was on the thread (the program hash, plus thelds_clamped/lds_clamped_meshcounts it resets) and puts it back from a smallDropguard. So:It still allocates nothing at the top level (the saved outer hash is empty there). Only a nested call clones the outer hash.
Tests
New tests in
emit/lower/analysis.rs:an_lds_bounds_exempt_entry_names_a_whole_program_hash: an exact hash matches, in either case. Prefixes (38a6,3, 15 digits) and a 16-character non-hex entry match nothing and are reported as ignored.lds_bounds_exempt_zero_is_none_and_unset_is_the_face_programs:0and empty exempt nothing. Unset gives the 25 face programs and only those.allexempts everything.a_nested_with_program_gives_the_outer_program_back: the hash and the clamped count come back after an inner call.a_panicking_translation_leaves_the_program_it_found: understd::panic::catch_unwind, at the top level and nested.cargo test -p victory-shader(Windows, Rust 1.98.1): 466 passed, 0 failed, 9 ignored.cargo clippy -p victory-shader --all-targets: no new warnings. Four warnings are already on main, all outside this change, and they would fail-D warnings(line numbers as on main):emit/lower/analysis.rs:6: unused importPAIR_MEETINGSemit/lower.rs:594: unused importanalysis::lane_regionsemit/lower/analysis.rs:467:while_immutable_condition(thewhile loadsloop)native.rs:1655:too_many_arguments(the test helperrecord, 8 arguments)Not changed
VICTORY_WAVE_WIDE_FALLBACK_SKIP(documented as taking hash prefixes) andVICTORY_LDS_LAST_RESORTstill match by prefix. The review was only about the LDS exemption, so I left them alone.