Skip to content

Workaround for __builtin_fmaxf/fminf in clang+Arm64 (nightly build failure) - #11496

Merged
fbusato merged 2 commits into
NVIDIA:mainfrom
fbusato:fic-gma-fmin-arm-nightly
Sep 21, 2026
Merged

fbusato merged 2 commits into
NVIDIA:mainfrom
fbusato:fic-gma-fmin-arm-nightly

Conversation

@fbusato

@fbusato fbusato commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Description

Clang lowers fmax/fmin to AArch64 HW instructions, which returns quite NaN instead of signaling NaNs. Releted LLVM issue llvm/llvm-project#176624

@fbusato fbusato self-assigned this Sep 18, 2026
@fbusato
fbusato requested a review from a team as a code owner September 18, 2026 17:23
@fbusato
fbusato requested a review from pciolkosz September 18, 2026 17:23
@fbusato fbusato added this to CCCL Sep 18, 2026
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Sep 18, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Sep 18, 2026
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/cccl/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 24ff7147-f857-4578-83ec-942789ade646

📥 Commits

Reviewing files that changed from the base of the PR and between 2c9db0f and 0915f91.

📒 Files selected for processing (1)
  • libcudacxx/include/cuda/std/__cmath/min_max.h

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved floating-point minimum and maximum handling on ARM64 systems when one operand is NaN.
    • Ensured the non-NaN operand is returned in affected cases while preserving existing behavior for other platforms and inputs.

Walkthrough

The change adds host ARM64 Clang-specific NaN checks to __with_builtin_fmax and __with_builtin_fmin. Each function returns the other operand when one operand is NaN. Other configurations and non-NaN inputs retain the builtin path.

Changes

ARM64 NaN handling

Layer / File(s) Summary
ARM64 Clang NaN guards
libcudacxx/include/cuda/std/__cmath/min_max.h
__with_builtin_fmax and __with_builtin_fmin check operands for NaN on host ARM64 Clang. Each function returns the non-NaN operand before calling the builtin. Other paths retain the existing builtin implementation.

Priority: ⬇️ Low

Change: Bug fix


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 83d91acc-d041-483c-9ba8-a635fc1f7984

📥 Commits

Reviewing files that changed from the base of the PR and between 2fcc3f0 and 2c9db0f.

📒 Files selected for processing (1)
  • libcudacxx/include/cuda/std/__cmath/min_max.h

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Comment thread libcudacxx/include/cuda/std/__cmath/min_max.h
@github-actions

This comment has been minimized.

@miscco miscco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why is this not changing fmin when that is also affected?

@fbusato

fbusato commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Question: Why is this not changing fmin when that is also affected?

the last commit was not pushed. Thanks for reminding me!

@fbusato
fbusato enabled auto-merge (squash) September 21, 2026 16:40
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 3h 08m: Pass: 100%/221 | Total: 3d 02h | Max: 1h 57m | Hits: 99%/607373

See results here.

@fbusato
fbusato merged commit 73c04f8 into NVIDIA:main Sep 21, 2026
492 of 495 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Sep 21, 2026
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