mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
nak: Replace OpBMov with OpBClear
This is all we're using it for right now and an op that simply clears has far more obvious semantics than something which reads from and then clears its source. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26463>
This commit is contained in:
parent
3348446422
commit
45686ec0ba
4 changed files with 18 additions and 92 deletions
|
|
@ -1664,32 +1664,13 @@ impl SM70Instr {
|
|||
self.set_field(range, rel_offset);
|
||||
}
|
||||
|
||||
fn encode_bmov(&mut self, op: &OpBMov) {
|
||||
fn encode_bclear(&mut self, op: &OpBClear) {
|
||||
self.set_opcode(0x355);
|
||||
self.set_dst(op.dst);
|
||||
|
||||
let src = match op.src {
|
||||
BMovSrc::Barrier(bar) => bar.idx(),
|
||||
BMovSrc::TreadStateEnum0 => 0x10,
|
||||
BMovSrc::TreadStateEnum1 => 0x11,
|
||||
BMovSrc::TreadStateEnum2 => 0x12,
|
||||
BMovSrc::TreadStateEnum3 => 0x13,
|
||||
BMovSrc::TreadStateEnum4 => 0x14,
|
||||
BMovSrc::TrapReturnPCLo => 0x15,
|
||||
BMovSrc::TrapReturnPCHi => 0x16,
|
||||
BMovSrc::TrapReturnMask => 0x17,
|
||||
BMovSrc::MExited => 0x18,
|
||||
BMovSrc::MKill => 0x19,
|
||||
BMovSrc::MActive => 0x1a,
|
||||
BMovSrc::MAtExit => 0x1b,
|
||||
BMovSrc::OptStack => 0x1c,
|
||||
BMovSrc::APICallDepth => 0x1d,
|
||||
BMovSrc::AtExitPCLo => 0x1e,
|
||||
BMovSrc::AtExitPCHi => 0x1f,
|
||||
};
|
||||
self.set_field(24..29, src);
|
||||
self.set_dst(Dst::None);
|
||||
self.set_field(24..28, op.dst.idx());
|
||||
|
||||
self.set_bit(84, op.clear);
|
||||
self.set_bit(84, true); // .CLEAR
|
||||
}
|
||||
|
||||
fn encode_break(&mut self, op: &OpBreak) {
|
||||
|
|
@ -1927,7 +1908,7 @@ impl SM70Instr {
|
|||
Op::LdTram(op) => si.encode_ldtram(&op),
|
||||
Op::CCtl(op) => si.encode_cctl(&op),
|
||||
Op::MemBar(op) => si.encode_membar(&op),
|
||||
Op::BMov(op) => si.encode_bmov(&op),
|
||||
Op::BClear(op) => si.encode_bclear(&op),
|
||||
Op::Break(op) => si.encode_break(&op),
|
||||
Op::BSSy(op) => si.encode_bssy(&op, ip, labels),
|
||||
Op::BSync(op) => si.encode_bsync(&op),
|
||||
|
|
|
|||
|
|
@ -1627,10 +1627,8 @@ impl<'a> ShaderFromNir<'a> {
|
|||
let label = self.label_alloc.alloc();
|
||||
let bar = self.bar_alloc.alloc();
|
||||
|
||||
let bmov = b.push_op(OpBMov {
|
||||
dst: Dst::None,
|
||||
src: BMovSrc::Barrier(bar),
|
||||
clear: true,
|
||||
let bmov = b.push_op(OpBClear {
|
||||
dst: bar,
|
||||
});
|
||||
bmov.deps.yld = true;
|
||||
|
||||
|
|
@ -2542,10 +2540,8 @@ impl<'a> ShaderFromNir<'a> {
|
|||
let label = self.label_alloc.alloc();
|
||||
let bar = self.bar_alloc.alloc();
|
||||
|
||||
let bmov = b.push_op(OpBMov {
|
||||
dst: Dst::None,
|
||||
src: BMovSrc::Barrier(bar),
|
||||
clear: true,
|
||||
let bmov = b.push_op(OpBClear {
|
||||
dst: bar,
|
||||
});
|
||||
bmov.deps.yld = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -3601,69 +3601,18 @@ impl DisplayOp for OpMemBar {
|
|||
}
|
||||
impl_display_for_op!(OpMemBar);
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub enum BMovSrc {
|
||||
Barrier(BarRef),
|
||||
TreadStateEnum0,
|
||||
TreadStateEnum1,
|
||||
TreadStateEnum2,
|
||||
TreadStateEnum3,
|
||||
TreadStateEnum4,
|
||||
TrapReturnPCLo,
|
||||
TrapReturnPCHi,
|
||||
TrapReturnMask,
|
||||
MExited,
|
||||
MKill,
|
||||
MActive,
|
||||
MAtExit,
|
||||
OptStack,
|
||||
APICallDepth,
|
||||
AtExitPCLo,
|
||||
AtExitPCHi,
|
||||
}
|
||||
|
||||
impl fmt::Display for BMovSrc {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
BMovSrc::Barrier(bar) => bar.fmt(f),
|
||||
BMovSrc::TreadStateEnum0 => write!(f, "THREAD_STATE_ENUM.0"),
|
||||
BMovSrc::TreadStateEnum1 => write!(f, "THREAD_STATE_ENUM.1"),
|
||||
BMovSrc::TreadStateEnum2 => write!(f, "THREAD_STATE_ENUM.2"),
|
||||
BMovSrc::TreadStateEnum3 => write!(f, "THREAD_STATE_ENUM.3"),
|
||||
BMovSrc::TreadStateEnum4 => write!(f, "THREAD_STATE_ENUM.4"),
|
||||
BMovSrc::TrapReturnPCLo => write!(f, "TRAP_RETURN_PC.LO"),
|
||||
BMovSrc::TrapReturnPCHi => write!(f, "TRAP_RETURN_PC.HI"),
|
||||
BMovSrc::TrapReturnMask => write!(f, "TRAP_RETURN_MASK"),
|
||||
BMovSrc::MExited => write!(f, "MEXITED"),
|
||||
BMovSrc::MKill => write!(f, "MKILL"),
|
||||
BMovSrc::MActive => write!(f, "MACTIVE"),
|
||||
BMovSrc::MAtExit => write!(f, "MATEXIT"),
|
||||
BMovSrc::OptStack => write!(f, "OPT_STACK"),
|
||||
BMovSrc::APICallDepth => write!(f, "API_CALL_DEPTH"),
|
||||
BMovSrc::AtExitPCLo => write!(f, "ATEXIT_PC.LO"),
|
||||
BMovSrc::AtExitPCHi => write!(f, "ATEXIT_PC.HI"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(SrcsAsSlice, DstsAsSlice)]
|
||||
pub struct OpBMov {
|
||||
pub dst: Dst,
|
||||
pub src: BMovSrc,
|
||||
pub clear: bool,
|
||||
pub struct OpBClear {
|
||||
pub dst: BarRef,
|
||||
}
|
||||
|
||||
impl DisplayOp for OpBMov {
|
||||
impl DisplayOp for OpBClear {
|
||||
fn fmt_op(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "bmov.32")?;
|
||||
if self.clear {
|
||||
write!(f, ".clear")?;
|
||||
}
|
||||
write!(f, " {} {}", self.dst, self.src)
|
||||
write!(f, "bclear")
|
||||
}
|
||||
}
|
||||
impl_display_for_op!(OpBMov);
|
||||
impl_display_for_op!(OpBClear);
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(SrcsAsSlice, DstsAsSlice)]
|
||||
|
|
@ -4347,7 +4296,7 @@ pub enum Op {
|
|||
LdTram(OpLdTram),
|
||||
CCtl(OpCCtl),
|
||||
MemBar(OpMemBar),
|
||||
BMov(OpBMov),
|
||||
BClear(OpBClear),
|
||||
Break(OpBreak),
|
||||
BSSy(OpBSSy),
|
||||
BSync(OpBSync),
|
||||
|
|
@ -4706,6 +4655,7 @@ impl Instr {
|
|||
| Op::MemBar(_)
|
||||
| Op::Kill(_)
|
||||
| Op::Nop(_)
|
||||
| Op::BClear(_)
|
||||
| Op::Break(_)
|
||||
| Op::BSSy(_)
|
||||
| Op::BSync(_)
|
||||
|
|
@ -4716,7 +4666,6 @@ impl Instr {
|
|||
| Op::FSOut(_)
|
||||
| Op::Out(_)
|
||||
| Op::OutFinal(_) => false,
|
||||
Op::BMov(op) => !op.clear,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
|
@ -4786,7 +4735,7 @@ impl Instr {
|
|||
| Op::MemBar(_) => false,
|
||||
|
||||
// Control-flow ops
|
||||
Op::BMov(_) | Op::Break(_) | Op::BSSy(_) | Op::BSync(_) => false,
|
||||
Op::BClear(_) | Op::Break(_) | Op::BSSy(_) | Op::BSync(_) => false,
|
||||
Op::Bra(_) | Op::Exit(_) => true,
|
||||
Op::WarpSync(_) => false,
|
||||
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ fn legalize_instr(b: &mut impl SSABuilder, instr: &mut Instr) {
|
|||
copy_src_if_not_reg(b, &mut op.handle, RegFile::GPR);
|
||||
}
|
||||
Op::Ldc(_) => (), // Nothing to do
|
||||
Op::BMov(_) | Op::Break(_) | Op::BSSy(_) | Op::BSync(_) => (),
|
||||
Op::Break(_) | Op::BSSy(_) | Op::BSync(_) => (),
|
||||
Op::Vote(_) => (), // Nothing to do
|
||||
Op::Copy(_) => (), // Nothing to do
|
||||
_ => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue