[INFRA] Import NVIDIA/CCCL upstream as optimization reference library

CCCL (CUDA C++ Core Libraries) provides:
- CUB: device/block/warp-level GPU primitives (reduce, scan, sort, topk)
- Thrust: high-level parallel algorithms (transform_reduce, sort, scan)
- libcudacxx: CUDA C++ standard library (atomics, barriers, memory)
- cudax: experimental features (memory resources, allocators)
- Tuning policies: per-SM hardware-specific algorithm parameters

Competition optimization vectors mapped to CCCL:
- Output TPS (83% weight): warp_reduce, block_reduce, device_topk
- Input TPS (14% weight): device_scan, block_load, prefetch
- Cache TPS (3% weight): prefix caching strategy patterns
- Memory (0.9 util): pooled/cached/buddy allocators

Source: https://github.com/NVIDIA/cccl (shallow clone, HEAD only)
License: Apache-2.0
This commit is contained in:
EngineX CI
2026-07-30 09:35:51 +00:00
parent b4d01f481e
commit 56fd68e7dd
8871 changed files with 1454674 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,95 @@
# Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
from __future__ import annotations
import pytest
from host_benchmark_cases import (
CALL_CASES,
CASES,
HostBenchmarkCase,
patch_wrapper_to_skip_native_compute,
synchronize,
)
import cuda.compute as cc
pytest.importorskip("pytest_benchmark")
BUILD_TIME_ROUNDS = 10
ONESHOT_ROUNDS = 20
ONESHOT_ITERATIONS = 100
TWOSHOT_ROUNDS = 20
TWOSHOT_ITERATIONS = 1000
def _case_params(cases: list[HostBenchmarkCase]) -> list[pytest.ParameterSet]:
params = []
for case in cases:
marks = []
if case.skip_reason is not None:
marks.append(pytest.mark.skip(reason=case.skip_reason))
params.append(pytest.param(case, id=case.name, marks=marks))
return params
@pytest.mark.benchmark(group="cuda.compute.host.build_time")
@pytest.mark.parametrize("case", _case_params(CASES))
def test_build_time(benchmark, case: HostBenchmarkCase):
state = case.setup()
synchronize()
def setup() -> None:
cc.clear_all_caches()
def build():
return case.make_wrapper(state)
benchmark.pedantic(
build,
setup=setup,
rounds=BUILD_TIME_ROUNDS,
iterations=1,
warmup_rounds=0,
)
@pytest.mark.benchmark(group="cuda.compute.host.oneshot_cached")
@pytest.mark.parametrize("case", _case_params(CALL_CASES))
def test_oneshot_cached_host_overhead(benchmark, case: HostBenchmarkCase):
cc.clear_all_caches()
state = case.setup()
wrapper = case.make_wrapper(state)
patch_wrapper_to_skip_native_compute(wrapper, case.noop_return_kind)
synchronize()
def call() -> None:
case.oneshot(state)
benchmark.pedantic(
call,
rounds=ONESHOT_ROUNDS,
iterations=ONESHOT_ITERATIONS,
warmup_rounds=0,
)
@pytest.mark.benchmark(group="cuda.compute.host.twoshot_call")
@pytest.mark.parametrize("case", _case_params(CALL_CASES))
def test_twoshot_call_host_overhead(benchmark, case: HostBenchmarkCase):
cc.clear_all_caches()
state = case.setup()
wrapper = case.make_wrapper(state)
patch_wrapper_to_skip_native_compute(wrapper, case.noop_return_kind)
synchronize()
def call() -> None:
case.twoshot(state, wrapper)
benchmark.pedantic(
call,
rounds=TWOSHOT_ROUNDS,
iterations=TWOSHOT_ITERATIONS,
warmup_rounds=0,
)