nak: Copy-prop bindless cbuf handles

Totals:
CodeSize: 4503463376 -> 4502059168 (-0.03%); split: -0.03%, +0.00%
Number of GPRs: 11377380 -> 11377668 (+0.00%); split: -0.00%, +0.00%
Static cycle count: 2871017064 -> 2870884663 (-0.00%); split: -0.01%, +0.00%
Spills to reg: 210798 -> 210728 (-0.03%)
Fills from reg: 200514 -> 200489 (-0.01%)
Max warps/SM: 7361864 -> 7361904 (+0.00%)

Totals from 28087 (14.27% of 196789) affected shaders:
CodeSize: 870417856 -> 869013648 (-0.16%); split: -0.17%, +0.01%
Number of GPRs: 2273399 -> 2273687 (+0.01%); split: -0.00%, +0.02%
Static cycle count: 780733864 -> 780601463 (-0.02%); split: -0.04%, +0.02%
Spills to reg: 135380 -> 135310 (-0.05%)
Fills from reg: 131832 -> 131807 (-0.02%)
Max warps/SM: 891108 -> 891148 (+0.00%)

Reviewed-by: Mary Guillemard <mary@mary.zone>
Reviewed-by: Lorenzo Rossi <git@rossilorenzo.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39122>
This commit is contained in:
Mel Henning 2026-01-01 18:43:50 -05:00 committed by Marge Bot
parent e92ab5db56
commit 9ff8ee49f4

View file

@ -190,7 +190,11 @@ impl<'a> CopyPropPass<'a> {
}
}
fn prop_to_ssa_values(&self, src_ssa: &mut [SSAValue]) -> bool {
fn prop_to_ssa_values(
&self,
src_ssa: &mut [SSAValue],
same_file: bool,
) -> bool {
let mut progress = false;
for c_ssa in src_ssa {
@ -201,6 +205,11 @@ impl<'a> CopyPropPass<'a> {
if entry.src.is_unmodified() {
if let SrcRef::SSA(entry_ssa) = &entry.src.src_ref {
assert!(entry_ssa.comps() == 1);
if same_file && (c_ssa.file() != entry_ssa[0].file()) {
continue;
}
*c_ssa = entry_ssa[0];
progress = true;
}
@ -211,7 +220,18 @@ impl<'a> CopyPropPass<'a> {
}
fn prop_to_ssa_ref(&self, src_ssa: &mut SSARef) -> bool {
self.prop_to_ssa_values(&mut src_ssa[..])
self.prop_to_ssa_values(&mut src_ssa[..], false)
}
fn prop_to_cbuf_ref(&self, cbuf: &mut CBufRef) {
match cbuf.buf {
CBuf::BindlessSSA(ref mut ssa_values) => loop {
if !self.prop_to_ssa_values(&mut ssa_values[..], true) {
break;
}
},
_ => (),
}
}
fn prop_to_ssa_src(&self, src: &mut Src) {
@ -489,6 +509,13 @@ impl<'a> CopyPropPass<'a> {
}
SrcType::Carry | SrcType::Bar => (),
}
match &mut src.src_ref {
SrcRef::CBuf(cbuf) => {
self.prop_to_cbuf_ref(cbuf);
}
_ => (),
}
}
fn try_add_instr(&mut self, bi: usize, instr: &Instr) {