nak: add reads after setting writes

Otherwise we schedule this sort of thing wrong,
 r0    = iadd3 r0 c[0x0][0x0] rZ
 r0    = shf.l.w.i32 r0 rZ 0x2
 r0 p0 = iadd3 r0 c[0x1][0x0] rZ

since raw latencies are more important than waw, but we go do a
waw for the first two instructions instead of a raw which is correct.

Fixes: 2d4e445099 ("nak/calc_instr_deps: Rewrite calc_delays() again")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33573>
This commit is contained in:
Dave Airlie
2025-02-24 16:29:37 +10:00
committed by Marge Bot
parent afa254ad68
commit 7a55a9afcc
+6 -3
View File
@@ -427,15 +427,18 @@ fn calc_delays(f: &mut Function, sm: &dyn ShaderModel) -> u32 {
instr.deps.set_delay(delay);
instr_cycle[ip] = min_start;
// Set the writes before adding the reads
// as we are iterating backwards through instructions.
uses.for_each_instr_dst_mut(instr, |i, c| {
c.set_write((ip, i));
});
uses.for_each_instr_pred_mut(instr, |c| {
c.add_read((ip, usize::MAX));
});
uses.for_each_instr_src_mut(instr, |i, c| {
c.add_read((ip, i));
});
uses.for_each_instr_dst_mut(instr, |i, c| {
c.set_write((ip, i));
});
for (bar, c) in bars.iter_mut().enumerate() {
if instr.deps.wt_bar_mask & (1 << bar) != 0 {
*c = min_start;