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

Set opt optimization level to 2 #1355

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docker/aligned_base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef

FROM chef AS planner

ENV RUSTFLAGS="-C codegen-units=256 -C incremental=true -C opt-level=0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the incremental flag. It doesn't really help in CI environments and generates a lot of data for the cache.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you might want to use lto=false.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is caching the files though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also lto = false is the default of release

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the incremental, cargo chef mentions it's redudant and increases the amount of layers in docker file. lto false seems to not change anything since the default is release.


# build_sp1_linux
COPY operator/sp1/lib/Cargo.toml /aligned_layer/operator/sp1/lib/Cargo.toml
COPY operator/sp1/lib/src/ /aligned_layer/operator/sp1/lib/src/
Expand Down Expand Up @@ -73,6 +75,8 @@ RUN cargo chef prepare --recipe-path /aligned_layer/operator/merkle_tree/lib/rec

FROM chef AS chef_builder

ENV RUSTFLAGS="-C codegen-units=256 -C incremental=true -C opt-level=0"

COPY batcher/aligned-sdk /aligned_layer/batcher/aligned-sdk/

# build_sp1_linux
Expand Down Expand Up @@ -107,6 +111,8 @@ RUN cargo chef cook --release --recipe-path /aligned_layer/operator/merkle_tree/

FROM base AS builder

ENV RUSTFLAGS="-C codegen-units=256 -C incremental=true -C opt-level=0"

ENV RELEASE_FLAG=--release
ENV TARGET_REL_PATH=release
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
Expand Down
8 changes: 8 additions & 0 deletions docker/batcher.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef

FROM chef AS planner

ENV RUSTFLAGS="-C codegen-units=256 -C incremental=true -C opt-level=0"

COPY batcher/aligned-batcher/Cargo.toml /aligned_layer/batcher/aligned-batcher/Cargo.toml
COPY batcher/aligned-batcher/src/main.rs /aligned_layer/batcher/aligned-batcher/src/main.rs
WORKDIR /aligned_layer/batcher/aligned-batcher/
Expand All @@ -22,6 +24,9 @@ WORKDIR /aligned_layer/batcher/aligned/
RUN cargo chef prepare --recipe-path /aligned_layer/batcher/aligned/recipe.json

FROM chef AS chef_builder

ENV RUSTFLAGS="-C codegen-units=256 -C incremental=true -C opt-level=0"

COPY batcher/aligned-sdk/ /aligned_layer/batcher/aligned-sdk/

COPY --from=planner /aligned_layer/batcher/aligned-batcher/recipe.json /aligned_layer/batcher/aligned-batcher/recipe.json
Expand All @@ -33,6 +38,9 @@ WORKDIR /aligned_layer/batcher/aligned/
RUN cargo chef cook --release --recipe-path /aligned_layer/batcher/aligned/recipe.json

FROM base AS builder

ENV RUSTFLAGS="-C codegen-units=256 -C incremental=true -C opt-level=0"

COPY . /aligned_layer/

COPY --from=chef_builder /aligned_layer/batcher/aligned-batcher/target/ /aligned_layer/batcher/aligned-batcher/target/
Expand Down
Loading