Module: Mesa
Branch: main
Commit: 786bf749bcab807bf743c2e1ad1477ea116620d3
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=786bf749bcab807bf743c2e1ad1477ea116620d3

Author: M Henning <[email protected]>
Date:   Sat Dec  2 18:05:21 2023 -0500

nak: Print out an instruction count

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26473>

---

 src/nouveau/compiler/nak/api.rs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/nouveau/compiler/nak/api.rs b/src/nouveau/compiler/nak/api.rs
index 2979ae66974..0c862378d81 100644
--- a/src/nouveau/compiler/nak/api.rs
+++ b/src/nouveau/compiler/nak/api.rs
@@ -401,7 +401,16 @@ pub extern "C" fn nak_compile_shader(
             let c_name = _mesa_shader_stage_to_string(info.stage as u32);
             CStr::from_ptr(c_name).to_str().expect("Invalid UTF-8")
         };
+        let instruction_count = if nak.sm >= 70 {
+            code.len() / 4
+        } else if nak.sm >= 50 {
+            (code.len() / 8) * 3
+        } else {
+            unreachable!()
+        };
+
         eprintln!("Stage: {}", stage_name);
+        eprintln!("Instruction count: {}", instruction_count);
         eprintln!("Num GPRs: {}", info.num_gprs);
         eprintln!("SLM size: {}", info.slm_size);
 

Reply via email to