test(shader): check the memory and barrier passes on thread groups (on top of #41) #89
No reviewers
Labels
No labels
accessibility
bench-bm-v1
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/PastiiJay--klbf-lab!89
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-89"
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?
@Kal0s-design on GitHub · 2026-11-26 16:33 UTC · original
Kal0s-design:test/opt-thread-group→beta· +5487 −89 · 2 files · 3 commits · openTest-only, stacked on #41 as suggested there. Only the last commit (
a8ce914) is new; the two before it are #41's. Once #41 lands this is one file,crates/victory-shader/src/emit/bitcode/opt.rs, all insidemod tests.Why
every_pass_leaves_what_random_programs_storenever makes a load, a store or a barrier, and its interpreter panics on them. SoLOADS, the loadsLICMhoists andBARRIERS(adjacent and read-after-read) were covered only by the hand-written cases.What
mod thread_group, two tests:passes_keep_what_a_thread_group_computesbuilds random structured programs in the style ofGen(branches, short loops, joins) with two private arrays, two LDS arrays anddx.op.barrierat the top level only. Half the phases are straight-line, so several barriers share a block. An interpreter runs a group of four threads that can stop after any instruction, under six schedules (three fixed orders, round robin, two random interleavings). The LDS accesses are race free by construction: between two barriers each LDS array is only written at the thread's own slots, only used at its own slots, or only read. So the plain program gives one result under every schedule (the test asserts that none is skipped), and each of 11 pass masks has to give the same per-thread output stream and final LDS contents under every schedule. It also asserts thatALLremoved some barriers and memory operations, so it does not pass on programs the passes ignore.a_barrier_between_reads_and_an_own_store_staysis the hand-built shape the read-after-read rule must leave alone: reads of other threads' slots, a barrier, a store to the thread's own slot, more reads, a barrier.VICTORY_OPT_GROUP_SEEDSruns more programs than the default 60. The two tests take about 3.5 s in a debug build.Checked
690b4b2, 30,000 programs with no difference.BarrierState::resetkeepingrar(both tests fail; the hand-built case goes from 3 barriers to 2), a dynamic private store not clearing constant-index values (LOADS, seed 25),can_hoisttaking any load (LICM, seed 35).cargo clippy -p victory-shader --all-targets --locked -- -D warnings, with and without--all-features: clean.cargo test -p victory-shader --lib --locked: 239 passed, 4 ignored.xtask policyon this branch reports the same four files as on #41's base (lower.rssize, two files underdocs/klbf,tests/check_cold_cache.py), none touched here. Windows only.Not covered
AI-assisted: yes (Claude Code).
🤖 Generated with Claude Code
@PastiiJay on GitHub · 2026-11-26 16:36 UTC · original
Thanks @Kal0s-design, quick turnaround. Stacking it on #41 keeps the review simple; we will take it right after #41 lands, and if you rebase it then so it shows only
opt.rs, that is all it needs.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.