mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 11:00:11 +01:00
nak: Put the cycle count assert behind a debug flag
Fixes: c1d64053f2 ("nak: Assert instr_sched matches calc_instr_deps")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33573>
This commit is contained in:
parent
7a55a9afcc
commit
348f345238
2 changed files with 16 additions and 5 deletions
|
|
@ -25,6 +25,7 @@ enum DebugFlags {
|
|||
Spill,
|
||||
Annotate,
|
||||
NoUgpr,
|
||||
Cycles,
|
||||
}
|
||||
|
||||
pub struct Debug {
|
||||
|
|
@ -49,6 +50,7 @@ impl Debug {
|
|||
"spill" => flags |= 1 << DebugFlags::Spill as u8,
|
||||
"annotate" => flags |= 1 << DebugFlags::Annotate as u8,
|
||||
"nougpr" => flags |= 1 << DebugFlags::NoUgpr as u8,
|
||||
"cycles" => flags |= 1 << DebugFlags::Cycles as u8,
|
||||
unk => eprintln!("Unknown NAK_DEBUG flag \"{}\"", unk),
|
||||
}
|
||||
}
|
||||
|
|
@ -78,6 +80,10 @@ pub trait GetDebugFlags {
|
|||
fn no_ugpr(&self) -> bool {
|
||||
self.debug_flags() & (1 << DebugFlags::NoUgpr as u8) != 0
|
||||
}
|
||||
|
||||
fn cycles(&self) -> bool {
|
||||
self.debug_flags() & (1 << DebugFlags::Cycles as u8) != 0
|
||||
}
|
||||
}
|
||||
|
||||
pub static DEBUG: OnceLock<Debug> = OnceLock::new();
|
||||
|
|
|
|||
|
|
@ -512,11 +512,16 @@ impl Shader<'_> {
|
|||
min_num_static_cycles += calc_delays(f, self.sm);
|
||||
}
|
||||
|
||||
// Check that this file's model matches up with the model in
|
||||
// opt_instr_sched_postpass. postpass includes an estimate of
|
||||
// variable latency delays in its count, so we expect it to be >=
|
||||
// the estimate here
|
||||
assert!(self.info.num_static_cycles >= min_num_static_cycles);
|
||||
if DEBUG.cycles() {
|
||||
// This is useful for debugging differences in the scheduler
|
||||
// cycle count model and the calc_delays() model. However, it
|
||||
// isn't totally valid since assign_barriers() can add extra
|
||||
// dependencies for barrier re-use and those may add cycles.
|
||||
// The chances of it doing this are low, thanks to our LRU
|
||||
// allocation strategy, but it's still not an assert we want
|
||||
// running in production.
|
||||
assert!(self.info.num_static_cycles >= min_num_static_cycles);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue