Skip to content

[FEA]: Improve device hierarchy queries #6885

@davebayer

Description

@davebayer

Is this a duplicate?

Area

libcu++

Is your feature request related to a problem? Please describe.

Current way of using hierarchy queries is:

cuda::hierarchy_dimensions<...> dims;
dims.extents(cuda::block, cuda::grid);
dims.index(cuda::block, cuda::grid);

which is a bit hard to read and can look weird for the .index(...) for example.

Describe the solution you'd like

I'd like to do something that is more natural to a CUDA user:

cuda::hierarchy_dimensions<...> dims;
cuda::block.extents(cuda::grid, dims);
cuda::thread.index(cuda::grid, dims);

I think it's easier to read: block index in grid for given dims

The nice thing about this approach is that a user needn't to use hierarchy dimensions at all and do:

cuda::block.extents(cuda::grid);
cuda::thread.index(cuda::grid);

I will also provide .meow_as<int>(...) variants which can override the type that is returned by the query.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions