Repository navigation
Start reworking our math functions - #2749
Merged
Merged
Conversation
miscco
force-pushed
the
fix_cmath_floatingpoint
branch
from
November 8, 2024 13:20
20d9767 to
1d1586e
Compare
1 task done
miscco
force-pushed
the
fix_cmath_floatingpoint
branch
4 times, most recently
from
November 8, 2024 15:26
8cc356d to
ca02b51
Compare
Collaborator
|
Can you elaborate more in the PR description what the problem is and how we're fixing it? |
miscco
force-pushed
the
fix_cmath_floatingpoint
branch
10 times, most recently
from
November 9, 2024 20:04
dba9ca6 to
5232d5d
Compare
Contributor
🟨 CI finished in 1h 59m: Pass: 99%/394 | Total: 3d 22h | Avg: 14m 23s | Max: 1h 29m | Hits: 24%/25910
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 394)
| # | Runner |
|---|---|
| 326 | linux-amd64-cpu16 |
| 28 | linux-arm64-cpu16 |
| 25 | linux-amd64-gpu-v100-latest-1 |
| 15 | windows-amd64-cpu16 |
miscco
force-pushed
the
fix_cmath_floatingpoint
branch
3 times, most recently
from
November 10, 2024 09:54
f6bbda3 to
f532080
Compare
Contributor
🟩 CI finished in 1h 31m: Pass: 100%/394 | Total: 2d 02h | Avg: 7m 43s | Max: 1h 27m | Hits: 86%/25910
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 394)
| # | Runner |
|---|---|
| 326 | linux-amd64-cpu16 |
| 28 | linux-arm64-cpu16 |
| 25 | linux-amd64-gpu-v100-latest-1 |
| 15 | windows-amd64-cpu16 |
miscco
force-pushed
the
fix_cmath_floatingpoint
branch
2 times, most recently
from
November 10, 2024 16:47
46cd2e4 to
c8d9671
Compare
Contributor
🟨 CI finished in 2h 09m: Pass: 96%/394 | Total: 7d 15h | Avg: 27m 56s | Max: 2h 06m | Hits: 41%/21163
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 394)
| # | Runner |
|---|---|
| 326 | linux-amd64-cpu16 |
| 28 | linux-arm64-cpu16 |
| 25 | linux-amd64-gpu-v100-latest-1 |
| 15 | windows-amd64-cpu16 |
miscco
force-pushed
the
fix_cmath_floatingpoint
branch
from
November 10, 2024 19:14
c8d9671 to
325923f
Compare
miscco
force-pushed
the
fix_cmath_floatingpoint
branch
5 times, most recently
from
November 22, 2024 09:20
7d342a4 to
acbc260
Compare
Contributor
🟨 CI finished in 1h 48m: Pass: 98%/396 | Total: 6d 09h | Avg: 23m 15s | Max: 1h 26m | Hits: 10%/22090
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 396)
| # | Runner |
|---|---|
| 327 | linux-amd64-cpu16 |
| 28 | linux-arm64-cpu16 |
| 26 | linux-amd64-gpu-v100-latest-1 |
| 15 | windows-amd64-cpu16 |
Contributor
🟩 CI finished in 3h 34m: Pass: 100%/396 | Total: 6d 11h | Avg: 23m 31s | Max: 1h 26m | Hits: 10%/22090
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 396)
| # | Runner |
|---|---|
| 327 | linux-amd64-cpu16 |
| 28 | linux-arm64-cpu16 |
| 26 | linux-amd64-gpu-v100-latest-1 |
| 15 | windows-amd64-cpu16 |
miscco
force-pushed
the
fix_cmath_floatingpoint
branch
from
November 25, 2024 12:12
acbc260 to
2863aa0
Compare
Contributor
🟩 CI finished in 2h 40m: Pass: 100%/396 | Total: 9d 17h | Avg: 35m 23s | Max: 1h 28m | Hits: 10%/22106
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 396)
| # | Runner |
|---|---|
| 327 | linux-amd64-cpu16 |
| 28 | linux-arm64-cpu16 |
| 26 | linux-amd64-gpu-v100-latest-1 |
| 15 | windows-amd64-cpu16 |
Comment on lines
+52
to
+63
| struct _CCCL_FLOAT_BITS | ||
| { | ||
| #if defined(_LIBCUDACXX_LITTLE_ENDIAN) | ||
| unsigned int man : 23; | ||
| unsigned int exp : 8; | ||
| unsigned int sign : 1; | ||
| #else // ^^^ _LIBCUDACXX_LITTLE_ENDIAN ^^^ / vvv _LIBCUDACXX_BIG_ENDIAN vvv | ||
| unsigned int sign : 1; | ||
| unsigned int exp : 8; | ||
| unsigned int man : 23; | ||
| #endif // _LIBCUDACXX_BIG_ENDIAN | ||
| }; |
Contributor
There was a problem hiding this comment.
AFAIK, the layout of bitfields is implementation defined:
Allocation of bit-fields within a class object is implementation-defined. Alignment of bit-fields is implementation-defined.
Note 1: Bit-fields straddle allocation units on some machines and not on others. Bit-fields are assigned right-to-left on some machines, left-to-right on others — end note
I don't think we can portably reinterpret an FP type as a bitfield :S
Comment on lines
+68
to
+69
| unsigned int manl : 32; | ||
| unsigned int manh : 20; |
Contributor
There was a problem hiding this comment.
I assume this is not an uint64_t to optimize for device code?
Co-authored-by: Bernhard Manfred Gruber <[email protected]>
bernhardmgruber
approved these changes
Nov 25, 2024
Contributor
🟩 CI finished in 3h 21m: Pass: 100%/396 | Total: 2d 18h | Avg: 10m 05s | Max: 1h 21m | Hits: 77%/22106
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 396)
| # | Runner |
|---|---|
| 327 | linux-amd64-cpu16 |
| 28 | linux-arm64-cpu16 |
| 26 | linux-amd64-gpu-v100-latest-1 |
| 15 | windows-amd64-cpu16 |
davebayer
pushed a commit
to davebayer/cccl
that referenced
this pull request
Dec 2, 2024
* Move cmath helpers to `__cmath` subfolder * Drop unused functions * Move `lerp` to its own file * Properly qualify function calls in cmath * Move definition of logarithms into their own file and implement them on our own * Move definition of fp min max to its own file * Move definition of floating point trait functions to their own file * Improve tests to ensure we are not constant folding everything * Also port `fpclassify` to enable proper `isnormal` implementation Co-authored-by: Bernhard Manfred Gruber <[email protected]>
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We lack a lot of coverage for extended floating point types. This leads to a lot of the cmath functions being undefined for
__halfand__nv_bfloat16Even worse, it turns out a ton of our machinery doesnt even work properly because we do pull in host only functions. That leads to a ton of error messages like:
This starts moving towards using our own implementations of basic math functions, that use a builtin when available but fall back to the host definition otherwise.
For device we use functions from the CRT or implement them ourself