Skip to content

Make all algorithms in cuda/std/algorithm available through cuda/std/algorithm.meow.h#7935

Open
miscco wants to merge 1 commit intoNVIDIA:mainfrom
miscco:expose_modularized_access
Open

Make all algorithms in cuda/std/algorithm available through cuda/std/algorithm.meow.h#7935
miscco wants to merge 1 commit intoNVIDIA:mainfrom
miscco:expose_modularized_access

Conversation

@miscco
Copy link
Copy Markdown
Contributor

@miscco miscco commented Mar 9, 2026

We had a poll to see how users would like to access individual features of umbrella headers like <cuda/std/algorithm>

The vast majority preferred a pattern like <cuda/std/algorithms/find.h>

However, we can get away with finding a similar but different name if we use the pattern umbrella_header.feature

We can create a wrapper for the internal file and also instruct our IDE to ignore all files that match the pattern [a-z_]*\.[a-z_]* This works because we do not have any .h files in neither <cuda/> not <cuda/std/>

@miscco miscco requested review from a team as code owners March 9, 2026 12:20
@miscco miscco requested a review from jrhemstad March 9, 2026 12:20
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Mar 9, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Mar 9, 2026
@miscco
Copy link
Copy Markdown
Contributor Author

miscco commented Mar 9, 2026

I am proposing to keep the current folder structure intact and only add symlinks EDIT: discussed this internally and we need real files for windows

For me this greatly improves maintainability of our code base. Otherwise there are 500+ files in <cuda/std/> and no proper way of organizing them

@miscco miscco force-pushed the expose_modularized_access branch from cabe671 to d7051d6 Compare March 9, 2026 12:32
@miscco miscco requested a review from a team as a code owner March 9, 2026 12:32
@miscco miscco requested a review from gonidelis March 9, 2026 12:32
@github-actions

This comment has been minimized.

@miscco miscco force-pushed the expose_modularized_access branch from d7051d6 to b0a1755 Compare March 9, 2026 15:45
@github-actions

This comment has been minimized.

@miscco miscco force-pushed the expose_modularized_access branch 2 times, most recently from c8dd140 to 36bc8b6 Compare March 9, 2026 18:39
Comment thread .devcontainer/cuda12.0-gcc10/devcontainer.json Outdated
@github-actions

This comment has been minimized.

@jrhemstad
Copy link
Copy Markdown
Collaborator

I am proposing to keep the current folder structure intact and only add symlinks

I don't think symlinks work on Windows, do they?

@jrhemstad
Copy link
Copy Markdown
Collaborator

Given this is a pretty extensive product facing change, I'd like more thoughts from @wmaxey @griwes @gevtushenko @brycelelbach @ericniebler

@miscco
Copy link
Copy Markdown
Contributor Author

miscco commented Mar 10, 2026

I am proposing to keep the current folder structure intact and only add symlinks

I don't think symlinks work on Windows, do they?

They dont, moved to forwarding headers

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Collaborator

@jrhemstad jrhemstad left a comment

Choose a reason for hiding this comment

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

Some questions I'd like answered before we merge this:

  • How will we test this? I think we should have tests that include each micro-header and ensure that was is supposed to be available in that header is indeed available.
  • How will we document this?
  • I'd like to see an evaluation of how well this naming pattern will extend to other headers

@miscco
Copy link
Copy Markdown
Contributor Author

miscco commented Mar 25, 2026

This isn't quite what I meant. I meant an analysis of how this pattern would extend to other headers like <cuda/std/type_traits> or similar. I don't want to adopt a special pattern that only applies to the <algorithm> header and doesn't scale to other headers where we'd need to use a different pattern. That inconsistency would be a bad user experience.

That is exactly what I meant. The chosen character does not appear in any source file name in the repository outside of the file extension

currently we only have [a-z_] as identifiers in the name and .[h, cuh] for the file ending.

As long as there is never a feature that we want to publicize named "h" and "cuh" we are fine.

The patter works perfectly fine with <cuda/std/type_traits.remove_cvref> or any other currently used header name

@bernhardmgruber
Copy link
Copy Markdown
Contributor

I agree with @miscco here that . is probably a good choice.

Concretely, I'd like to see a list of other headers we may want to split up like this and evaluate how well the pattern extends to other headers.

That is still valuable to have independently. And it may give us new insight after all. @miscco can we gather a list of headers that would benefit from splitting as well? Like <type_traits>, <functional>, <cmath>, <iterator>, <utility>, ... Maybe also <atomic>, <chrono>, <memory>, <randpm>, <ranges>. Would the . work everywhere and "look & feel" ok?

@miscco
Copy link
Copy Markdown
Contributor Author

miscco commented Mar 25, 2026

Concretely, I'd like to see a list of other headers we may want to split up like this and evaluate how well the pattern extends to other headers.

I believe the candidates are:

  • <cuda/cmath>
  • <cuda/functional>
  • <cuda/iterator>
  • <cuda/memory>
  • <cuda/numeric>
  • <cuda/ptx>
  • <cuda/random>
  • <cuda/utility>
  • <cuda/warp>
  • <cuda/std/algorithm>
  • <cuda/std/bit>
  • <cuda/std/cmath>
  • <cuda/std/concepts>
  • <cuda/std/functional>
  • <cuda/std/iterator> -> We only want to expose iterators and next and friends
  • <cuda/std/memory>
  • <cuda/std/numeric>
  • <cuda/std/random>
  • <cuda/std/ranges>
  • <cuda/std/utility>
  • <cuda/std/type_traits>

@bernhardmgruber
Copy link
Copy Markdown
Contributor

I think we should have tests that include each micro-header and ensure that was is supposed to be available in that header is indeed available.

Can we have some really minimal tests for that?

@miscco miscco force-pushed the expose_modularized_access branch 2 times, most recently from cbad07a to 53408de Compare March 25, 2026 12:32
@github-actions

This comment has been minimized.

@miscco miscco force-pushed the expose_modularized_access branch from 53408de to ffb2378 Compare March 25, 2026 14:28
@miscco miscco force-pushed the expose_modularized_access branch from ffb2378 to 6439853 Compare March 25, 2026 14:59
Comment thread libcudacxx/include/cuda/std/algorithm.ranges.find_if.h
@github-actions

This comment has been minimized.

@miscco
Copy link
Copy Markdown
Contributor Author

miscco commented Mar 25, 2026

@jrhemstad I have added tests to verify everything work with just the modularized includes, and it even found a bug 🎉

Any other questions?

@miscco miscco force-pushed the expose_modularized_access branch from 6439853 to 6df918f Compare March 30, 2026 08:21
@github-actions

This comment has been minimized.

@github-project-automation github-project-automation Bot moved this from In Progress to In Review in CCCL Mar 31, 2026
@ericniebler
Copy link
Copy Markdown
Contributor

i really do not like the naming scheme for the files. tooling very much cares about extensions. i don't expect this to be a great experience in an IDE, for example. and if we modularize all the headers listed in this comment from @Missco, then we'll have 100s of headers in cuda/std/.

The vast majority preferred a pattern like <cuda/std/algorithms/find.h>

then why aren't we using that?

@miscco
Copy link
Copy Markdown
Contributor Author

miscco commented Mar 31, 2026

The vast majority preferred a pattern like <cuda/std/algorithms/find.h>

then why aren't we using that?

The issue is that it is surprising and non-trivial. Note that we cannot do <cuda/std/algorithm/find.h> because <cuda/std/algorithm> is already a file not a folder.

So for every header we need to find a similar but not equal name for the original header which is really awkward. It also breaks down with e.g. <cuda/std/type_traits> What would be a good name for a subfolder?

I would also like to note that we have a bazillion files in our CI that are named meow.pass.cpp or even meow.compile.pass.cpp

@ericniebler
Copy link
Copy Markdown
Contributor

ericniebler commented Mar 31, 2026

So for every header we need to find a similar but not equal name for the original header which is really awkward.

so what? we can find the names. the cure you're suggesting is worse than the disease.

It also breaks down with e.g. <cuda/std/type_traits> What would be a good name for a subfolder?

<cuda/std/traits/is_integral.h> seems fine to me. or we can use the stable section names from the standard: <cuda/std/type.traits/is_integral.h>

@bernhardmgruber
Copy link
Copy Markdown
Contributor

It also breaks down with e.g. <cuda/std/type_traits> What would be a good name for a subfolder?

<cuda/std/traits/is_integral.h> seems fine to me.

I disagree. I think discoverability of the single function headers is also very relevant for IDE usage, so if the user types #include <cuda/std/type_traits they should see in their auto-completion the <cuda/std/type_traits> header as well as all the single function headers.

Can't we just take the umbrella header and append a single character for the directory name? Like <cuda/std/type_traits_/is_integral>?

Copy link
Copy Markdown
Contributor

@brycelelbach brycelelbach left a comment

Choose a reason for hiding this comment

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

I think we must do meow.suffix not algorithm.meow.

  • Not having a suffix messes up syntax highlighting which is painful for users.
  • It's probably also not great for AI agents. A suffix tells the AI agent what the file is without looking at it.

We should ideally use just one suffix for header names; let's go with whatever is most consistent with our current best practices. The options are .h, .hpp, .cuh; my understanding is that .cuh is considered best practice and what we try to use.

@miscco miscco force-pushed the expose_modularized_access branch from 6df918f to 5294ffa Compare April 8, 2026 08:37
@miscco miscco requested a review from a team as a code owner April 8, 2026 08:43
@miscco miscco force-pushed the expose_modularized_access branch from 3d9c513 to 5294ffa Compare April 8, 2026 08:44
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

🥳 CI Workflow Results

🟩 Finished in 1h 44m: Pass: 100%/108 | Total: 2d 06h | Max: 1h 23m | Hits: 83%/296842

See results here.

@miscco miscco changed the title Make all algorithms in cuda/std/algorithm available through cuda/std/algorithm.meow Make all algorithms in cuda/std/algorithm available through cuda/std/algorithm.meow.h Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

6 participants