Skip to content

libcu++: __nv_atomic based atomics backend. - #11075

Draft
griwes wants to merge 27 commits into
NVIDIA:mainfrom
griwes:feature/atomic-nvvm-backend
Draft

libcu++: __nv_atomic based atomics backend.#11075
griwes wants to merge 27 commits into
NVIDIA:mainfrom
griwes:feature/atomic-nvvm-backend

Conversation

@griwes

@griwes griwes commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

Resolves #7480.

This PR introduces an alternative to the PTX atomics backend, based on the __nv_atomic family of intrinsics. It will be enabled starting with CTK 13.5.

These changes have been verified with the top of tree build of the compiler.

Please note that right now, this PR also includes the necessary commits of #10908, but will be rebased once that PR is merged.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

griwes added 25 commits August 27, 2026 14:47
…d-refactor-review

# Conflicts:
#	libcudacxx/codegen/generators/compare_and_swap.h
#	libcudacxx/codegen/generators/exchange.h
#	libcudacxx/codegen/generators/fence.h
#	libcudacxx/codegen/generators/fetch_ops.h
#	libcudacxx/codegen/generators/ld_st.h
#	libcudacxx/include/cuda/std/__atomic/functions/cuda_ptx_derived.h
#	libcudacxx/include/cuda/std/__atomic/functions/cuda_ptx_generated.h
@copy-pr-bot

copy-pr-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Progress in CCCL Sep 1, 2026
@griwes

griwes commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test b2bed6d

@github-actions

This comment has been minimized.

@copy-pr-bot

This comment was marked as resolved.

@griwes

griwes commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 5b72d8e

@github-actions

This comment has been minimized.

@griwes

griwes commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test f29671e

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 2h 16m: Pass: 100%/195 | Total: 1d 05h | Max: 51m 57s | Hits: 100%/471502

See results here.

Comment on lines +44 to +72
template <>
struct __cuda_atomic_nvvm_order<__cuda_atomic_order_relaxed>
{
static constexpr int __value = __NV_ATOMIC_RELAXED;
};

template <>
struct __cuda_atomic_nvvm_order<__cuda_atomic_order_release>
{
static constexpr int __value = __NV_ATOMIC_RELEASE;
};

template <>
struct __cuda_atomic_nvvm_order<__cuda_atomic_order_acquire>
{
static constexpr int __value = __NV_ATOMIC_ACQUIRE;
};

template <>
struct __cuda_atomic_nvvm_order<__cuda_atomic_order_acq_rel>
{
static constexpr int __value = __NV_ATOMIC_ACQ_REL;
};

template <>
struct __cuda_atomic_nvvm_order<__cuda_atomic_order_seq_cst>
{
static constexpr int __value = __NV_ATOMIC_SEQ_CST;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pretty sure those can be just inline variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Update cuda/atomic backend to be able to use new NVVM intrinsics when available

2 participants