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 5686c41b47
commit be91db47a5
4 files changed
+344 -77

No files matched your search

+36 -1
View File
@@ -2762,6 +2762,18 @@ impl<'a> Lower<'a> {
self.s.m.extract(entry, r, index % 4)
}
/// Whether some instruction reads `v` as a number (or may, through a
/// join), rather than in a descriptor operand.
fn read_as_number(&self, v: Value) -> bool {
self.x.p.blocks.iter().any(|b| {
b.phis.iter().any(|p| p.args.contains(&v))
|| b.insts.iter().any(|i| {
matches!(i.fields, Fields::Sop { .. } | Fields::Valu(_))
&& i.reads.iter().any(|r| r.1 == v)
})
})
}
/// Whether some instruction computes with `v` (scalar or vector
/// arithmetic), rather than only naming it in a descriptor operand,
/// moving it (at most `depth` moves are followed) or comparing it: a
@@ -5983,11 +5995,23 @@ impl<'a> Lower<'a> {
};
((kind | u, 0x409), Some(kind))
}
Fields::Buffer { .. } => {
Fields::Buffer { idxen, format, .. } => {
let stride = used.map_or(0, |u| u.stride);
let counted = inst
.write(Reg::S(code + first + 2))
.is_some_and(|v| self.read_as_number(v));
let props = if un.starts_with("buffer_load_format")
|| un.starts_with("buffer_store_format")
{
(10 | u, 0x409)
} else if !counted
&& *idxen
&& format.is_none()
&& stride >= 4
&& stride.is_multiple_of(4)
{
// Nothing reads the count: the query is cleaned up.
(12 | u, stride)
} else {
// Structured ones too: the host's views of them are raw
// (see `buffer`), which count bytes, and a size asked
@@ -6859,6 +6883,17 @@ impl<'a> Lower<'a> {
self.lane(inst, Some(true));
return Ok(());
}
// One lane of a VGPR a whole-wave section left.
if name == "v_readlane_b32"
&& let Some(&(_, w)) = inst.writes.first()
&& let Some(sh) = self.sections.get(&b).and_then(|s| {
s.iter().filter(|s| s.1.end < i).find_map(|s| s.1.reads.get(&w).copied())
})
{
let x = self.shape(sh, false)?;
self.vals.insert(w, Val::I32(x));
return Ok(());
}
if let Some(rest) = name.strip_prefix("v_cmp_").or(name.strip_prefix("v_cmpx_")) {
let r = if v.dpp.is_some() {
Err("a compare with DPP")