Skip to content

Commit f6a3032

Browse files
committed
Merge branch 'tensor-bridge-749' of https://github.com/leofang/cuda-python into tensor-bridge-749
2 parents 7f5dda6 + 37fce1a commit f6a3032

File tree

18 files changed

+494
-95
lines changed

18 files changed

+494
-95
lines changed

.github/actions/doc_preview/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ runs:
2222
# Note: the PR previews will be removed once merged to main or release/* (see below)
2323
- name: Deploy doc preview
2424
if: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') }}
25-
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4.7.3
25+
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
2626
with:
2727
git-config-name: cuda-python-bot
2828
git-config-email: cuda-python-bot@users.noreply.github.com
@@ -32,7 +32,7 @@ runs:
3232

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

6060
- name: Leave a comment after removal
6161
if: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') }}
62-
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
62+
uses: marocchino/sticky-pull-request-comment@d4d6b0936434b21bc8345ad45a440c5f7d2c40ff # v3.0.3
6363
with:
6464
header: pr-preview
6565
number: ${{ inputs.pr-number }}

.github/actions/fetch_ctk/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

@@ -60,7 +60,7 @@ runs:
6060

6161
- name: Download CTK cache
6262
id: ctk-get-cache
63-
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
63+
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
6464
continue-on-error: true
6565
with:
6666
key: ${{ env.CTK_CACHE_KEY }}
@@ -103,7 +103,7 @@ runs:
103103
function populate_cuda_path() {
104104
# take the component name as a argument
105105
function download() {
106-
curl -kLSs $1 -o $2
106+
curl -LSs $1 -o $2
107107
}
108108
CTK_COMPONENT=$1
109109
CTK_COMPONENT_REL_PATH="$(curl -s $CTK_JSON_URL |
@@ -142,7 +142,7 @@ runs:
142142
- name: Upload CTK cache
143143
if: ${{ !cancelled() &&
144144
steps.ctk-get-cache.outputs.cache-hit != 'true' }}
145-
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
145+
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
146146
with:
147147
key: ${{ env.CTK_CACHE_KEY }}
148148
path: ./${{ env.CTK_CACHE_FILENAME }}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: sccache summary
6+
description: Parse sccache stats JSON and write a summary table to GITHUB_STEP_SUMMARY
7+
8+
# Inspired by NVIDIA/cccl's prepare-execution-summary.py (PR #3621).
9+
# Only counts C/C++ and CUDA language hits (excludes PTX/CUBIN which are
10+
# not included in sccache's compile_requests counter).
11+
12+
inputs:
13+
json-file:
14+
description: "Path to the sccache stats JSON file (from sccache --show-stats --stats-format=json)"
15+
required: true
16+
label:
17+
description: "Label for the stats row (e.g. cuda.bindings, cuda.core)"
18+
required: false
19+
default: "sccache"
20+
build-step:
21+
description: "Name of the cibuildwheel build step (for deep-link in summary)"
22+
required: false
23+
default: ""
24+
25+
runs:
26+
using: composite
27+
steps:
28+
- name: Report sccache stats
29+
shell: bash --noprofile --norc -euo pipefail {0}
30+
env:
31+
SCCACHE_JSON: ${{ inputs.json-file }}
32+
SCCACHE_LABEL: ${{ inputs.label }}
33+
SCCACHE_BUILD_STEP: ${{ inputs.build-step }}
34+
run: |
35+
if [ ! -f "$SCCACHE_JSON" ]; then
36+
echo "::warning::sccache stats file not found: $SCCACHE_JSON"
37+
exit 0
38+
fi
39+
40+
python3 - <<'PYEOF'
41+
import json, os, urllib.parse
42+
43+
json_file = os.environ["SCCACHE_JSON"]
44+
label = os.environ["SCCACHE_LABEL"]
45+
build_step = os.environ.get("SCCACHE_BUILD_STEP", "")
46+
47+
with open(json_file) as f:
48+
stats = json.load(f)["stats"]
49+
50+
# compile_requests includes non-compilation calls (linker, etc).
51+
# Use cache_hits + cache_misses as the denominator to match sccache's
52+
# own "Cache hits rate" which only counts actual compilation requests.
53+
counted_languages = {"C/C++", "CUDA"}
54+
hits = sum(
55+
v for k, v in stats.get("cache_hits", {}).get("counts", {}).items()
56+
if k in counted_languages
57+
)
58+
misses = sum(
59+
v for k, v in stats.get("cache_misses", {}).get("counts", {}).items()
60+
if k in counted_languages
61+
)
62+
total = hits + misses
63+
pct = int(100 * hits / total) if total > 0 else 0
64+
65+
# Build a deep-link to the cibuildwheel step if step name is provided.
66+
# GHA step summary links use the format: #step:N:L but we can't know the
67+
# step number here. Instead, link to the job page with a search hint.
68+
link_note = ""
69+
if build_step:
70+
link_note = f"\n\n_Full stats in the **{build_step}** step log._\n"
71+
72+
summary_file = os.environ.get("GITHUB_STEP_SUMMARY", "")
73+
if summary_file:
74+
with open(summary_file, "a") as sf:
75+
sf.write(f"### 📊 {label} — sccache stats\n")
76+
sf.write("| Hit Rate | Hits | Misses | Requests |\n")
77+
sf.write("|----------|------|--------|----------|\n")
78+
sf.write(f"| {pct}% | {hits} | {misses} | {total} |{link_note}\n")
79+
80+
print(f"{label}: {pct}% hit rate ({hits}/{total})")
81+
PYEOF

.github/workflows/build-wheel.yml

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
# are exposed by this action.
4949
- name: Enable sccache
5050
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # 0.0.9
51+
with:
52+
disable_annotations: 'true'
5153

5254
# xref: https://github.com/orgs/community/discussions/42856#discussioncomment-7678867
5355
- name: Adding addtional GHA cache-related env vars
@@ -75,20 +77,26 @@ jobs:
7577

7678
- name: Set up MSVC
7779
if: ${{ startsWith(inputs.host-platform, 'win') }}
78-
uses: ilammy/msvc-dev-cmd@v1 # TODO: ask admin to allow pinning commits
80+
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
7981

8082
- name: Set up yq
8183
# GitHub made an unprofessional decision to not provide it in their Windows VMs,
8284
# see https://github.com/actions/runner-images/issues/7443.
8385
if: ${{ startsWith(inputs.host-platform, 'win') }}
8486
env:
85-
# doesn't seem there's an easy way to avoid hard-coding it?
86-
YQ_URL: https://github.com/mikefarah/yq/releases/latest/download/yq_windows_amd64.exe
87-
YQ_DIR: yq_latest
87+
YQ_VERSION: v4.52.5
88+
YQ_SHA256: 47594981f3848a4b4447494adeca9555f908f7cf0a89c4da3fd0243a4631da1c
89+
YQ_DIR: yq
8890
shell: pwsh -command ". '{0}'"
8991
run: |
92+
$yqUrl = "https://github.com/mikefarah/yq/releases/download/${env:YQ_VERSION}/yq_windows_amd64.exe"
9093
mkdir -Force -ErrorAction SilentlyContinue "${env:YQ_DIR}" | Out-Null
91-
Invoke-WebRequest -UseBasicParsing -OutFile "${env:YQ_DIR}/yq.exe" -Uri "$env:YQ_URL"
94+
Invoke-WebRequest -UseBasicParsing -OutFile "${env:YQ_DIR}/yq.exe" -Uri "$yqUrl"
95+
$hash = (Get-FileHash -Algorithm SHA256 "${env:YQ_DIR}/yq.exe").Hash.ToLower()
96+
if ($hash -ne $env:YQ_SHA256) {
97+
Write-Error "SHA256 mismatch for yq: expected $env:YQ_SHA256, got $hash"
98+
exit 1
99+
}
92100
ls -l $env:YQ_DIR
93101
echo "$((Get-Location).Path)\\$env:YQ_DIR" >> $env:GITHUB_PATH
94102
$env:Path += ";$((Get-Location).Path)\\$env:YQ_DIR"
@@ -175,13 +183,22 @@ jobs:
175183
CUDA_PYTHON_PARALLEL_LEVEL=${{ env.CUDA_PYTHON_PARALLEL_LEVEL }}
176184
# check cache stats before leaving cibuildwheel
177185
CIBW_BEFORE_TEST_LINUX: >
178-
"/host/${{ env.SCCACHE_PATH }}" --show-stats
186+
"/host/${{ env.SCCACHE_PATH }}" --show-stats &&
187+
"/host/${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_bindings.json
179188
# force the test stage to be run (so that before-test is not skipped)
180189
# TODO: we might want to think twice on adding this, it does a lot of
181190
# things before reaching this command.
182191
CIBW_TEST_COMMAND: >
183192
echo "ok!"
184193
194+
- name: Report sccache stats (cuda.bindings)
195+
if: ${{ inputs.host-platform != 'win-64' }}
196+
uses: ./.github/actions/sccache-summary
197+
with:
198+
json-file: sccache_bindings.json
199+
label: "cuda.bindings"
200+
build-step: "Build cuda.bindings wheel"
201+
185202
- name: List the cuda.bindings artifacts directory
186203
run: |
187204
if [[ "${{ inputs.host-platform }}" == win* ]]; then
@@ -233,13 +250,22 @@ jobs:
233250
PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})"
234251
# check cache stats before leaving cibuildwheel
235252
CIBW_BEFORE_TEST_LINUX: >
236-
"/host${{ env.SCCACHE_PATH }}" --show-stats
253+
"/host${{ env.SCCACHE_PATH }}" --show-stats &&
254+
"/host${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_core.json
237255
# force the test stage to be run (so that before-test is not skipped)
238256
# TODO: we might want to think twice on adding this, it does a lot of
239257
# things before reaching this command.
240258
CIBW_TEST_COMMAND: >
241259
echo "ok!"
242260
261+
- name: Report sccache stats (cuda.core)
262+
if: ${{ inputs.host-platform != 'win-64' }}
263+
uses: ./.github/actions/sccache-summary
264+
with:
265+
json-file: sccache_core.json
266+
label: "cuda.core"
267+
build-step: "Build cuda.core wheel"
268+
243269
- name: List the cuda.core artifacts directory and rename
244270
run: |
245271
if [[ "${{ inputs.host-platform }}" == win* ]]; then
@@ -412,13 +438,22 @@ jobs:
412438
PIP_FIND_LINKS="$(cygpath -w ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }})"
413439
# check cache stats before leaving cibuildwheel
414440
CIBW_BEFORE_TEST_LINUX: >
415-
"/host${{ env.SCCACHE_PATH }}" --show-stats
441+
"/host${{ env.SCCACHE_PATH }}" --show-stats &&
442+
"/host${{ env.SCCACHE_PATH }}" --show-stats --stats-format=json > /host/${{ github.workspace }}/sccache_core_prev.json
416443
# force the test stage to be run (so that before-test is not skipped)
417444
# TODO: we might want to think twice on adding this, it does a lot of
418445
# things before reaching this command.
419446
CIBW_TEST_COMMAND: >
420447
echo "ok!"
421448
449+
- name: Report sccache stats (cuda.core prev)
450+
if: ${{ inputs.host-platform != 'win-64' }}
451+
uses: ./.github/actions/sccache-summary
452+
with:
453+
json-file: sccache_core_prev.json
454+
label: "cuda.core (prev CTK)"
455+
build-step: "Build cuda.core wheel"
456+
422457
- name: List the cuda.core artifacts directory and rename
423458
run: |
424459
if [[ "${{ inputs.host-platform }}" == win* ]]; then

.github/workflows/coverage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
image: ubuntu:22.04
5151
env:
5252
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
53+
PIP_CACHE_DIR: "/tmp/pip-cache"
5354
steps:
5455
- name: Ensure GPU is working
5556
run: nvidia-smi

0 commit comments

Comments
 (0)