Skip to content

Commit 7b370b4

Browse files
authored
Fix sccache summary to count CUDA sub-tool cache hits (#2046)
The rapidsai/sccache fork tracks CUDA compilation sub-phases under separate language keys in the JSON stats: "CUDA" (nvcc driver), "CUDA (Device code)" (cudafe++), "PTX" (cicc), and "CUBIN" (ptxas). The summary script only counted the "CUDA" key, which represents just the top-level nvcc pass and typically shows 0 cache hits. All the actual cache hits land in the sub-tool categories. This caused the step summary to report 0% hit rate even when sccache's own stats showed ~34%. Include all CUDA-related language keys so the reported rate matches sccache's own "Cache hits rate" output.
1 parent 8869a26 commit 7b370b4

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

.github/actions/sccache-summary/action.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ name: sccache summary
66
description: Parse sccache stats JSON and write a summary table to GITHUB_STEP_SUMMARY
77

88
# 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).
119

1210
inputs:
1311
json-file:
@@ -47,10 +45,11 @@ runs:
4745
with open(json_file) as f:
4846
stats = json.load(f)["stats"]
4947
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"}
48+
# compile_requests only counts top-level nvcc invocations, but each
49+
# invocation spawns sub-tool compilations (cudafe++, cicc, ptxas) that
50+
# sccache tracks under separate language keys. Count all of them so
51+
# the reported rate matches sccache's own "Cache hits rate".
52+
counted_languages = {"C/C++", "CUDA", "CUDA (Device code)", "PTX", "CUBIN"}
5453
hits = sum(
5554
v for k, v in stats.get("cache_hits", {}).get("counts", {}).items()
5655
if k in counted_languages

0 commit comments

Comments
 (0)