From ab46f18ae67a939eabdca99341c8bd42b001e6c8 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Fri, 16 Oct 2026 10:22:14 +0200 Subject: [PATCH] arch_ptx: with LELEKA_SM86_TRACE also report images that have no companion Co-Authored-By: Claude Sonnet 5.5 --- crates/cuda-driver/src/arch_ptx.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/cuda-driver/src/arch_ptx.rs b/crates/cuda-driver/src/arch_ptx.rs index 0293e0e6..8b75731d 100644 --- a/crates/cuda-driver/src/arch_ptx.rs +++ b/crates/cuda-driver/src/arch_ptx.rs @@ -40,7 +40,14 @@ pub(crate) fn image(ptx: &[u8]) -> &[u8] { #[cfg(feature = "sm86")] pub(crate) fn image(ptx: &[u8]) -> &[u8] { match imp::current_cc() { - Some((major, minor)) if companion_cc(major, minor) => companion_for(ptx).unwrap_or(ptx), + Some((major, minor)) if companion_cc(major, minor) => companion_for(ptx).unwrap_or_else(|| { + if std::env::var_os("LELEKA_SM86_TRACE").is_some() { + let end = ptx.iter().rposition(|&b| b != 0).map_or(0, |i| i + 1); + let d = crate::qwen_ffi::sha256(&ptx[..end]); + eprintln!("sm86: no companion for an image of {end} bytes (sha256 {:02x}{:02x}{:02x}{:02x}..); passed through", d[0], d[1], d[2], d[3]); + } + ptx + }), _ => ptx, } }