nak: Move exec_latency into the per-SM files

It's split cleanly along the SM70 boundary anyway so there's no code
duplication happening here.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34302>
This commit is contained in:
Faith Ekstrand 2025-03-31 12:50:56 -05:00 committed by Marge Bot
parent ae842b5fe1
commit 64ff3e8cb8
4 changed files with 38 additions and 40 deletions

View file

@ -7505,9 +7505,7 @@ pub trait ShaderModel {
!op.has_fixed_latency(self.sm())
}
fn exec_latency(&self, op: &Op) -> u32 {
sched_common::exec_latency(self.sm(), op)
}
fn exec_latency(&self, op: &Op) -> u32;
fn raw_latency(
&self,

View file

@ -5,43 +5,6 @@ use crate::ir::*;
use std::ops::{Index, IndexMut, Range};
pub fn exec_latency(sm: u8, op: &Op) -> u32 {
if sm >= 70 {
match op {
Op::Bar(_) | Op::MemBar(_) => {
if sm >= 80 {
6
} else {
5
}
}
Op::CCtl(_op) => {
// CCTL.C needs 8, CCTL.I needs 11
11
}
// Op::DepBar(_) => 4,
_ => 1, // TODO: co-issue
}
} else {
match op {
Op::CCtl(_)
| Op::MemBar(_)
| Op::Bra(_)
| Op::SSy(_)
| Op::Sync(_)
| Op::Brk(_)
| Op::PBk(_)
| Op::Cont(_)
| Op::PCnt(_)
| Op::Exit(_)
| Op::Bar(_)
| Op::Kill(_)
| Op::OutFinal(_) => 13,
_ => 1,
}
}
}
pub fn instr_latency(sm: u8, op: &Op, dst_idx: usize) -> u32 {
let file = match op.dsts_as_slice()[dst_idx] {
Dst::None => return 0,

View file

@ -56,6 +56,25 @@ impl ShaderModel for ShaderModel50 {
false
}
fn exec_latency(&self, op: &Op) -> u32 {
match op {
Op::CCtl(_)
| Op::MemBar(_)
| Op::Bra(_)
| Op::SSy(_)
| Op::Sync(_)
| Op::Brk(_)
| Op::PBk(_)
| Op::Cont(_)
| Op::PCnt(_)
| Op::Exit(_)
| Op::Bar(_)
| Op::Kill(_)
| Op::OutFinal(_) => 13,
_ => 1,
}
}
fn legalize_op(&self, b: &mut LegalizeBuilder, op: &mut Op) {
as_sm50_op_mut(op).legalize(b);
}

View file

@ -99,6 +99,24 @@ impl ShaderModel for ShaderModel70 {
}
}
fn exec_latency(&self, op: &Op) -> u32 {
match op {
Op::Bar(_) | Op::MemBar(_) => {
if self.sm >= 80 {
6
} else {
5
}
}
Op::CCtl(_op) => {
// CCTL.C needs 8, CCTL.I needs 11
11
}
// Op::DepBar(_) => 4,
_ => 1, // TODO: co-issue
}
}
fn legalize_op(&self, b: &mut LegalizeBuilder, op: &mut Op) {
legalize_sm70_op(self, b, op);
}