← Back to Pull requests

Add WarpScan::Sum benchmark covering extended floating-point types #10768

Closed
unknown closed this pull request without merging on Sep 10, 2026 22:28 UTC
View on GitHub
unknown unknown commented on Aug 12, 2026 06:14 UTC
Author

Add WarpScan::Sum benchmark covering extended floating-point types

Addresses the warp-level part of item 2 in #9587.

Device-level Reduce/Scan/RadixSort coverage landed in #9708, and warp-level Reduce::Sum/Min
already carry __half and __nv_bfloat16. WarpScan had no benchmark at all under
cub/benchmarks/bench/, so this adds one.

What this adds

  • cub/benchmarks/bench/scan/warp_scan_base.cuh — the shared harness, mirroring

  • bench/reduce/warp_reduce_base.cuh: same benchmark_kernel<block_size, unroll_factor, ...>
    from device_side_benchmark.cuh, same occupancy-derived grid size, same block_size = 256 /
    unroll_factor = 128, same exec_tag::gpu | exec_tag::no_batch.
  • cub/benchmarks/bench/scan/warp_scan_sum.cu — the cuda::std::plus<> instantiation, with the

  • type axis copied from warp_reduce_sum.cu including its _CCCL_HAS_NVFP16() /
    _CCCL_HAS_NVBF16() / _CCCL_CTK_AT_LEAST(12, 2) guards.

    No CMake change is needed — cub/benchmarks/CMakeLists.txt globs bench/* recursively, so the
    new file registers itself as cub.bench.scan.warp_scan_sum.base.

    WarpScan::InclusiveScan writes through an out-parameter rather than returning, so the functor
    holds the result in a local and returns it, keeping the data = action(data) chain in
    benchmark_kernel intact. The op_t indirection is kept so a min/max variant can reuse the
    same base header the way warp_reduce_min.cu does.

    One deliberate difference from warp_reduce_base.cuh: the unused const int device local is not
    carried over.

    Validation

    Built and run locally on sm_86, CTK 13.3, g++-15. All 13 types on the axis execute, F16 and
    BF16 included:

    | T{ct} | Samples |  CPU Time  |  GPU Time  |
    |-------|---------|------------|------------|
    |    I8 |      1x | 396.800 us | 372.736 us |
    |   I16 |      1x | 378.207 us | 362.496 us |
    |   I32 |      1x | 365.484 us | 351.232 us |
    |   I64 |      1x | 626.257 us | 611.328 us |
    |  I128 |      1x |   4.908 ms |   4.892 ms |
    |   F16 |      1x | 376.423 us | 362.496 us |
    |  BF16 |      1x | 376.333 us | 361.472 us |
    |   F32 |      1x | 364.442 us | 350.208 us |
    |   F64 |      1x |   2.815 ms |   2.801 ms |
    |   C16 |      1x | 363.430 us | 347.136 us |
    |  CB16 |      1x | 356.167 us | 340.992 us |
    |   C32 |      1x | 620.968 us | 605.184 us |
    |   C64 |      1x |   5.597 ms |   5.577 ms |
    

    As a sanity check that the scan is not being optimized away, I ran this and
    cub.bench.reduce.warp_reduce_sum.base back to back and compared GPU times (µs):

    | | I8 | I32 | I64 | I128 | F16 | BF16 | F32 | F64 |
    |---|---|---|---|---|---|---|---|---|
    | warp_reduce_sum | 13.0 | 15.1 | 71.6 | 642 | 44.7 | 43.9 | 43.1 | 311 |
    | warp_scan_sum | 55.1 | 43.6 | 72.4 | 532 | 45.0 | 44.9 | 43.7 | 310 |

    Reduce is 3–4× faster for the small integer types, which lines up with warp_redux dispatching to
    redux.sync on sm_80+ where scan has no equivalent instruction; for the float and complex types
    the two track each other closely, as expected when both fall back to shuffle chains. Cost also
    scales with type width (I32 43.6 µs → I128 532 µs).

    Caveat on those numbers: this is a laptop GPU whose clocks idle far below nominal, so nvbench's
    throttle detector discarded every sample until I passed --throttle-threshold 0. Both binaries
    were measured back to back under identical conditions, so the comparison above is meaningful, but
    the absolute figures are not representative of the hardware and shouldn't be read as performance
    results. I only have sm_86, so I can't offer measurements on any other architecture.

    Question on the rest of #9587

    Items 1–3 also list Block-level coverage, but there are no block-level benchmarks in CUB at all
    right now — so that would mean adding the harness, not just extending a type axis. Is that intended
    to be part of this issue, or would you rather it were separate work? Happy to pick it up either
    way, I just didn't want to guess at the scope.

    Diff: 497 lines (+372 / -125) across 6 files Reviewer: Wint3rNight Review duration: 42734m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 497 lines diff across 6 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.372
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #10768"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.5% (MEDIUM) · Higher = larger blast radius
    47.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.8% · Safe to merge
    18.8%
    Repository