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

Regression in wasm simd compilation in debug mode #80916

Closed
alexcrichton opened this issue Jan 11, 2021 · 2 comments
Closed

Regression in wasm simd compilation in debug mode #80916

alexcrichton opened this issue Jan 11, 2021 · 2 comments
Labels
A-SIMD Area: SIMD (Single Instruction Multiple Data) C-bug Category: This is a bug. O-wasm Target: WASM (WebAssembly), http://webassembly.org/

Comments

@alexcrichton
Copy link
Member

It looks like the CI of stdarch started failing recently. Bisection shows that this is caused by #76896. That PR looks relatively innocuous on the surface, however, so this may be a longstanding bug in wasm simd just uncovered by that. I wanted to open this to track the regression nonetheless.

The regression can be reproduced with:

#![feature(wasm_simd)]
use std::arch::wasm32::*;

fn main() {
    unsafe {
        i8x16_splat(3);
    }
}

compiled as:

$ rustc +937f629535f38c655267f1ed21ce6830f592f5df foo.rs --target wasm32-wasi
$ rustc +ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09 foo.rs --target wasm32-wasi
error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "wasm" "--rsp-quoting=posix" "-z" "stack-size=1048576" "--stack-first" "--allow-undefined" "--fatal-warnings" "--no-demangle" "--export-dynamic" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/self-contained/crt1.o" "-L" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib" "-L" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/self-contained" "foo.foo.7rcbfp3g-cgu.0.rcgu.o" "foo.foo.7rcbfp3g-cgu.1.rcgu.o" "foo.foo.7rcbfp3g-cgu.2.rcgu.o" "foo.foo.7rcbfp3g-cgu.3.rcgu.o" "foo.foo.7rcbfp3g-cgu.4.rcgu.o" "foo.foo.7rcbfp3g-cgu.5.rcgu.o" "foo.foo.7rcbfp3g-cgu.6.rcgu.o" "foo.foo.7rcbfp3g-cgu.7.rcgu.o" "-o" "foo.wasm" "--export" "main" "--export=__heap_base" "--export=__data_end" "foo.belfx9afw9cmv8.rcgu.o" "--gc-sections" "-O0" "-L" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/libstd-2010bfb86c99e0e4.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/libpanic_abort-7348bc04167f63d3.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/libwasi-b975e015f92454fb.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/librustc_demangle-2b4cf7f6f61445f6.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/libhashbrown-8206246a130f07b8.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/librustc_std_workspace_alloc-28243a9ec9a229cb.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/libunwind-621a353e76ed269f.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/libcfg_if-d5b91ddbada25475.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/liblibc-f4106e9d51b181bb.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/liballoc-2c1504d1aff4027c.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/librustc_std_workspace_core-efa7ae18cfea5213.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/libcore-d162792e302a9836.rlib" "/Users/acrichton/.rustup/toolchains/ddf2cc7f8eb34f1a63b491d6a52e3e8208393c09/lib/rustlib/wasm32-wasi/lib/libcompiler_builtins-000d51a42ac2122c.rlib"
  = note: rust-lld: error: function signature mismatch: _ZN4core9core_arch4simd5i8x165splat17h1e05c24c8cf9897dE
          >>> defined as (i32) -> v128 in foo.foo.7rcbfp3g-cgu.2.rcgu.o
          >>> defined as (i32, i32) -> void in foo.foo.7rcbfp3g-cgu.7.rcgu.o
          

error: aborting due to previous error
@jonas-schievink jonas-schievink added A-SIMD Area: SIMD (Single Instruction Multiple Data) C-bug Category: This is a bug. O-wasm Target: WASM (WebAssembly), http://webassembly.org/ labels Jan 11, 2021
@alexcrichton
Copy link
Member Author

Ok after some more debugging I think #76896 is indeed at fault. After reading that PR more closely it looks like it only changes the behavior of inline(always) in debug mode, which indeed has been known to break SIMD-related things in the past.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jan 13, 2021
…debug, r=wesleywiser

Revert "Auto merge of rust-lang#76896 - spastorino:codegen-inline-fns2

This reverts commit ddf2cc7, reversing
changes made to 937f629.

As `@alexcrichton` pointed out in rust-lang#80916 there's a problem with the taken approach.
@alexcrichton
Copy link
Member Author

I think the relevant PR was reverted so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-SIMD Area: SIMD (Single Instruction Multiple Data) C-bug Category: This is a bug. O-wasm Target: WASM (WebAssembly), http://webassembly.org/
Projects
None yet
Development

No branches or pull requests

2 participants