Skip to content
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

simd_adler32 is miscompiled by cranelift #1426

Closed
Aaron1011 opened this issue Nov 12, 2023 · 2 comments
Closed

simd_adler32 is miscompiled by cranelift #1426

Aaron1011 opened this issue Nov 12, 2023 · 2 comments
Labels
A-core-arch Area: Necessary for full core::arch support C-bug Category: This is a bug.

Comments

@Aaron1011
Copy link
Member

On commit mcountryman/simd-adler32@94f3f72, all of the tests pass when running cargo test (using the default LLVM backend).

However, some of the tests fail with cargo-clif test:

running 25 tests
test imp::avx2::tests::wiki ... ok
test imp::avx512::tests::ones ... ok
test imp::avx512::tests::wiki ... ok
test imp::avx512::tests::zeroes ... ok
test imp::scalar::tests::wiki ... ok
test imp::sse2::tests::wiki ... ok
test imp::ssse3::tests::wiki ... ok
test imp::wasm::tests::ones ... ok
test imp::wasm::tests::zeroes ... ok
test imp::wasm::tests::wiki ... ok
test tests::test_from_checksum ... ok
test imp::scalar::tests::mixed ... ok
test imp::scalar::tests::ones ... ok
test imp::scalar::tests::zeroes ... ok
test imp::avx2::tests::ones ... FAILED
test imp::sse2::tests::ones ... FAILED
test imp::ssse3::tests::ones ... FAILED
test imp::avx2::tests::zeroes ... ok
test imp::ssse3::tests::zeroes ... ok
test imp::wasm::tests::random ... ok
test imp::sse2::tests::zeroes ... ok
test imp::avx512::tests::random ... ok
test imp::sse2::tests::random ... FAILED
test imp::ssse3::tests::random ... FAILED
test imp::avx2::tests::random ... FAILED

failures:

---- imp::avx2::tests::ones stdout ----
---- imp::avx2::tests::ones stderr ----
thread 'main' panicked at src/imp/avx2.rs:211:7:
assertion `left == right` failed: len(100)
  left: 139329553
 right: 337510501
stack backtrace:
   0: rust_begin_unwind
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:72:14
   2: core::panicking::assert_failed_inner
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panic.rs:106:9
   3: core::panicking::assert_failed
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:279:5
   4: simd_adler32::imp::avx2::tests::assert_sum_eq
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/macros/mod.rs:58:21
   5: simd_adler32::imp::avx2::tests::ones
             at ./src/imp/avx2.rs:183:5
   6: simd_adler32::imp::avx2::tests::ones::{{closure}}
             at ./src/imp/avx2.rs:179:12
   7: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
   8: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- imp::sse2::tests::ones stdout ----
---- imp::sse2::tests::ones stderr ----
thread 'main' panicked at src/imp/sse2.rs:230:7:
assertion `left == right` failed: len(100)
  left: 139329553
 right: 337510501
stack backtrace:
   0: rust_begin_unwind
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:72:14
   2: core::panicking::assert_failed_inner
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panic.rs:106:9
   3: core::panicking::assert_failed
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:279:5
   4: simd_adler32::imp::sse2::tests::assert_sum_eq
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/macros/mod.rs:58:21
   5: simd_adler32::imp::sse2::tests::ones
             at ./src/imp/sse2.rs:202:5
   6: simd_adler32::imp::sse2::tests::ones::{{closure}}
             at ./src/imp/sse2.rs:198:12
   7: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
   8: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- imp::ssse3::tests::ones stdout ----
---- imp::ssse3::tests::ones stderr ----
thread 'main' panicked at src/imp/ssse3.rs:216:7:
assertion `left == right` failed: len(100)
  left: 139329553
 right: 337510501
stack backtrace:
   0: rust_begin_unwind
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:72:14
   2: core::panicking::assert_failed_inner
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panic.rs:106:9
   3: core::panicking::assert_failed
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:279:5
   4: simd_adler32::imp::ssse3::tests::assert_sum_eq
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/macros/mod.rs:58:21
   5: simd_adler32::imp::ssse3::tests::ones
             at ./src/imp/ssse3.rs:188:5
   6: simd_adler32::imp::ssse3::tests::ones::{{closure}}
             at ./src/imp/ssse3.rs:184:12
   7: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
   8: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- imp::sse2::tests::random stdout ----
---- imp::sse2::tests::random stderr ----
thread 'main' panicked at src/imp/sse2.rs:230:7:
assertion `left == right` failed: len(100)
  left: 2264270168
 right: 948449702
stack backtrace:
   0: rust_begin_unwind
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:72:14
   2: core::panicking::assert_failed_inner
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panic.rs:106:9
   3: core::panicking::assert_failed
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:279:5
   4: simd_adler32::imp::sse2::tests::assert_sum_eq
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/macros/mod.rs:58:21
   5: simd_adler32::imp::sse2::tests::random
             at ./src/imp/sse2.rs:213:5
   6: simd_adler32::imp::sse2::tests::random::{{closure}}
             at ./src/imp/sse2.rs:208:14
   7: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
   8: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- imp::ssse3::tests::random stdout ----
---- imp::ssse3::tests::random stderr ----
thread 'main' panicked at src/imp/ssse3.rs:216:7:
assertion `left == right` failed: len(100)
  left: 3809150244
 right: 3834394226
stack backtrace:
   0: rust_begin_unwind
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:72:14
   2: core::panicking::assert_failed_inner
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panic.rs:106:9
   3: core::panicking::assert_failed
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:279:5
   4: simd_adler32::imp::ssse3::tests::assert_sum_eq
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/macros/mod.rs:58:21
   5: simd_adler32::imp::ssse3::tests::random
             at ./src/imp/ssse3.rs:199:5
   6: simd_adler32::imp::ssse3::tests::random::{{closure}}
             at ./src/imp/ssse3.rs:194:14
   7: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
   8: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- imp::avx2::tests::random stdout ----
---- imp::avx2::tests::random stderr ----
thread 'main' panicked at src/imp/avx2.rs:211:7:
assertion `left == right` failed: len(100)
  left: 1135609101
 right: 2970299849
stack backtrace:
   0: rust_begin_unwind
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:72:14
   2: core::panicking::assert_failed_inner
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panic.rs:106:9
   3: core::panicking::assert_failed
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/panicking.rs:279:5
   4: simd_adler32::imp::avx2::tests::assert_sum_eq
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/macros/mod.rs:58:21
   5: simd_adler32::imp::avx2::tests::random
             at ./src/imp/avx2.rs:194:5
   6: simd_adler32::imp::avx2::tests::random::{{closure}}
             at ./src/imp/avx2.rs:189:14
   7: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
   8: core::ops::function::FnOnce::call_once
             at /drive2/rustc_codegen_cranelift/build/stdlib/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    imp::avx2::tests::ones
    imp::avx2::tests::random
    imp::sse2::tests::ones
    imp::sse2::tests::random
    imp::ssse3::tests::ones
    imp::ssse3::tests::random

test result: FAILED. 19 passed; 6 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s
@bjorn3 bjorn3 added C-bug Category: This is a bug. A-core-arch Area: Necessary for full core::arch support labels Nov 12, 2023
@Aaron1011
Copy link
Member Author

This appears to be an issue with the implementation of _mm_sad_epu8

@bjorn3 bjorn3 closed this as completed in a5fcfad Nov 21, 2023
@bjorn3
Copy link
Member

bjorn3 commented Nov 21, 2023

That was indeed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core-arch Area: Necessary for full core::arch support C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants