mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 07:20:10 +01:00
nak: Set variable_latency=0 for !needs_scoreboard
This simplifies usage of estimate_variable_latency a little in that we can just use it directly in our max() expressions instead of guarding it with an if. Reviewed-by: Mary Guillemard <mary@mary.zone> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38939>
This commit is contained in:
parent
b4bac84d3b
commit
01cf905c71
2 changed files with 15 additions and 13 deletions
|
|
@ -253,7 +253,11 @@ pub fn estimate_block_weight(cfg: &CFG<BasicBlock>, block_idx: usize) -> u64 {
|
|||
/// Memory instructions were copied from L1 data cache latencies.
|
||||
/// For instructions not mentioned in the paper, I made up numbers.
|
||||
/// This could probably be improved.
|
||||
pub fn estimate_variable_latency(sm: u8, op: &Op) -> u32 {
|
||||
pub fn estimate_variable_latency(sm: &dyn ShaderModel, op: &Op) -> u32 {
|
||||
if !sm.op_needs_scoreboard(op) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
match op {
|
||||
// Multi-function unit
|
||||
Op::Rro(_) | Op::MuFu(_) => 15,
|
||||
|
|
@ -265,7 +269,7 @@ pub fn estimate_variable_latency(sm: u8, op: &Op) -> u32 {
|
|||
// Integer ALU
|
||||
Op::BRev(_) | Op::Flo(_) | Op::PopC(_) => 15,
|
||||
Op::IMad(_) | Op::IMul(_) => {
|
||||
assert!(sm < 70);
|
||||
assert!(sm.sm() < 70);
|
||||
86
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,12 +89,10 @@ fn generate_dep_graph(sm: &dyn ShaderModel, instrs: &[Instr]) -> DepGraph {
|
|||
} else {
|
||||
sm.raw_latency(&instr.op, i, &instrs[r_ip].op, r_src_idx)
|
||||
};
|
||||
if sm.op_needs_scoreboard(&instr.op) {
|
||||
latency = max(
|
||||
latency,
|
||||
estimate_variable_latency(sm.sm(), &instr.op),
|
||||
);
|
||||
}
|
||||
|
||||
latency =
|
||||
max(latency, estimate_variable_latency(sm, &instr.op));
|
||||
|
||||
g.add_edge(ip, r_ip, EdgeLabel { latency });
|
||||
}
|
||||
});
|
||||
|
|
@ -126,11 +124,11 @@ fn generate_dep_graph(sm: &dyn ShaderModel, instrs: &[Instr]) -> DepGraph {
|
|||
.map(|i| sm.worst_latency(&instr.op, i))
|
||||
.max()
|
||||
.unwrap_or(0);
|
||||
if sm.op_needs_scoreboard(&instr.op) {
|
||||
let var_latency = estimate_variable_latency(sm.sm(), &instr.op)
|
||||
+ sm.exec_latency(&instrs[instrs.len() - 1].op);
|
||||
ready_cycle = max(ready_cycle, var_latency);
|
||||
}
|
||||
|
||||
let var_latency = estimate_variable_latency(sm, &instr.op)
|
||||
+ sm.exec_latency(&instrs[instrs.len() - 1].op);
|
||||
ready_cycle = max(ready_cycle, var_latency);
|
||||
|
||||
let label = &mut g.nodes[ip].label;
|
||||
label.exec_latency = sm.exec_latency(&instr.op);
|
||||
label.ready_cycle = ready_cycle;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue