← Back to Pull requests

FP component housekeeping ahead of the `cuda::` promotion #11738

Closed
unknown closed this pull request without merging on Oct 05, 2026 07:19 UTC
View on GitHub
unknown unknown commented on Sep 29, 2026 18:57 UTC
Author

FP component housekeeping ahead of the cuda:: promotion

Nine independent cleanups to the FP component (<cuda/fpmp>, <cuda/fpemu>,
<cuda/fptool>), collected while the component is still in cuda::experimental
and the namespace contents are cheap to change. Each commit stands alone and is
reviewable on its own; the list below is in apply order.

Namespace and macro hygiene


  • Unify the fpemu guard-bit count on _CCCL_FPEMU_EXTRA_BITS. The count of 9

  • was spelled three ways, one of them a bare EXTRA_BITS that <cuda/fpemu>
    leaked into the translation unit and that an #ifndef let a user silently
    redefine, changing the emulated arithmetic.
  • Keep libm out of the component's namespace, and ::-qualify every global

  • call.
    sqrt, sqrtf and fma were declared inside the namespace, so C
    linkage made them aliases of libm; after the promotion cuda::sqrt(2.0) would
    have reached libm and any later C++-linkage cuda::sqrt would have been a hard
    conflict.

    Public surface


  • Specialize numeric_limits for fpemu, fpemu_unpacked and fp_custom.

  • Half the FP types previously fell back to the unspecialized primary template.
  • Merge <cuda/fpmp_math> into <cuda/fpmp>. The split saved a couple of

  • percent of compile time on our largest translation unit, which does not justify
    a second entry point in the root include directory.
  • Put fptool behind CCCL_ENABLE_FPTOOL. Both fptool types carry mutable

  • state at namespace scope — fp_custom's runtime field sizes and
    fpmp2_stat's counter record — as variable templates, so one copy is shared
    across translation units. An #include left behind after an experiment would
    otherwise carry that state, and the per-operation atomic traffic with it, into
    a shipping binary.

    Behavior


  • Renormalize when converting a value out of low accuracy. The low algorithms

  • omit the closing normalization, so their results may carry overlapping limbs,
    while mid and high are written against the non-overlap bound on their inputs.
    The mixed-accuracy pattern therefore depended on a renormalize() the caller
    had to remember. The conversion now does it; the step is exact, so the number
    never changes, only how it is stored. Explicit customer request.

    CUDA runtime → cuda::


  • Copy through cuda::copy_bytes in the headers. Six cudaMemcpyAsync sites

  • in fptool_custom.h and fptool_stat.h, so the FP headers no longer name a
    runtime entry point. The three that read a host object which does not outlive
    the call now ask for source_access_order::during_api_call.
  • Drive the FP unit tests through cuda::. Memory pools and buffers,

  • copy_bytes, cuda::launch and stream.sync() in place of cudaMalloc,
    cudaMemcpy, <<<>>> and a cudaGetLastError check after each one, so the
    tests read the way a user of the component would write them.
  • Drop the stack-limit bump from the fpemu example. The last runtime call in

  • the FP examples, and it buys nothing: ptxas reports a 0-byte frame for both
    kernels at -O3, and the -G build has no recursion or indirect calls, so the
    driver sizes the stack itself.

    Breaking changes

    Three items are user-visible:

  • <cuda/fpmp_math> is removed — include <cuda/fpmp>, which now provides the

  • math functions.
  • <cuda/fptool> requires -DCCCL_ENABLE_FPTOOL, project-wide. Without it the

  • header emits an #error explaining why.
  • Customer request: converting a low-accuracy value to mid or high now renormalizes, so

  • mixed-accuracy code that previously omitted renormalize() will produce
    different — better — results.

    Testing

    Unit tests pass across host, device and NVRTC at C++17 and C++20; examples and
    benchmarks build and run. The numerically inert changes were checked by
    reproducing prior results rather than only by compiling: the pi benchmark
    reproduces its value and digit count at every accuracy level.

    Full CI is green on B200, B300, RTX PRO 6000 Blackwell and L40S. GH200 is
    currently unavailable and still to run, though nothing here is
    architecture-sensitive.

    Diff: 524 lines (+393 / -131) across 6 files Reviewer: davebayer Review duration: 7942m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 524 lines diff across 6 files
    0.48
    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.375
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #11738"
    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.8% (MEDIUM) · Higher = larger blast radius
    47.8%
    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.9% · Safe to merge
    18.9%
    Repository