Skip to content

[Feature]: Enable explicit CMAKE_BUILD_TYPE configuration for local builds #20117

@cyril23

Description

@cyril23

🚀 The feature, motivation and pitch

To improve the developer experience, it would be beneficial to have a more straightforward way to create a Release build locally. This would allow contributors to easily check the final wheel artifact size without the dependency on a properly configured SCCACHE.

This need was discovered while working on PR #19794. I encountered SCCACHE authentication errors and, not immediately knowing the correct configuration flags (SCCACHE_S3_NO_CREDENTIALS=1), was unable to produce a Release build. This led to the realization that my local builds were not Release by default, explaining the unexpectedly large wheel sizes. This experience highlights how the current build process can be confusing for new contributors.

When adding new features, it's crucial to verify that changes don't cause the wheel size to exceed PyPI's limitations before opening a pull request. Decoupling the build type from SCCACHE would solve this.

A proposed implementation is as follows:

diff --git a/docker/Dockerfile b/docker/Dockerfile
index 8d4375470..ae866edd0 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -112,6 +112,7 @@ ENV MAX_JOBS=${max_jobs}
 ARG nvcc_threads=8
 ENV NVCC_THREADS=$nvcc_threads

+ARG CMAKE_BUILD_TYPE=Release
 ARG USE_SCCACHE
 ARG SCCACHE_BUCKET_NAME=vllm-build-sccache
 ARG SCCACHE_REGION_NAME=us-west-2
@@ -129,7 +130,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
         && export SCCACHE_REGION=${SCCACHE_REGION_NAME} \
         && export SCCACHE_S3_NO_CREDENTIALS=${SCCACHE_S3_NO_CREDENTIALS} \
         && export SCCACHE_IDLE_TIMEOUT=0 \
-        && export CMAKE_BUILD_TYPE=Release \
+        && export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
         && sccache --show-stats \
         && python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38 \
         && sccache --show-stats; \
@@ -143,6 +144,7 @@ RUN --mount=type=cache,target=/root/.cache/ccache \
         # Clean any existing CMake artifacts
         rm -rf .deps && \
         mkdir -p .deps && \
+        export CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && \
         python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
     fi

Open Question for Discussion

What should the default CMAKE_BUILD_TYPE be?

  • Release: As proposed in the diff. This would provide optimized builds by default for all users of the Dockerfile.
  • Empty/None: This would maintain the current behavior for non-SCCACHE builds, where it's not a Release build.

Feedback on the best default would be greatly appreciated!

Alternatives

The current alternative is to use USE_SCCACHE=1 to trigger a Release build. However, this requires setting up SCCACHE credentials and unnecessarily couples the build type to the caching mechanism, which can be a point of friction for contributors.

Additional context

No response

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or requeststaleOver 90 days of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions