Repository navigation
Make bit_cast play nice with extended floating point types - #2434
Merged
Merged
Conversation
1 task done
Contributor
🟨 CI finished in 3h 45m: Pass: 99%/433 | Total: 5d 06h | Avg: 17m 28s | Max: 2h 03m | Hits: 59%/41657
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| pycuda | |
| CUDA C Core Library |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | pycuda |
| +/- | CUDA C Core Library |
🏃 Runner counts (total jobs: 433)
| # | Runner |
|---|---|
| 320 | linux-amd64-cpu16 |
| 62 | linux-amd64-gpu-v100-latest-1 |
| 28 | linux-arm64-cpu16 |
| 23 | windows-amd64-cpu16 |
Contributor
|
Another relevant problem with extended floating point types is arrays/containers/views of extended floating point __half array[5]A better solution could be modifying |
Contributor
🟩 CI finished in 2h 31m: Pass: 100%/364 | Total: 8d 15h | Avg: 34m 12s | Max: 1h 25m | Hits: 29%/25653
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| pycuda | |
| CUDA C Core Library |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | pycuda |
| +/- | CUDA C Core Library |
🏃 Runner counts (total jobs: 364)
| # | Runner |
|---|---|
| 297 | linux-amd64-cpu16 |
| 28 | linux-arm64-cpu16 |
| 24 | linux-amd64-gpu-v100-latest-1 |
| 15 | windows-amd64-cpu16 |
griwes
approved these changes
Sep 19, 2024
Contributor
That sounds like way too much overreach to still claim we are providing conforming extensions. |
Contributor
|
I somewhat agree. On the other hand, extend floating point types have flaws in the class design. Not sure what is the best solution. Without handling extend floating point types, we essentially cannot use |
wmaxey
pushed a commit
that referenced
this pull request
Oct 14, 2024
wmaxey
added a commit
that referenced
this pull request
Oct 15, 2024
* Fix `common_type` specialization for extended floating point types (#2483) * Fix `common_type` specialization for extended floating point types The machinery we had in place was not really suited to specialize `common_type` because it would take precendence over the actual implementation of `common_type` In that case, we only specialized `common_type<__half, __half>` but not `common_type<__half, __half&>` and so on. This shows how brittle the whole thing is and that it is not extensible. Rather than putting another bandaid over it, add a proper 5th step in the common_type detection that properly treats combinations of an extended floating point type with an arithmetic type. Allowing arithmetic types it necessary to keep machinery like `pow(__half, 2)` working. Fixes [BUG]: `is_common_type` trait is broken when mixing rvalue references #2419 * Work around MSVC declval bug * Disable system header for narrowing conversion check (#2465) There is an incredible compiler bug reported in nvbug4867473 where the use of system header changes the way some types are instantiated. The culprit seems to be that within a system header the compiler accepts narrowing conversions that it should not accept Work around it by moving __is_non_narrowing_convertible to its own header that is included before we define the system header machinery * Drop 2 relative includes that snuck in (#2492) * Fix popc.h when architecture is not x86 on MSVC. (#2524) * Fix popc when architecture is not x86 * Update libcudacxx/include/cuda/std/__bit/popc.h --------- Co-authored-by: Michael Schellenberger Costa <[email protected]> * Make `bit_cast` play nice with extended floating point types (#2434) * Move `__is_nvbf16` and `__is_nvfp16` to their own file * Make `bit_cast` play nice with extended floating point types --------- Co-authored-by: Michael Schellenberger Costa <[email protected]>
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.
Our extended floating point types do not behave nicely like other floating point types.
One of the issues is that they are not trivially copyable. This prevents us from using
bit_castwith them.However, there should be no reason we cannot use that, because they do effectively behave like floating point types.
So extend
bit_castto allow for them to be passed in. While we are there, move the detection of extended floating point types into its own file so that we do not need to include complexFixes #2422