Skip to content

[FEA]: Provide a way to create an uninitialized array #7338

@miscco

Description

@miscco

Is this a duplicate?

Area

CUB

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

For vectorized code paths we often use something like InputT input[items_per_thread];

Because this is a plain C-array, the compiler will try to value-initialize the elements. However, this is almost never what we want because we want to fill it with data usually through a vectorized load.

Describe the solution you'd like

We should provide a type that holds the array in a union, so that we can create it without spending time on initializing it.

Describe alternatives you've considered

Alternatively we could use alignas(InputT) cuda::std::byte input[items_per_thread * sizeof(InputT)]; and then cast, but I am not sure what is cleaner

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    cubFor all items related to CUB

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions