From 38d22121946094db21e97c5dae208d588cfc303c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 31 Mar 2025 14:14:00 -0500 Subject: [PATCH] nak: Add an a_has_pred parameter to waw_latency This affects the HMMA units, among others. Reviewed-by: Faith Ekstrand Part-of: --- src/nouveau/compiler/nak/calc_instr_deps.rs | 1 + src/nouveau/compiler/nak/ir.rs | 1 + src/nouveau/compiler/nak/opt_instr_sched_postpass.rs | 9 +++++++-- src/nouveau/compiler/nak/sm50.rs | 1 + src/nouveau/compiler/nak/sm70.rs | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/nouveau/compiler/nak/calc_instr_deps.rs b/src/nouveau/compiler/nak/calc_instr_deps.rs index 86ccd01d682..cc684cfefbf 100644 --- a/src/nouveau/compiler/nak/calc_instr_deps.rs +++ b/src/nouveau/compiler/nak/calc_instr_deps.rs @@ -380,6 +380,7 @@ fn calc_delays(f: &mut Function, sm: &dyn ShaderModel) -> u32 { + sm.waw_latency( &instr.op, i, + !instr.pred.pred_ref.is_none(), &b.instrs[*w_ip].op, *w_dst_idx, ); diff --git a/src/nouveau/compiler/nak/ir.rs b/src/nouveau/compiler/nak/ir.rs index a730387fff1..cb21c8bb453 100644 --- a/src/nouveau/compiler/nak/ir.rs +++ b/src/nouveau/compiler/nak/ir.rs @@ -7613,6 +7613,7 @@ pub trait ShaderModel { &self, a: &Op, a_dst_idx: usize, + a_has_pred: bool, b: &Op, b_dst_idx: usize, ) -> u32; diff --git a/src/nouveau/compiler/nak/opt_instr_sched_postpass.rs b/src/nouveau/compiler/nak/opt_instr_sched_postpass.rs index 475d83edad9..90054b91ade 100644 --- a/src/nouveau/compiler/nak/opt_instr_sched_postpass.rs +++ b/src/nouveau/compiler/nak/opt_instr_sched_postpass.rs @@ -71,8 +71,13 @@ fn generate_dep_graph( uses.for_each_instr_dst_mut(instr, |i, u| { if let Some((w_ip, w_dst_idx)) = u.write { - let latency = - sm.waw_latency(&instr.op, i, &instrs[w_ip].op, w_dst_idx); + let latency = sm.waw_latency( + &instr.op, + i, + !instr.pred.pred_ref.is_none(), + &instrs[w_ip].op, + w_dst_idx, + ); g.add_edge(ip, w_ip, EdgeLabel { latency }); } diff --git a/src/nouveau/compiler/nak/sm50.rs b/src/nouveau/compiler/nak/sm50.rs index 676278817cd..528e1aed0b6 100644 --- a/src/nouveau/compiler/nak/sm50.rs +++ b/src/nouveau/compiler/nak/sm50.rs @@ -138,6 +138,7 @@ impl ShaderModel for ShaderModel50 { &self, a: &Op, a_dst_idx: usize, + _a_has_pred: bool, _b: &Op, _b_dst_idx: usize, ) -> u32 { diff --git a/src/nouveau/compiler/nak/sm70.rs b/src/nouveau/compiler/nak/sm70.rs index 2d6d7491d84..3da28c657c5 100644 --- a/src/nouveau/compiler/nak/sm70.rs +++ b/src/nouveau/compiler/nak/sm70.rs @@ -188,6 +188,7 @@ impl ShaderModel for ShaderModel70 { &self, a: &Op, a_dst_idx: usize, + _a_has_pred: bool, _b: &Op, _b_dst_idx: usize, ) -> u32 {