Shaders: name why a loop is no waterfall, and test the shapes found in review
The previous commit proves that a loop's compares select the lanes of the access and that its retry keeps exactly the lanes still waiting. Every failure of that proof was reported with one reason. They now say which part failed: - the access is in no single-block loop ending in s_cbranch_execnz; - the loop is nested in another or split over blocks; - the compares do not select the access's lanes; - the retry does not keep the lanes still waiting. Without the per-lane form the proof cannot run. Nothing is emitted then, and that failure is the one reported, as before. Tests, all hand-assembled: - the case ifBars reported on upstream PR #566 (the compares never narrow EXEC), an access under a further mask, a retry that keeps other lanes than those waiting, a wave64 retry of one half: refused, each with its reason; - the waterfall LLVM writes for GFX10 and later (a v_cmpx_eq chain, the retry as todo & !EXEC, also folded into s_andn2_wrexec) is accepted in wave32 and wave64, and each lane samples its own texture on the GPU; - one loop per operand, the sampler's inside the resource's, is refused by name. The console gives each lane its own pair there; following the outer loop's reads into the inner block is left for later. Other per-lane work in a waterfall loop is still taken to run once for each lane; marked as a shortcut. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
1 parent
b1c83069db
commit
6c63deaa89
2 files changed
+268
-75
No files matched your search
@@ -213,3 +213,18 @@ fn lanes_load_from_the_buffer_their_nested_arms_chose() {
|
||||
assert_eq!(got, want, "{label}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lanes_sample_their_own_texture_in_a_waterfall_narrowed_by_v_cmpx() {
|
||||
use crate::resource::tests::cmpx_waterfall;
|
||||
// Lanes below 16 hold the first descriptor, the others the second.
|
||||
let want: Vec<f32> = (0..32).map(|l| if l < 16 { 1.0 } else { 2.0 }).collect();
|
||||
for folded in [false, true] {
|
||||
let shader = build(&cmpx_waterfall(false, folded), false);
|
||||
let results = sampled(&shader);
|
||||
assert!(!results.is_empty());
|
||||
for (label, red) in results {
|
||||
assert_eq!(red, want, "{label}, folded {folded}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user