rust-lang / rustc_codegen_cranelift

Cranelift based backend for rustc
Apache License 2.0
1.52k stars 94 forks source link

unimplemented instrinsic in `hyper` (`_mm256_lddqu_si256`) #1408

Closed y21 closed 7 months ago

y21 commented 8 months ago

Noticed this in a project using reqwest, but it also seems to reproduce using just hyper and tokio:

# Cargo.toml
[package]
name = "repro"
version = "0.1.0"
edition = "2021"

[dependencies]
hyper = { version = "0.14.27", features = ["client", "http1", "tcp"] }
tokio = { version = "1.33.0", features = ["full"] }
// main.rs
#[tokio::main]
async fn main() {
    let client = hyper::Client::new();
    client
        .request(
            hyper::Request::builder()
                .uri("http://httpbin.org/get")
                .body(hyper::Body::empty())
                .unwrap(),
        )
        .await
        .unwrap();
}
trap at Instance { def: Item(DefId(2:14310 ~ core[53bd]::core_arch::x86::avx::_mm256_lddqu_si256)), args: [] } (_ZN4core9core_arch3x863avx18_mm256_lddqu_si25617h4bd75b5668ffeef1E): llvm.x86.avx.ldu.dq.256

Awesome project btw! It's great to see that this is available as a rustup component now

bjorn3 commented 8 months ago

Turns out cg_clif miscompiled is_x86_feature_detected!() such that AVX is never detected: https://github.com/rust-lang/rustc_codegen_cranelift/issues/1405#issuecomment-1787952058 This has resulted in me not noticing all the AVX intrinsics that crates rely on. When using the rustup component, an LLVM compiled libstd will be used which has a correct is_x86_feature_detected!() which does detect AVX. I will work on implementing this AVX vendor intrinsic tomorrow.

bjorn3 commented 7 months ago

Should be fixed in the latest nightly.