Skip to content

blake3 difftest #328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

blake3 difftest #328

wants to merge 1 commit into from

Conversation

Firestar99
Copy link
Member

@Firestar99 Firestar99 commented Jul 7, 2025

blake3 is failing with a bunch of ICEs, see #312. This is a repro of the failure within out difftest framework, so that a fix can be developed.

black_box error:

error: internal compiler error: /Users/runner/work/rust-gpu/rust-gpu/tests/difftests/tests/target/release/build/rustc_codegen_spirv-46ee035126448e6d/out/pqp_cg_ssa/src/mir/block.rs:956:29: intrinsic black_box must be overridden by codegen backend, but isn't
test difftests::blake3 ... 2025-07-07T13:16:50.839901Z ERROR difftests::runner: Cargo execution failed for package 'blake3-rust-gpu'
   --> /Users/runner/.rustup/toolchains/nightly-2024-11-22-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/hint.rs:389:5
    |
389 |     crate::intrinsics::black_box(dummy)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at /Users/runner/work/rust-gpu/rust-gpu/tests/difftests/tests/target/release/build/rustc_codegen_spirv-46ee035126448e6d/out/pqp_cg_ssa/src/mir/block.rs:956:29:
Box<dyn Any>
stack backtrace:
   Compiling spirv-std-macros v0.9.0 (/Users/runner/work/rust-gpu/rust-gpu/crates/spirv-std/macros)
   0:        0x10eaf527c - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h447e736edf25ff33
   1:        0x10bd155e0 - core::fmt::write::hf4d022d9ef02167e
   2:        0x10eae9428 - std::io::Write::write_fmt::h11757e8bc697ea8e
   3:        0x10eaf513c - std::sys::backtrace::BacktraceLock::print::haf4ac7c7af3cf97a
   4:        0x10eaf7610 - std::panicking::default_hook::{{closure}}::h52aa610c7cde4596
   5:        0x10eaf7458 - std::panicking::default_hook::hdcfc7f1ad8d891f0
   6:        0x10c934bb0 - <alloc[e2e5e8515d00274d]::boxed::Box<rustc_driver_impl[c6ade677a6b0e20c]::install_ice_hook::{closure#0}> as core[924c651d484e1a25]::ops::function::Fn<(&dyn for<'a, 'b> core[924c651d484e1a25]::ops::function::Fn<(&'a std[fc297465fa958267]::panic::PanicHookInfo<'b>,), Output = ()> + core[924c651d484e1a25]::marker::Send + core[924c651d484e1a25]::marker::Sync, &std[fc297465fa958267]::panic::PanicHookInfo)>>::call
   7:        0x10c934bb0 - <alloc[e2e5e8515d00274d]::boxed::Box<rustc_driver_impl[c6ade677a6b0e20c]::install_ice_hook::{closure#0}> as core[924c651d484e1a25]::ops::function::Fn<(&dyn for<'a, 'b> core[924c651d484e1a25]::ops::function::Fn<(&'a std[fc297465fa958267]::panic::PanicHookInfo<'b>,), Output = ()> + core[924c651d484e1a25]::marker::Send + core[924c651d484e1a25]::marker::Sync, &std[fc297465fa958267]::panic::PanicHookInfo)>>::call
   8:        0x10eaf7edc - std::panicking::rust_panic_with_hook::heb73fc7746f92ba7
   9:        0x10c9d9718 - std[fc297465fa958267]::panicking::begin_panic::<rustc_errors[caf545eadef7fdd]::ExplicitBug>::{closure#0}
  10:        0x10c9d94d0 - std[fc297465fa958267]::sys::backtrace::__rust_end_short_backtrace::<std[fc297465fa958267]::panicking::begin_panic<rustc_errors[caf545eadef7fdd]::ExplicitBug>::{closure#0}, !>
  11:        0x11125c04c - std[fc297465fa958267]::panicking::begin_panic::<rustc_errors[caf545eadef7fdd]::ExplicitBug>
  12:        0x10c9dfad4 - <rustc_errors[caf545eadef7fdd]::diagnostic::BugAbort as rustc_errors[caf545eadef7fdd]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  13:        0x102cd621c - <unknown>
  14:        0x102b37588 - <unknown>
  15:        0x102b374b0 - <unknown>
  16:        0x102b3747c - <unknown>
  17:        0x1031b65c0 - <unknown>
  18:        0x102dc1b50 - <unknown>
  19:        0x102dd05f4 - <unknown>
  20:        0x102cca2b4 - <unknown>
  21:        0x102d6fa90 - <unknown>
  22:        0x102c3693c - <unknown>
  23:        0x102c364a0 - <unknown>
  24:        0x102ccb650 - <unknown>
  25:        0x102c35638 - <unknown>
  26:        0x10d1cbad8 - <rustc_session[3e2f7db2cc04b493]::session::Session>::time::<alloc[e2e5e8515d00274d]::boxed::Box<dyn core[924c651d484e1a25]::any::Any>, rustc_interface[fb6f1569d3f1850c]::passes::start_codegen::{closure#0}>
  27:        0x10d2fadd4 - rustc_interface[fb6f1569d3f1850c]::passes::start_codegen
  28:        0x10d2885f0 - <rustc_interface[fb6f1569d3f1850c]::queries::Linker>::codegen_and_build_linker
  29:        0x10c91dd20 - <rustc_middle[dc5a577fd6f5eb51]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}::{closure#1}::{closure#7}, core[924c651d484e1a25]::result::Result<core[924c651d484e1a25]::option::Option<rustc_interface[fb6f1569d3f1850c]::queries::Linker>, rustc_span[60df94d8028129a3]::ErrorGuaranteed>>
  30:        0x10c8e51b0 - <rustc_interface[fb6f1569d3f1850c]::interface::Compiler>::enter::<rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}::{closure#1}, core[924c651d484e1a25]::result::Result<core[924c651d484e1a25]::option::Option<rustc_interface[fb6f1569d3f1850c]::queries::Linker>, rustc_span[60df94d8028129a3]::ErrorGuaranteed>>
  31:        0x10c927588 - rustc_span[60df94d8028129a3]::create_session_globals_then::<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_with_globals<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_pool_with_globals<rustc_interface[fb6f1569d3f1850c]::interface::run_compiler<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}>::{closure#1}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
  32:        0x10c90f588 - std[fc297465fa958267]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_with_globals<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_pool_with_globals<rustc_interface[fb6f1569d3f1850c]::interface::run_compiler<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}>::{closure#1}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>
  33:        0x10c912b54 - <<std[fc297465fa958267]::thread::Builder>::spawn_unchecked_<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_with_globals<rustc_interface[fb6f1569d3f1850c]::util::run_in_thread_pool_with_globals<rustc_interface[fb6f1569d3f1850c]::interface::run_compiler<core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>, rustc_driver_impl[c6ade677a6b0e20c]::run_compiler::{closure#0}>::{closure#1}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[924c651d484e1a25]::result::Result<(), rustc_span[60df94d8028129a3]::ErrorGuaranteed>>::{closure#1} as core[924c651d484e1a25]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:        0x10eb01fe8 - std::sys::pal::unix::thread::Thread::new::thread_start::h5a3f92a0fdbf8eb0
  35:        0x18525ef94 - __pthread_joiner_wake

memset error, only locally observed:

error: memset on structs not implemented yet
   --> /home/firestar99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blake3-1.8.2/src/lib.rs:552:17
    |
552 |                 self.buf = [0; BLOCK_LEN];
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
pub const BLOCK_LEN: usize = 64;
let buf: [u8; BLOCK_LEN];
buf = [0; BLOCK_LEN]; // self removed

@LegNeato
Copy link
Collaborator

LegNeato commented Jul 7, 2025

Do we want this as a difftest? Should we create runtime tests using similar / the same stuff but not requiring a different impl to diff against?

@Firestar99
Copy link
Member Author

I was considering that... but when testing libs, it's probably still best to difftest it against calling the entry point from the CPU, to see if the GPU code may have mispiled somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants