NVIDIA / NVIDIA/recsys-examples

[FEA] activation offloading

Open
#48 0 comments 1 reaction 1 assignee View on GitHub

@JacoCheung is already working on this.

Since May 21, 2025.

feature TBD
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:

  1. allocate GPU and Host activation buffer with max sequence length for each HSTU layer
  2. create activation tensor view from GPU buffer, and use those tensor views during forward.
  3. 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.
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.