Skip to content

Parallel frontend (-Z threads=8) results in a different output than single-threaded #117776

Open
@vincentdephily

Description

@vincentdephily

I wanted to check if using the threaded compiler produced a different binary:

gix clone https://github.com/BurntSushi/ripgrep/ && cd ripgrep
unset RUSTC_WRAPPER
unset RUSTFLAGS
rm -r target/;time cargo +nightly build -r;cp target/release/rg ./rg.single
export RUSTFLAGS="-Zthreads=1"
rm -r target/;time cargo +nightly build -r;cp target/release/rg ./rg.multi1
export RUSTFLAGS="-Zthreads=8"
rm -r target/;time cargo +nightly build -r;cp target/release/rg ./rg.multi8
sha256sum rg.*

I expected to see this happen:

All binaries should be the same.

Note that when not changing settings, multiple rebuilds yield a binary with the same checksum.

Instead, this happened:

Different binaries, even different sizes. I tried with ripgrep and with my own emlop.

For emlop, I also ran its benchmark (./benches/exec_compare.rs -p e:./emlop.multi,e:./emlop.single -n -r 50) and found a 1% perf regression (but this is a noisy benchmark, I'm sure the difference could have gone either way).

Meta

rustc 1.75.0-nightly (0f44eb32f 2023-11-09)
binary: rustc
commit-hash: 0f44eb32f1123ac93ab404d74c295263ce468343
commit-date: 2023-11-09
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parallel-compilerArea: parallel compilerA-reproducibilityArea: Reproducible / deterministic buildsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions