NVIDIA / NVIDIA/recsys-examples
[FEA] activation offloading
@JacoCheung is already working on this.
Since May 21, 2025.
- Dominant language
- Python
- Stars
- 322
- Forks
- 83
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 8
Description
Is your feature request related to a problem? Please describe.
Since activation takes majority propotional of memory for HSTU model, offloading activation to CPU should be a good choice to reduce memory footprint while preserving on-par performance.
Describe the solution you'd like
TE already provided utility functions to do CPU offloading. CPU offloading.
To achieve better performance, we need to reduce H2D and D2H copy by grouping activations together. The idle workflow in my mind is:
- allocate GPU and Host activation buffer with max sequence length for each HSTU layer
- create activation tensor view from GPU buffer, and use those tensor views during forward.
- offloading the GPU activation bulk to CPU. This can be done by use GPU buffer in save_for_backward and use TE offloading hook for save_for_backward.
- in backward, we will get the buffer. We can create view from the buffer and use tensor views in backward.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context, code examples, or references to existing implementations about the feature request here.
By submitting this issue, you agree to follow our code of conduct and our contributing guidelines.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.