Skip to content

[libcu++] Make fmin/fmax work for all nvfp types - #12612

Merged
miscco merged 2 commits into
NVIDIA:mainfrom
davebayer:support_fmin_fmax_always
Nov 12, 2026
Merged

miscco merged 2 commits into
NVIDIA:mainfrom
davebayer:support_fmin_fmax_always

Conversation

@davebayer

Copy link
Copy Markdown
Contributor

No description provided.

@davebayer
davebayer requested a review from a team as a code owner November 12, 2026 10:07
@davebayer
davebayer requested a review from pciolkosz November 12, 2026 10:07
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Nov 12, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Nov 12, 2026
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved floating-point min and max behavior for edge cases, including NaN values and signed zero.
    • Added support for more floating-point formats, including extended NVIDIA formats.

The generic floating-point fmax and fmin fallbacks now use comparison helpers. The tests add runtime-safe wrappers, capability-based checks, and feature-guarded coverage for additional floating-point formats.

Changes: Floating-point min/max

Layer / File(s) Summary
Comparison fallbacks
libcudacxx/include/cuda/std/__cmath/min_max.h
The generic fmax fallback uses isless, and the generic fmin fallback uses isgreater. The file includes the CUDA math traits header.
Min/max test coverage
libcudacxx/test/libcudacxx/std/numerics/c.math/fp_min_max.pass.cpp
The tests call fmax and fmin through wrappers that inhibit runtime optimization. NaN and infinity checks use numeric_limits capabilities. Runtime and constexpr tests add feature-guarded fp8, fp6, and fp4 coverage. The bfloat16 runtime test uses its own feature guard. CUDA Clang runs the int128 runtime tests on the host only.

Suggested reviewers: miscco, fbusato

Change: Bug fix

Merge Risk: Minimal · up to 208bd

This change makes fmin and fmax work for more nvfp types, with a small change to the fallback comparisons and expanded tests. No concrete merge-blocking risk was found.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: NVIDIA/cccl
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 40b5c84
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: cade19d2-555d-498a-883a-7ac02e70f2c4
Commits

Reviewing files that changed from the base of the PR and between 7883b9a and 208bdf9.

Files selected for processing: 1

  • libcudacxx/test/libcudacxx/std/numerics/c.math/fp_min_max.pass.cpp

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 2h 14m: Pass: 100%/230 | Total: 2d 12h | Max: 2h 14m | Hits: 84%/809240

See results here.

@miscco
miscco merged commit 852cde9 into NVIDIA:main Nov 12, 2026
251 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Nov 12, 2026
@davebayer
davebayer deleted the support_fmin_fmax_always branch November 12, 2026 14:11
miscco added a commit to miscco/cccl that referenced this pull request Nov 12, 2026
…DIA#12612

NVIDIA#12612 made `cuda::std::fmin` and `cuda::std::fmax` work for all extended
floating-point types by comparing with `cuda::std::isless` and
`cuda::std::isgreater`, and tests them in `fp_min_max.pass.cpp`. Drop our
storage order key and its tests. Values that compare equal, like -0 and +0,
now return the first argument instead of ordering -0 before +0.

Also test `cuda::min`, `cuda::max` and `cuda::clamp` with `__nv_fp8_ue5m3`,
which is supported since NVIDIA#12570.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants