Skip to content

[libcu++] Fix cuda::std::aligned_alloc argument order#9728

Open
davebayer wants to merge 1 commit into
NVIDIA:mainfrom
davebayer:fix_aligned_alloc_order
Open

[libcu++] Fix cuda::std::aligned_alloc argument order#9728
davebayer wants to merge 1 commit into
NVIDIA:mainfrom
davebayer:fix_aligned_alloc_order

Conversation

@davebayer

@davebayer davebayer commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This is bad, we had the argument order swapped..

@davebayer davebayer requested a review from a team as a code owner July 7, 2026 11:10
@davebayer davebayer requested a review from Jacobfaib July 7, 2026 11:10
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Jul 7, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Jul 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c541988e-b3ea-422a-bfe1-b683b0f62d96

📥 Commits

Reviewing files that changed from the base of the PR and between e0a0e23 and 8cf758a.

📒 Files selected for processing (3)
  • c/parallel.v2/src/hostjit/include/hostjit/cuda_minimal/stubs/cuda/std/__cstdlib/aligned_alloc.h
  • libcudacxx/include/cuda/std/__cstdlib/aligned_alloc.h
  • libcudacxx/test/libcudacxx/std/language.support/cstdlib/aligned_alloc.pass.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • libcudacxx/include/cuda/std/__cstdlib/aligned_alloc.h

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Corrected aligned_alloc parameter ordering so the alignment argument is taken before the size argument, consistently across host and device code paths.
  • Tests
    • Updated aligned allocation tests to use the new aligned_alloc argument order and corresponding noexcept expectations.

Walkthrough

aligned_alloc and __aligned_alloc_host now take (align, nbytes) instead of (nbytes, align). The host forwarding path and stub declarations were updated, and the aligned_alloc test now calls the reordered API.

Changes

Aligned Allocation Parameter Reordering

Layer / File(s) Summary
Reorder API and host forwarding
libcudacxx/include/cuda/std/__cstdlib/aligned_alloc.h, c/parallel.v2/src/hostjit/include/hostjit/cuda_minimal/stubs/cuda/std/__cstdlib/aligned_alloc.h
The public wrapper, host helper, and stub declarations use (align, nbytes) ordering; the host branch forwards the reordered arguments, and the device syscall declaration is given named parameters.
Update aligned_alloc test
libcudacxx/test/libcudacxx/std/language.support/cstdlib/aligned_alloc.pass.cpp
The test now invokes cuda::std::aligned_alloc with (align, size) and updates the matching noexcept check.

important: this changes a public parameter order on aligned_alloc; any positional callers or bindings still using (nbytes, align) will pass swapped values.

Suggested reviewers: miscco, bernhardmgruber


Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0c8a2c20-16df-4c9b-9b0d-7af370e74f35

📥 Commits

Reviewing files that changed from the base of the PR and between 886c291 and e0a0e23.

📒 Files selected for processing (1)
  • libcudacxx/include/cuda/std/__cstdlib/aligned_alloc.h

Comment thread libcudacxx/include/cuda/std/__cstdlib/aligned_alloc.h
Comment thread libcudacxx/include/cuda/std/__cstdlib/aligned_alloc.h
@davebayer davebayer force-pushed the fix_aligned_alloc_order branch from e0a0e23 to 8cf758a Compare July 7, 2026 11:22
@davebayer davebayer requested a review from a team as a code owner July 7, 2026 11:22
@davebayer davebayer requested a review from griwes July 7, 2026 11:22
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

😬 CI Workflow Results

🟥 Finished in 1h 57m: Pass: 97%/120 | Total: 3d 07h | Max: 1h 56m | Hits: 54%/857433

See results here.

@bernhardmgruber

bernhardmgruber commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

So, we introduced this in #3339, right? So we are shipping this bug since CCCL 3.0?

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

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

3 participants