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
8 changes: 4 additions & 4 deletions .github/actions/doc_preview/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ runs:
# Note: the PR previews will be removed once merged to main or release/* (see below)
- name: Deploy doc preview
if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
with:
git-config-name: cuda-python-bot
git-config-email: cuda-python-bot@users.noreply.github.com
Expand All @@ -32,7 +32,7 @@ runs:

- name: Leave a comment after deployment
if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3.0.3
with:
header: pr-preview
number: ${{ inputs.pr-number }}
Expand All @@ -49,7 +49,7 @@ runs:
# The steps below are executed only when building on main or release/*.
- name: Remove doc preview
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }}
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
with:
git-config-name: cuda-python-bot
git-config-email: cuda-python-bot@users.noreply.github.com
Expand All @@ -59,7 +59,7 @@ runs:

- name: Leave a comment after removal
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }}
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3.0.3
with:
header: pr-preview
number: ${{ inputs.pr-number }}
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/fetch_ctk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ runs:

- name: Download CTK cache
id: ctk-get-cache
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
continue-on-error: true
with:
key: ${{ env.CTK_CACHE_KEY }}
Expand Down Expand Up @@ -142,7 +142,7 @@ runs:
- name: Upload CTK cache
if: ${{ !cancelled() &&
steps.ctk-get-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
key: ${{ env.CTK_CACHE_KEY }}
path: ./${{ env.CTK_CACHE_FILENAME }}
Expand Down
81 changes: 81 additions & 0 deletions .github/actions/sccache-summary/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: sccache summary
description: Parse sccache stats JSON and write a summary table to GITHUB_STEP_SUMMARY

# Inspired by NVIDIA/cccl's prepare-execution-summary.py (PR #3621).
# Only counts C/C++ and CUDA language hits (excludes PTX/CUBIN which are
# not included in sccache's compile_requests counter).

inputs:
json-file:
description: "Path to the sccache stats JSON file (from sccache --show-stats --stats-format=json)"
required: true
label:
description: "Label for the stats row (e.g. cuda.bindings, cuda.core)"
required: false
default: "sccache"
build-step:
description: "Name of the cibuildwheel build step (for deep-link in summary)"
required: false
default: ""

runs:
using: composite
steps:
- name: Report sccache stats
shell: bash --noprofile --norc -euo pipefail {0}
env:
SCCACHE_JSON: ${{ inputs.json-file }}
SCCACHE_LABEL: ${{ inputs.label }}
SCCACHE_BUILD_STEP: ${{ inputs.build-step }}
run: |
if [ ! -f "$SCCACHE_JSON" ]; then
echo "::warning::sccache stats file not found: $SCCACHE_JSON"
exit 0
fi

python3 - <<'PYEOF'
import json, os, urllib.parse

json_file = os.environ["SCCACHE_JSON"]
label = os.environ["SCCACHE_LABEL"]
build_step = os.environ.get("SCCACHE_BUILD_STEP", "")

with open(json_file) as f:
stats = json.load(f)["stats"]

# compile_requests includes non-compilation calls (linker, etc).
# Use cache_hits + cache_misses as the denominator to match sccache's
# own "Cache hits rate" which only counts actual compilation requests.
counted_languages = {"C/C++", "CUDA"}
hits = sum(
v for k, v in stats.get("cache_hits", {}).get("counts", {}).items()
if k in counted_languages
)
misses = sum(
v for k, v in stats.get("cache_misses", {}).get("counts", {}).items()
if k in counted_languages
)
total = hits + misses
pct = int(100 * hits / total) if total > 0 else 0

# Build a deep-link to the cibuildwheel step if step name is provided.
# GHA step summary links use the format: #step:N:L but we can't know the
# step number here. Instead, link to the job page with a search hint.
link_note = ""
if build_step:
link_note = f"\n\n_Full stats in the **{build_step}** step log._\n"

summary_file = os.environ.get("GITHUB_STEP_SUMMARY", "")
if summary_file:
with open(summary_file, "a") as sf:
sf.write(f"### 📊 {label} — sccache stats\n")
sf.write("| Hit Rate | Hits | Misses | Requests |\n")
sf.write("|----------|------|--------|----------|\n")
sf.write(f"| {pct}% | {hits} | {misses} | {total} |{link_note}\n")

print(f"{label}: {pct}% hit rate ({hits}/{total})")
PYEOF
35 changes: 32 additions & 3 deletions .github/workflows/build-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
# are exposed by this action.
- name: Enable sccache
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # 0.0.9
with:
disable_annotations: 'true'

# xref: https://github.com/orgs/community/discussions/42856#discussioncomment-7678867
- name: Adding addtional GHA cache-related env vars
Expand Down Expand Up @@ -175,13 +177,22 @@ jobs:
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
# check cache stats before leaving cibuildwheel
CIBW_BEFORE_TEST_LINUX: >
"/host/${{ env.SCCACHE_PATH }}" --show-stats
"/host/${{ env.SCCACHE_PATH }}" --show-stats &&
"/host/${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_bindings.json
# force the test stage to be run (so that before-test is not skipped)
# TODO: we might want to think twice on adding this, it does a lot of
# things before reaching this command.
CIBW_TEST_COMMAND: >
echo "ok!"

- name: Report sccache stats (cuda.bindings)
if: ${{ inputs.host-platform != 'win-64' }}
uses: ./.github/actions/sccache-summary
with:
json-file: sccache_bindings.json
label: "cuda.bindings"
build-step: "Build cuda.bindings wheel"

- name: List the cuda.bindings artifacts directory
run: |
if [[ "${{ inputs.host-platform }}" == win* ]]; then
Expand Down Expand Up @@ -233,13 +244,22 @@ jobs:
PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})"
# check cache stats before leaving cibuildwheel
CIBW_BEFORE_TEST_LINUX: >
"/host${{ env.SCCACHE_PATH }}" --show-stats
"/host${{ env.SCCACHE_PATH }}" --show-stats &&
"/host${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_core.json
# force the test stage to be run (so that before-test is not skipped)
# TODO: we might want to think twice on adding this, it does a lot of
# things before reaching this command.
CIBW_TEST_COMMAND: >
echo "ok!"

- name: Report sccache stats (cuda.core)
if: ${{ inputs.host-platform != 'win-64' }}
uses: ./.github/actions/sccache-summary
with:
json-file: sccache_core.json
label: "cuda.core"
build-step: "Build cuda.core wheel"

- name: List the cuda.core artifacts directory and rename
run: |
if [[ "${{ inputs.host-platform }}" == win* ]]; then
Expand Down Expand Up @@ -412,13 +432,22 @@ jobs:
PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})"
# check cache stats before leaving cibuildwheel
CIBW_BEFORE_TEST_LINUX: >
"/host${{ env.SCCACHE_PATH }}" --show-stats
"/host${{ env.SCCACHE_PATH }}" --show-stats &&
"/host${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_core_prev.json
# force the test stage to be run (so that before-test is not skipped)
# TODO: we might want to think twice on adding this, it does a lot of
# things before reaching this command.
CIBW_TEST_COMMAND: >
echo "ok!"

- name: Report sccache stats (cuda.core prev)
if: ${{ inputs.host-platform != 'win-64' }}
uses: ./.github/actions/sccache-summary
with:
json-file: sccache_core_prev.json
label: "cuda.core (prev CTK)"
build-step: "Build cuda.core wheel"

- name: List the cuda.core artifacts directory and rename
run: |
if [[ "${{ inputs.host-platform }}" == win* ]]; then
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
image: ubuntu:22.04
env:
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
PIP_CACHE_DIR: "/tmp/pip-cache"
steps:
- name: Ensure GPU is working
run: nvidia-smi
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-wheel-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
image: ubuntu:22.04
env:
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
PIP_CACHE_DIR: "/tmp/pip-cache"
steps:
- name: Ensure GPU is working
run: nvidia-smi
Expand Down
Loading