Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Fix device-side reduce launch with large inputs #597

Conversation

gevtushenko
Copy link
Collaborator

When there are more than one tile of input items, we launch two kernels for reduction. During the second kernel launch, we accumulate partial aggregates from thread blocks. In this case, int reduce_grid_size is passed to OffsetT num_items kernel parameter. Thrust triple_chevron is not type safe when used on device. These facts lead to a mismatch of data size we put into a param buffer (4 bytes) and that the kernel reads from the buffer (8 bytes). This seems to be a bug that was long present in thrust, that uses dispatch layer directly with offset types different from int32_t. In the case of host-side usage, type conversion takes place, leading to normal execution.

Copy link
Collaborator

@elstehle elstehle left a comment

Choose a reason for hiding this comment

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

Interesting finding 👍

Seems a bit concerning that device-side triple_chevron::do_it isn't type safe. Could imagine that one can easily instantiate a kernel template for different parameter types then are eventually getting passed to the kernel invocation.

@gevtushenko gevtushenko merged commit 0a3afa0 into NVIDIA:main Nov 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants