nak/sm50: add an annotate debug flag

Add a flag so that users can enable debug annotations when printing the IR.
This does nothing for now. A follow-up commit will actually implement
annotations.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27158>
This commit is contained in:
Daniel Almeida
2024-01-15 13:32:21 -03:00
committed by Marge Bot
parent 02774be708
commit a69bd9a70a
+6
View File
@@ -19,6 +19,7 @@ enum DebugFlags {
Print,
Serial,
Spill,
Annotate,
}
pub struct Debug {
@@ -41,6 +42,7 @@ impl Debug {
"print" => flags |= 1 << DebugFlags::Print as u8,
"serial" => flags |= 1 << DebugFlags::Serial as u8,
"spill" => flags |= 1 << DebugFlags::Spill as u8,
"annotate" => flags |= 1 << DebugFlags::Annotate as u8,
unk => eprintln!("Unknown NAK_DEBUG flag \"{}\"", unk),
}
}
@@ -62,6 +64,10 @@ pub trait GetDebugFlags {
fn spill(&self) -> bool {
self.debug_flags() & (1 << DebugFlags::Spill as u8) != 0
}
fn annotate(&self) -> bool {
self.debug_flags() & (1 << DebugFlags::Annotate as u8) != 0
}
}
pub static DEBUG: OnceLock<Debug> = OnceLock::new();