diff --git a/.github/workflows/release-whl-kernel.yml b/.github/workflows/release-whl-kernel.yml index 28f06fe152fe..e0070c4379a3 100644 --- a/.github/workflows/release-whl-kernel.yml +++ b/.github/workflows/release-whl-kernel.yml @@ -45,6 +45,8 @@ jobs: cd sgl-kernel chmod +x ./build.sh ./build.sh "${{ matrix.python-version }}" "${{ matrix.cuda-version }}" ${{ matrix.arch == 'aarch64' && 'aarch64' || '' }} + env: + USE_CCACHE: 0 - name: Upload to PyPI working-directory: sgl-kernel @@ -136,6 +138,8 @@ jobs: cd sgl-kernel chmod +x ./build.sh ./build.sh "${{ matrix.python-version }}" "${{ matrix.cuda-version }}" ${{ matrix.arch == 'aarch64' && 'aarch64' || '' }} + env: + USE_CCACHE: 0 - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/sgl-kernel/build.sh b/sgl-kernel/build.sh index be1435300d84..b6f7db1af0fc 100755 --- a/sgl-kernel/build.sh +++ b/sgl-kernel/build.sh @@ -48,6 +48,7 @@ echo "Cache Configuration" echo "===================================" echo "CMake download cache: ${CMAKE_DOWNLOAD_CACHE}" echo "ccache directory: ${CCACHE_DIR}" +echo "ccache enabled: ${USE_CCACHE:-1}" echo "" docker run --rm \ @@ -56,6 +57,7 @@ docker run --rm \ -v ${CCACHE_DIR}:/ccache \ -e ENABLE_CMAKE_PROFILE="${ENABLE_CMAKE_PROFILE:-}" \ -e ENABLE_BUILD_PROFILE="${ENABLE_BUILD_PROFILE:-}" \ + -e USE_CCACHE="${USE_CCACHE:-1}" \ ${DOCKER_IMAGE} \ bash -c " set -e @@ -98,49 +100,56 @@ docker run --rm \ which cmake cmake --version - echo \"==================================\" - echo \"Installing and configuring ccache\" - echo \"==================================\" + if [ \"${USE_CCACHE}\" = \"1\" ]; then + echo \"==================================\" + echo \"Installing and configuring ccache\" + echo \"==================================\" - # Install ccache 4.12.1 from source for CUDA support (yum provides old 3.7.7) - echo \"Installing ccache 4.12.1 from source...\" - - # Install build dependencies - yum install -y gcc gcc-c++ make wget tar - - # Download and build ccache 4.12.1 - cd /tmp - wget -q https://github.com/ccache/ccache/releases/download/v4.12.1/ccache-4.12.1.tar.xz - tar -xf ccache-4.12.1.tar.xz - cd ccache-4.12.1 - - # Build and install (uses already-installed CMake 3.31) - mkdir build && cd build - /opt/cmake/bin/cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr .. >/dev/null - make -j\$(nproc) >/dev/null - make install >/dev/null - - # Verify installation - ccache --version - echo \"ccache 4.12.1 installed successfully\" - cd /sgl-kernel - - # Configure ccache - export CCACHE_DIR=/ccache - export CCACHE_BASEDIR=/sgl-kernel - export CCACHE_MAXSIZE=10G - export CCACHE_COMPILERCHECK=content - export CCACHE_COMPRESS=true - export CCACHE_SLOPPINESS=file_macro,time_macros,include_file_mtime,include_file_ctime - - # Set up ccache as compiler launcher (don't use PATH to avoid -ccbin conflicts) - export CMAKE_C_COMPILER_LAUNCHER=ccache - export CMAKE_CXX_COMPILER_LAUNCHER=ccache - export CMAKE_CUDA_COMPILER_LAUNCHER=ccache - - # Show ccache stats before build - ccache -sV || true - echo \"\" + # Install ccache 4.12.1 from source for CUDA support (yum provides old 3.7.7) + echo \"Installing ccache 4.12.1 from source...\" + + # Install build dependencies + yum install -y gcc gcc-c++ make wget tar + + # Download and build ccache 4.12.1 + cd /tmp + wget -q https://github.com/ccache/ccache/releases/download/v4.12.1/ccache-4.12.1.tar.xz + tar -xf ccache-4.12.1.tar.xz + cd ccache-4.12.1 + + # Build and install (uses already-installed CMake 3.31) + mkdir build && cd build + /opt/cmake/bin/cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr .. >/dev/null + make -j\$(nproc) >/dev/null + make install >/dev/null + + # Verify installation + ccache --version + echo \"ccache 4.12.1 installed successfully\" + cd /sgl-kernel + + # Configure ccache + export CCACHE_DIR=/ccache + export CCACHE_BASEDIR=/sgl-kernel + export CCACHE_MAXSIZE=10G + export CCACHE_COMPILERCHECK=content + export CCACHE_COMPRESS=true + export CCACHE_SLOPPINESS=file_macro,time_macros,include_file_mtime,include_file_ctime + + # Set up ccache as compiler launcher (don't use PATH to avoid -ccbin conflicts) + export CMAKE_C_COMPILER_LAUNCHER=ccache + export CMAKE_CXX_COMPILER_LAUNCHER=ccache + export CMAKE_CUDA_COMPILER_LAUNCHER=ccache + + # Show ccache stats before build + ccache -sV || true + echo \"\" + else + echo \"==================================\" + echo \"ccache disabled (USE_CCACHE=0)\" + echo \"==================================\" + echo \"\" + fi yum install numactl-devel -y --nogpgcheck && \ yum install libibverbs -y --nogpgcheck && \ @@ -223,10 +232,12 @@ docker run --rm \ fi # Show ccache statistics after build - echo \"\" - echo \"==================================\" - echo \"ccache Statistics\" - echo \"==================================\" - ccache -s - echo \"\" + if [ \"${USE_CCACHE}\" = \"1\" ]; then + echo \"\" + echo \"==================================\" + echo \"ccache Statistics\" + echo \"==================================\" + ccache -s + echo \"\" + fi "