This directory contains the scripts used by .github/workflows/bench.yml to compare benchmark results between two code states.
ci/bench/bench.sh: CI-oriented wrapper that callsci/bench/compare_git_refs.sh.ci/bench/compare_git_refs.sh: checks out<base-ref>and<test-ref>in temporary worktrees, then forwards all remaining args toci/bench/compare_paths.sh.ci/bench/compare_paths.sh: configures/builds/runs CUB benchmarks and/or Python benchmarks in two source trees and runs comparison tools on produced JSON outputs.ci/bench/parse_bench_matrix.sh: parsesci/bench.yamland emits a dispatch matrix JSON object for.github/workflows/bench.yml.
Compare CUB benchmarks between two refs:
"./ci/bench/bench.sh" "origin/main" "HEAD" \
--cub-filter "^cub\\.bench\\.copy\\.memcpy\\.base$"Compare Python benchmarks between two refs:
"./ci/bench/bench.sh" "origin/main" "HEAD" \
--python-filter "compute/reduce/sum\\.py"Run both CUB and Python benchmarks:
"./ci/bench/bench.sh" \
"origin/main" \
"HEAD" \
--arch "native" \
--nvbench-args "..." \
--cub-filter "^cub\\.bench\\.reduce\\..*$" \
--python-filter "compute/reduce/sum\\.py"Compare already checked-out trees:
"./ci/bench/compare_paths.sh" \
"/path/to/base/cccl" \
"/path/to/test/cccl" \
--arch "native" \
--cub-filter "^cub\\.bench\\.copy\\.memcpy\\.base$" \
--python-filter "compute/transform/.*\\.py"In .github/workflows/bench.yml:
- If
raw_argsis non-empty, it is parsed and passed directly toci/bench/bench.sh. - Otherwise, args are assembled from
base_ref,test_ref,arch,cub_filters,python_filters,nvbench_args, andnvbench_compare_args. - CUB filters are passed as
--cub-filterflags. Python filters are passed as--python-filterflags. - Malformed quoted input (for example unmatched quotes) fails the workflow step.
Python benchmarks live under python/cuda_cccl/benchmarks/ and use cuda.bench (the Python nvbench bindings). Each benchmark script outputs nvbench-compatible JSON.
For Python benchmarks, compare_paths.sh:
- Creates isolated virtual environments for base and test trees.
- Installs
cuda-cccl[bench-cuXX](editable, from each worktree), which pulls incuda-bench,cupy, and all other benchmark dependencies. - Runs matching benchmark scripts in each venv.
- Compares results using
nvbench-compare(installed withcuda-bench).
Python filters are regex patterns matched against relative paths under python/cuda_cccl/benchmarks/, for example:
compute/reduce/sum\.py— single benchmarkcompute/transform/.*\.py— all transform benchmarkscoop/_experimental/.*\.py— all coop benchmarks
compare_paths.sh writes a run directory under ${CCCL_BENCH_ARTIFACT_ROOT:-$(pwd)/bench-artifacts} containing:
- per-target JSON and markdown outputs for base/test runs,
- grouped build logs (
build.base.log,build.test.log), per-target run logs, and per-target compare logs (compare.<target>.log), - Python venv setup logs (
py.venv.base.log,py.venv.test.log), summary.mdwith run metadata and per-target collapsible full compare reports.