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

Clang + LLVM-libc Sharing Code for Floating Point Operations #114109

Open
5 tasks
michaelrj-google opened this issue Oct 29, 2024 · 3 comments
Open
5 tasks

Clang + LLVM-libc Sharing Code for Floating Point Operations #114109

michaelrj-google opened this issue Oct 29, 2024 · 3 comments
Labels
floating-point Floating-point math libc

Comments

@michaelrj-google
Copy link
Contributor

Proposed name for this project: Hand-Eye Coordination

This is a tracking issue for the overall effort.

Summary: Clang needs support for math functions on APFloat for two main uses - compile time constant folding, and providing constexpr builtins for libc++. We can't just call the host platform's libc since it may not match the behavior of the libc on the target platform. Based on Project Hand-In-Hand we hope to be able to reuse code from LLVM-libc for this purpose.

Current TODOs (edit as needed):

  • Create an RFC for this project
    • Specify the utilities that clang needs, and explain how they're different from the standard libc interface
    • Explain the potential issues (e.g. runtime rounding modes, fast math)
    • Propose a design for how this will actually work
  • update this list once we have a design

cc: @AaronBallman @lntue @nickdesaulniers @vonosmas

@michaelrj-google michaelrj-google added libc floating-point Floating-point math labels Oct 29, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Oct 29, 2024

@llvm/issue-subscribers-libc

Author: Michael Jones (michaelrj-google)

Proposed name for this project: Hand-Eye Coordination

This is a tracking issue for the overall effort.

Summary: Clang needs support for math functions on APFloat for two main uses - compile time constant folding, and providing constexpr builtins for libc++. We can't just call the host platform's libc since it may not match the behavior of the libc on the target platform. Based on Project Hand-In-Hand we hope to be able to reuse code from LLVM-libc for this purpose.

Current TODOs (edit as needed):

  • Create an RFC for this project
    • Specify the utilities that clang needs, and explain how they're different from the standard libc interface
    • Explain the potential issues (e.g. runtime rounding modes, fast math)
    • Propose a design for how this will actually work
  • update this list once we have a design

cc: @AaronBallman @lntue @nickdesaulniers @vonosmas

@jcranmer-intel
Copy link
Contributor

Summary: Clang needs support for math functions on APFloat for two main uses - compile time constant folding, and providing constexpr builtins for libc++. We can't just call the host platform's libc since it may not match the behavior of the libc on the target platform. Based on Project Hand-In-Hand we hope to be able to reuse code from LLVM-libc for this purpose.

It's more than just clang; llvm should be able to rely on it too. APFloat itself is mostly owned by LLVM rather than Clang.

@c8ef
Copy link
Contributor

c8ef commented Oct 30, 2024

Summary: Clang needs support for math functions on APFloat for two main uses - compile time constant folding, and providing constexpr builtins for libc++. We can't just call the host platform's libc since it may not match the behavior of the libc on the target platform. Based on Project Hand-In-Hand we hope to be able to reuse code from LLVM-libc for this purpose.

It's more than just clang; llvm should be able to rely on it too. APFloat itself is mostly owned by LLVM rather than Clang.

It would be great if constant folding libcall could utilize these utilities instead of directly calling the host libc and checking each libcall to ensure there is no under/overflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
floating-point Floating-point math libc
Projects
None yet
Development

No branches or pull requests

4 participants