NVIDIA / NVIDIA/cccl

[FEA]: Add RAII-style `discard_memory` to new vsmem utilities

Open
#1,142 0 comments 1 reaction 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 request and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)

### Area

CUB

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

The new utilities for virtual shared memory also add a static member function that helps to hint to discard any dirty cachelines that are part of the virtual shared memory of that thread block. It's easy to forget adding this to the end of the kernel, like:

```
...
agent.Process();
...
// If applicable, hints to discard modified cache lines for vsmem
VSmemHelperT::discard_temp_storage(temp_storage);
```

### Describe the solution you'd like

It would be nice to make this call RAII-style, such that we automatically `discard_memory`, once the helper goes out of scope.

### Describe alternatives you've considered

_No response_

### Additional context

_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.