Shaders: the console's waterfall loop over a first-lane table offset
The console compiler loops over a per-lane descriptor by reading the first active lane's table offset (v_readfirstlane_b32), narrowing EXEC to the lanes with the same one (v_cmpx_eq_u32), loading that entry (s_load_dwordx8) and dropping those lanes (s_andn2_wrexec). Such a load now goes through the waterfall proof; when it holds, each lane loads its own entry through a non-uniform handle. Unproven, the offset stays the first lane's, as before. Translation census over the title's 26,096 programs: none lost, 108 get past these loops to a later refusal. The 249 programs behind #736 also need per-lane size queries in loops without an access. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ca48fbea88
commit
ffe310eb20
3 files changed
+112
-2
No files matched your search
@@ -3313,7 +3313,12 @@ impl<'a> Lower<'a> {
|
||||
return Ok(h);
|
||||
}
|
||||
let index = self.heap_index(*load, *first, sampler)?;
|
||||
let h = self.s.heap_handle(self.cur, index, sampler, false, props);
|
||||
// A waterfall loop's load at the first lane's offset reads
|
||||
// each lane's own entry (see `resource::Waterfall`).
|
||||
let per_lane = self.x.res.waterfall.loads.contains(load);
|
||||
let h = self
|
||||
.s
|
||||
.heap_handle(self.cur, index, sampler, per_lane, props);
|
||||
self.handles.insert(key, h);
|
||||
Ok(h)
|
||||
}
|
||||
@@ -7071,12 +7076,12 @@ mod tests {
|
||||
0xBE83_0380, // s_mov_b32 s3, 0
|
||||
S_ENDPGM,
|
||||
];
|
||||
|
||||
for words in [add, sub] {
|
||||
lowers(&words, 0).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn perm_features(selector: u32) -> u64 {
|
||||
// Synthetic compute shader:
|
||||
// v0 is the thread ID and can supply a dynamic selector.
|
||||
|
||||
@@ -220,6 +220,19 @@ fn lanes_load_from_the_buffer_their_nested_arms_chose() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lanes_sample_the_entry_their_offset_names_in_the_console_waterfall() {
|
||||
use crate::resource::tests::WATERFALL_INDEXED_WAVE32;
|
||||
let shader = build(WATERFALL_INDEXED_WAVE32, false);
|
||||
let results = sampled(&shader);
|
||||
assert!(!results.is_empty());
|
||||
for (label, red) in results {
|
||||
// Even lanes hold entry 0's offset, odd lanes entry 1's.
|
||||
let want: Vec<f32> = (0..32).map(|l| [1.0, 2.0][l & 1]).collect();
|
||||
assert_eq!(red, want, "{label}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lanes_sample_their_own_texture_in_a_waterfall_narrowed_by_v_cmpx() {
|
||||
use crate::resource::tests::cmpx_waterfall;
|
||||
|
||||
Reference in new issue
Block a user