arch_ptx: with LELEKA_SM86_TRACE also report images that have no companion

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-10-16 10:22:14 +02:00
co-authored by Claude Sonnet 5.5
parent 9862b23647
commit ab46f18ae6
+8 -1
View File
@@ -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,
}
}