nak: Use the RED path for atomics with unused destinations

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30354>
This commit is contained in:
Faith Ekstrand
2024-07-23 15:34:06 -05:00
committed by Marge Bot
parent c347c7cbd8
commit 71639eb837
2 changed files with 28 additions and 2 deletions
+12 -2
View File
@@ -2160,8 +2160,15 @@ impl<'a> ShaderFromNir<'a> {
self.get_src(&srcs[3])
};
let is_reduction =
atom_op.is_reduction() && intrin.def.components_read() == 0;
b.push_op(OpSuAtom {
dst: dst.into(),
dst: if self.sm.sm() >= 70 && is_reduction {
Dst::None
} else {
dst.into()
},
fault: Dst::None,
handle: handle,
coord: coord,
@@ -2329,8 +2336,11 @@ impl<'a> ShaderFromNir<'a> {
assert!(intrin.def.num_components() == 1);
let dst = b.alloc_ssa(RegFile::GPR, bit_size.div_ceil(32));
let is_reduction =
atom_op.is_reduction() && intrin.def.components_read() == 0;
b.push_op(OpAtom {
dst: dst.into(),
dst: if is_reduction { Dst::None } else { dst.into() },
addr: addr,
cmpr: 0.into(),
data: data,
+16
View File
@@ -2410,6 +2410,22 @@ pub enum AtomOp {
CmpExch(AtomCmpSrc),
}
impl AtomOp {
pub fn is_reduction(&self) -> bool {
match self {
AtomOp::Add
| AtomOp::Min
| AtomOp::Max
| AtomOp::Inc
| AtomOp::Dec
| AtomOp::And
| AtomOp::Or
| AtomOp::Xor => true,
AtomOp::Exch | AtomOp::CmpExch(_) => false,
}
}
}
impl fmt::Display for AtomOp {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {