NVIDIA / NVIDIA/cccl

[BUG]: BlockAdjacentDifference requests 2x the shared memory actually needed

Open
#3,711 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

### Is this a duplicate?

- [x] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Type of Bug

Performance

### Component

CUB

### Describe the bug

Looking at https://github.com/NVIDIA/cccl/blob/9b7333b2c8d21aea84978f78a60db0aabf4ee5e1/cub/cub/block/block_adjacent_difference.cuh#L133-L137 and the at all the member functions, it seems like none of them is using both `first_items` and `last_items`, i.e. a single array `halo_items` or similar would suffice. The unnecessary amount of requested shared memory can in practice result in reduced occupancy and therefore worse performance.

### How to Reproduce

Not applicable.

### Expected behavior

`BlockAdjacentDifference` should only request as much shared memory as it actually needs.

### Reproduction link

_No response_

### Operating System

_No response_

### nvidia-smi output

_No response_

### NVCC version

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.