llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[gsoc2024][libc][math][c23] Implement _Float16 higher math functions

Open overmighty opened this issue 2 years ago • 22 comments

This issue is part of the following Google Summer of Code 2024 project: https://summerofcode.withgoogle.com/programs/2024/projects/1vPVUj93.

  • [x] acosf16: #127731
  • [x] acoshf16: #130588
  • [X] acospif16: #134664
  • [X] asinf16: #124212
  • [x] asinhf16: #131351
  • [x] asinpif16: #132210
  • [x] atanf16: #130947
  • [ ] atan2f16: #180969
  • [ ] atan2pif16: #133739
  • [x] atanhf16: #132612
  • [x] atanpif16: #132212
  • [ ] cbrtf16: #132484
  • [ ] compoundnf16
  • [x] cosf16: #118785
  • [x] coshf16: #105947
  • [x] cospif16: #113001
  • [ ] erff16: #133112
  • [ ] erfcf16: #180927
  • [x] expf16: #100632
  • [x] exp10f16: #101588
  • [x] exp10m1f16: #105706
  • [x] exp2f16: #101217
  • [x] exp2m1f16: #105690
  • [x] expm1f16: #102387
  • [x] fmaf16: #130757
  • [x] f16sqrt (extension): #96642
  • [x] f16sqrtf (extension): #95251
  • [x] f16sqrtl (extension): #96642
  • [x] f16sqrtf128: #96642
  • [x] hypotf16: #131991
  • [ ] lgammaf16
  • [x] logf16: #106072
  • [x] log10f16: #106091
  • [ ] log10p1f16: #133202
  • [ ] log1pf16
  • [x] log2f16: #106084
  • [ ] log2p1f16
  • [ ] logp1f16
  • [ ] powf16: #132198
  • [ ] pownf16
  • [ ] powrf16
  • [ ] rootnf16
  • [x] rsqrtf16: #132818
  • [x] sinf16: #116674
  • [ ] sincosf16 (extension)
  • [x] sinhf16: #105947
  • [x] sinpif16: #110994
  • [x] sqrtf16: #112406
  • [x] tanf16: #121018
  • [x] tanhf16: #106006
  • [x] tanpif16: #115183
  • [ ] tgammaf16

overmighty avatar Jun 12 '24 13:06 overmighty

Are there any plans for LLVM to lower to these intrinsics, or does it already ever? Or is this just making the functions available for calling directly.

tgross35 avatar Oct 26 '24 20:10 tgross35

Are there any plans for LLVM to lower to these intrinsics, or does it already ever? Or is this just making the functions available for calling directly.

Sorry for the late reply. I have been told there are plans to at some point have LLVM call LLVM libc math functions for computations internally, and later have LLVM lower to calls to these functions too.

overmighty avatar Nov 09 '24 22:11 overmighty

Lowering to these functions may be nice since it provides a way to get correctly rounded f16 results without correctly rounded f32 results (likely meaning performance wins on platforms where hardware f64 is slower than f32 or unavailable) but it does add some complexity. If this is done, I would appreciate the ability for frontends to specify which f16 symbols are available so it is possible to provide only a subset. For example, the frontend could configure that only sinf16, cosf16, and tanf16 are available and LLVM should use those where possible, but all other math operations will still lower to f32 versions with conversions.

tgross35 avatar Jan 27 '25 11:01 tgross35

I noticed that some of the functions were not implemented and I would like to ask if people are still needed to implement them.

wang-zhuoran avatar Mar 10 '25 18:03 wang-zhuoran

I noticed that some of the functions were not implemented and I would like to ask if people are still needed to implement them.

Help is always welcome, but I'm not sure which functions to recommend you work on.

overmighty avatar Mar 12 '25 09:03 overmighty

I noticed that some of the functions were not implemented and I would like to ask if people are still needed to implement them.

Help is always welcome, but I'm not sure which functions to recommend you work on.

I can work on implementing atanf16. Could you assign this to me? Thanks!

wang-zhuoran avatar Mar 12 '25 10:03 wang-zhuoran

Could you leave a comment on #130947? It looks like I can't assign you to it otherwise.

overmighty avatar Mar 12 '25 11:03 overmighty

@overmighty I believe asinf16 should be checked as it has been done here https://github.com/llvm/llvm-project/pull/124212

Additionally, I'd like to work on asinhf16.

meltq avatar Mar 12 '25 17:03 meltq

@overmighty I believe asinf16 should be checked as it has been done here #124212

Correct.

Additionally, I'd like to work on asinhf16.

Please leave a comment on https://github.com/llvm/llvm-project/issues/131001 so that I can assign you to it.

overmighty avatar Mar 12 '25 18:03 overmighty

@overmighty I just noticed that dsqrtf16 and fsqrtf16 are in this list. They should be removed because they are supposed to have narrower output types.

lntue avatar Mar 14 '25 03:03 lntue

Right, fixed.

overmighty avatar Mar 14 '25 14:03 overmighty

Hey @overmighty , I would like to try powf16, could i ?

StarOne01 avatar Mar 20 '25 09:03 StarOne01

Hi! I'd like to try cbrtf16

krishna2803 avatar Mar 20 '25 10:03 krishna2803

Sure.

Hey @overmighty , I would like to try powf16, could i ?

Please leave a comment on https://github.com/llvm/llvm-project/issues/132198 so that I can assign you to it.

Hi! I'd like to try cbrtf16

Please leave a comment on https://github.com/llvm/llvm-project/issues/132199 so that I can assign you to it.

overmighty avatar Mar 20 '25 12:03 overmighty

hi! @overmighty i'd like to work on erff16, please assign

krishna2803 avatar Mar 25 '25 23:03 krishna2803

hi! @overmighty i'd like to work on erff16, please assign

Please leave a comment on #133112.

overmighty avatar Mar 26 '25 16:03 overmighty

Hi @overmighty, I want to work on atan2pif16, Can you open a issue and assign that to me? Thanks

wsehjk avatar Mar 31 '25 15:03 wsehjk

Hi @overmighty, I want to work on atan2pif16, Can you open a issue and assign that to me? Thanks

Sure, please leave a comment on https://github.com/llvm/llvm-project/issues/133739 so that GitHub lets me assign you to it.

overmighty avatar Mar 31 '25 15:03 overmighty

Hi, I'd be interested to work on implementing atan2f16. Cloud u please open a issue and assign to me? thanks~

Xinlong-Chen avatar Feb 11 '26 15:02 Xinlong-Chen

Hi, I'd be interested to work on implementing atan2f16. Cloud u please open a issue and assign to me? thanks~

Sure, please leave a comment on https://github.com/llvm/llvm-project/issues/180969 so I can assign you to it.

overmighty avatar Feb 11 '26 16:02 overmighty