Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions .github/workflows/release-whl-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
107 changes: 59 additions & 48 deletions sgl-kernel/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand Down Expand Up @@ -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 && \
Expand Down Expand Up @@ -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
"
Loading