Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Backports to C++11 of <bit> #237

Merged
merged 15 commits into from
Feb 16, 2022
Merged

Backports to C++11 of <bit> #237

merged 15 commits into from
Feb 16, 2022

Conversation

wmaxey
Copy link
Member

@wmaxey wmaxey commented Dec 16, 2021

<cuda/std/bit> - C++20 backport of bit manipulation intrinsics

Allows manipulation of unsigned values using <bit>

Details

Motivation

  • CUDA has intrinsics for popc/clz/ctz but they differ from host compiler builtins. Libcu++ has an opportunity to unify host and device code for these intrinsics.
  • int128 in device code is not able to make use of CUDA intrinsics, this backport provides a general method for users to manipulate wider values.

Impact

  • Backports of to C++11 requires that most functions are minimized into one statement, this impacts readability of the header.
  • Conditional use of is_constant_evaluated is required to improve performance where possible.
  • Test coverage should remain the same, except for added coverage in C++11 and up.

Checklists

Testing

  • Bug fixes have regression tests that would reproduce the bug.
  • New features should have correctness tests to validate behavior.
  • Benchmarks have been added to monitor performance of new features. (not required)

@wmaxey wmaxey marked this pull request as draft December 16, 2021 01:00
@wmaxey wmaxey added this to the 1.8.0 milestone Jan 31, 2022
@wmaxey wmaxey changed the title WIP: Backports to C++11 of <bit> Backports to C++11 of <bit> Feb 2, 2022
@wmaxey wmaxey self-assigned this Feb 11, 2022
@wmaxey wmaxey marked this pull request as ready for review February 11, 2022 21:09
@wmaxey wmaxey added the testing: internal ci passed Passed internal NVIDIA CI (DVS). label Feb 11, 2022
Copy link
Collaborator

@griwes griwes left a comment

Choose a reason for hiding this comment

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

I assume that the bit fiddling in here works and is verified by tests.

In addition to the inline comment - rename the tests in libcxx/test to match the names that actually ended up in the standard.

@wmaxey wmaxey force-pushed the feature/bit_backports branch from f27c861 to bf3c697 Compare February 15, 2022 02:26
@wmaxey wmaxey force-pushed the feature/bit_backports branch from 5617f62 to 2ece95a Compare February 16, 2022 01:31
@wmaxey wmaxey merged commit dd8d7be into main Feb 16, 2022
@wmaxey wmaxey deleted the feature/bit_backports branch February 16, 2022 02:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
testing: internal ci passed Passed internal NVIDIA CI (DVS).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants