nak: Make BindlessSSA store [SSAValue; 2]
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

This reduces the size of ir::Src from 40 bytes down to 32 bytes. This
makes the size of ir::Op fall from 272 bytes down to 232 bytes, meaning
we save 40 bytes per instruction.

Reviewed-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37130>
This commit is contained in:
Mel Henning 2025-09-01 20:11:17 -04:00 committed by Marge Bot
parent 8ac9b077b1
commit a9ea4630d4
3 changed files with 6 additions and 6 deletions

View file

@ -3343,7 +3343,7 @@ impl<'a> ShaderFromNir<'a> {
let (off, off_imm) = self.get_cbuf_addr_offset(&srcs[1]);
let cb = CBufRef {
buf: CBuf::BindlessSSA(handle),
buf: CBuf::BindlessSSA(handle[..].try_into().unwrap()),
offset: off_imm,
};

View file

@ -535,7 +535,7 @@ pub enum CBuf {
Binding(u8),
#[allow(dead_code)]
BindlessSSA(SSARef),
BindlessSSA([SSAValue; 2]),
#[allow(dead_code)]
BindlessUGPR(RegRef),
@ -545,7 +545,7 @@ impl fmt::Display for CBuf {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CBuf::Binding(idx) => write!(f, "c[{:#x}]", idx),
CBuf::BindlessSSA(v) => write!(f, "cx[{}]", v),
CBuf::BindlessSSA(v) => write!(f, "cx[{{{}, {}}}]", v[0], v[1]),
CBuf::BindlessUGPR(r) => write!(f, "cx[{}]", r),
}
}
@ -683,7 +683,7 @@ impl SrcRef {
| SrcRef::Reg(_) => &[],
SrcRef::CBuf(cb) => match &cb.buf {
CBuf::Binding(_) | CBuf::BindlessUGPR(_) => &[],
CBuf::BindlessSSA(ssa) => ssa.deref(),
CBuf::BindlessSSA(ssa) => &ssa[..],
},
SrcRef::SSA(ssa) => ssa.deref(),
}
@ -699,7 +699,7 @@ impl SrcRef {
| SrcRef::Reg(_) => &mut [],
SrcRef::CBuf(cb) => match &mut cb.buf {
CBuf::Binding(_) | CBuf::BindlessUGPR(_) => &mut [],
CBuf::BindlessSSA(ssa) => ssa.deref_mut(),
CBuf::BindlessSSA(ssa) => &mut ssa[..],
},
SrcRef::SSA(ssa) => ssa.deref_mut(),
}

View file

@ -452,7 +452,7 @@ fn legalize_instr(
SrcRef::CBuf(CBufRef {
buf: CBuf::BindlessSSA(handle),
..
}) => assert!(pinned.contains(handle)),
}) => assert!(pinned.contains(&SSARef::new(handle))),
_ => (),
}
}