Skip to content

Commit 8df096a

Browse files
committed
fix(os): stabilize Rust code generation across hosts
1 parent 896887d commit 8df096a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

os/mkosi/components/dstack-rust/dstack-rust-build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ if [[ ${DSTACK_SKIP_RUST:-0} != 1 ]]; then
2727
export CARGO_INCREMENTAL=0 CARGO_NET_OFFLINE=${CARGO_NET_OFFLINE:-false}
2828
build_root=$(dirname "$DEST")
2929
export CARGO_TARGET_DIR="$build_root/dstack-cargo-target"
30-
export RUSTFLAGS="${RUSTFLAGS:-} --remap-path-prefix=$ROOT=/usr/src/dstack --remap-path-prefix=$build_root=/usr/src/dstack-build -C strip=debuginfo"
30+
# A single codegen unit avoids LLVM partition/scheduling differences across
31+
# hosts with different CPU counts while retaining parallel crate builds.
32+
export RUSTFLAGS="${RUSTFLAGS:-} --remap-path-prefix=$ROOT=/usr/src/dstack --remap-path-prefix=$build_root=/usr/src/dstack-build -C codegen-units=1 -C strip=debuginfo"
3133
cargo build --locked --release --manifest-path "$ROOT/dstack/Cargo.toml" \
3234
-p dstack-guest-agent -p dstack-util
3335
install -m0755 "$CARGO_TARGET_DIR/release/dstack-guest-agent" \

0 commit comments

Comments
 (0)