Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor limits and climits #3221

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

davebayer
Copy link
Contributor

@davebayer davebayer commented Dec 30, 2024

This PR implements refactor of limits and climits modules.

Changes:

  • builtins for huge_val, nan and nans are defined in the standard way and moved to __cccl/builtin.h module
  • limits and climits are implemented directly in the header instead of detail/libcxx/include/
  • __cuda/climits_prelude.h's contents are moved to climits
  • removed repetitive implementation of numeric_limits
  • use bit_cast for inf and nan when no builtin is supported

@davebayer davebayer requested review from a team as code owners December 30, 2024 10:06
Copy link

copy-pr-bot bot commented Dec 30, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

libcudacxx/include/cuda/std/climits Outdated Show resolved Hide resolved
Comment on lines +329 to +331
#elif _CCCL_COMPILER(MSVC)
# define _CCCL_BUILTIN_NANSL(...) static_cast<long double>(__builtin_nans(__VA_ARGS__))
#endif // _CCCL_CHECK_BUILTIN(builtin_nansl)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This wont work for older MSVC compiler < 19.34 which we still support, so I believe we need to add an elif branch for that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tested it on godbolt and it seems to be working fine.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you also check that they work with nvcc? Could be that there was some issue on that sid?

libcudacxx/include/cuda/std/limits Show resolved Hide resolved
libcudacxx/include/cuda/std/limits Outdated Show resolved Hide resolved
@miscco
Copy link
Collaborator

miscco commented Jan 2, 2025

/ok to test

};

_CCCL_DIAG_PUSH
_CCCL_DIAG_SUPPRESS_MSVC(4309)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a comment what that warning is about? we try to better document those cases

@miscco
Copy link
Collaborator

miscco commented Jan 3, 2025

/ok to test

@davebayer davebayer requested a review from a team as a code owner January 3, 2025 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

2 participants