Shader forms: lives of a spill lane, one lane of what a whole-wave section leaves

Water transmission volumes and the rest of the upscaler translate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-24 22:17:48 -06:00
1 parent 389db9efb2
commit e5841a0553
4 files changed
+344 -77

No files matched your search

+52
View File
@@ -2647,6 +2647,58 @@ pub(crate) mod tests {
}
}
/// Two lanes hold a pair (a lane mask, say) and later one of them a
/// scalar, as in a water volume program that parks more than the lanes
/// of one VGPR hold: the pair still moves as one.
#[test]
fn a_lane_spilled_to_again_later_does_not_split_an_earlier_pair() {
let pair = [
0xD761_0000u32,
0x0001_0004, // v_writelane_b32 v0, s4, 0
0xD761_0000,
0x0001_0205, // v_writelane_b32 v0, s5, 1
0xBE84_0380, // s_mov_b32 s4, 0
0xBE85_0380, // s_mov_b32 s5, 0
0xD760_0004,
0x0001_0100, // v_readlane_b32 s4, v0, 0
0xD760_0005,
0x0001_0300, // v_readlane_b32 s5, v0, 1
];
let scalar = [
0xD761_0000u32,
0x0001_0006, // v_writelane_b32 v0, s6, 0
0xBE86_0380, // s_mov_b32 s6, 0
0xD760_0006,
0x0001_0100, // v_readlane_b32 s6, v0, 0
S_ENDPGM,
];
let moves = |words: &[u32]| {
let code: Vec<u8> = words.iter().flat_map(|w| w.to_le_bytes()).collect();
let p = crate::ir::build(&code, true, 8).unwrap();
let names: Vec<_> = p.blocks[0].insts.iter().map(|i| i.name()).collect();
assert!(!names.iter().any(|n| n.contains("lane")));
names.iter().filter(|n| **n == "s_mov_b64").count()
};
assert_eq!(moves(&[&pair[..], &scalar].concat()), 2);
// A restore both saves reach keeps the lane one scalar.
let joined = [
&pair[..4],
&[0xBF84_0002], // s_cbranch_scc0 past the second save
&scalar[..2],
&pair[4..],
&scalar[2..],
]
.concat();
assert_eq!(moves_anywhere(&joined), 0);
}
fn moves_anywhere(words: &[u32]) -> usize {
let code: Vec<u8> = words.iter().flat_map(|w| w.to_le_bytes()).collect();
let p = crate::ir::build(&code, true, 8).unwrap();
let insts = p.blocks.iter().flat_map(|b| &b.insts);
insts.filter(|i| i.name() == "s_mov_b64").count()
}
#[test]
fn descriptors_joined_by_control_flow_are_traced_per_edge() {
let r = track_words(