Skip to content

[Paged Stash] Add integration tests for cuda_graphable_moe experiment - #3218

Merged
syed-ahmed merged 22 commits into
mainfrom
gh/syed-ahmed/6/head
Oct 8, 2026
Merged

syed-ahmed merged 22 commits into
mainfrom
gh/syed-ahmed/6/head

Conversation

@syed-ahmed

@syed-ahmed syed-ahmed commented May 4, 2026 •

Copy link
Copy Markdown
Collaborator

syed-ahmed added 4 commits May 4, 2026 15:17
- Add AVAILABLE_MEMORY_POLICIES registry to passes.py so experiments can
  register custom memory policies without modifying graph_trainer code.
- Refactor tag_with_memory_policy_pass to dispatch via the registry.
- Change memory_policy config from Literal to str for extensibility.
- Add _get_extra_graph_passes hook to GraphTrainer for subclasses to
  inject additional graph passes into the aot_fx_trace pipeline.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

[ghstack-poisoned]
Paged stash SAC for MoE expert activations: pre-allocated paged buffers
store dynamic-shaped _grouped_mm outputs for the backward pass, avoiding
both recomputation cost and memory fragmentation from variable token counts.

- Joint-graph pass (paged_stash_graph_pass.py): inserts paged_stash.copy/pop
  ops using ao's stream infrastructure, redirecting backward consumers through
  paged buffers so SAC+remat naturally ignores stashed activations.
- PagedStashTrainer (train.py): extends GraphTrainer with 3-level overflow
  defense (host spillover, cross-rank detection, retry with buffer growth).
- Memory policy registration: paged_stash and paged_stash_save_only policies.
- Fine-grained annotation via annotate_fn on _run_experts_grouped_mm.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

[ghstack-poisoned]
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

[ghstack-poisoned]
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

[ghstack-poisoned]
root added 2 commits May 5, 2026 20:17
…da_graphable_moe experiment"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
… experiment"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
syed-ahmed pushed a commit that referenced this pull request May 6, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

ghstack-source-id: 8385952
Pull Request resolved: #3218
@syed-ahmed syed-ahmed changed the title [Paged Stash] Add integration tests for cuda_graphable_moe experiment [GraphTrainer] Add paged stash integration test May 6, 2026
@syed-ahmed syed-ahmed changed the title [GraphTrainer] Add paged stash integration test [Paged Stash] Add integration tests for cuda_graphable_moe experiment May 6, 2026
syed-ahmed added 2 commits May 7, 2026 11:57
…da_graphable_moe experiment"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
… experiment"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
syed-ahmed added a commit that referenced this pull request May 7, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

ghstack-source-id: f0c62dd
Pull Request resolved: #3218
syed-ahmed added 2 commits May 7, 2026 14:05
…da_graphable_moe experiment"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
… experiment"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
syed-ahmed added a commit that referenced this pull request May 7, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

ghstack-source-id: 152fb37
Pull Request resolved: #3218
SherlockNoMad pushed a commit that referenced this pull request May 7, 2026
…#3215)

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* #3218
* #3217
* #3216
* __->__ #3215

- Add AVAILABLE_MEMORY_POLICIES registry to passes.py so experiments can
  register custom memory policies without modifying graph_trainer code.
- Refactor tag_with_memory_policy_pass to dispatch via the registry.
- Change memory_policy config from Literal to str for extensibility.
- Add _get_extra_graph_passes hook to GraphTrainer for subclasses to
  inject additional graph passes into the aot_fx_trace pipeline.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: root <[email protected]>
@syed-ahmed syed-ahmed moved this to In Progress in PyTorch + CUDA May 8, 2026
…da_graphable_moe experiment"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
… experiment"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
syed-ahmed added a commit that referenced this pull request May 12, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

ghstack-source-id: 69e990d
Pull Request resolved: #3218
root added 2 commits August 27, 2026 16:08
…da_graphable_moe experiment"


AI assistant used: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
… experiment"


AI assistant used: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
syed-ahmed pushed a commit that referenced this pull request Aug 27, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

ghstack-source-id: 99ccf00
Pull Request resolved: #3218
root added 2 commits September 29, 2026 16:34
…da_graphable_moe experiment"


AI assistant used: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
… experiment"


AI assistant used: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Sep 29, 2026
syed-ahmed pushed a commit that referenced this pull request Sep 29, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

ghstack-source-id: 04831e0
Pull Request resolved: #3218
…da_graphable_moe experiment"


AI assistant used: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
… experiment"


AI assistant used: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
syed-ahmed added a commit that referenced this pull request Oct 1, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

ghstack-source-id: ac81c30
Pull Request resolved: #3218
…da_graphable_moe experiment"


AI assistant used: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
… experiment"


AI assistant used: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
syed-ahmed added a commit that referenced this pull request Oct 7, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

ghstack-source-id: 27b654e
Pull Request resolved: #3218
…da_graphable_moe experiment"


AI assistant used: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
… experiment"


AI assistant used: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

[ghstack-poisoned]
syed-ahmed added a commit that referenced this pull request Oct 7, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreplyanthropic.com>

ghstack-source-id: 5a189b8
Pull Request resolved: #3218
syed-ahmed added a commit that referenced this pull request Oct 8, 2026
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at
bottom):
* #3218
* #3217
* __->__ #3216

Paged stash SAC for MoE expert activations: pre-allocated paged buffers
store dynamic-shaped _grouped_mm outputs for the backward pass, avoiding
both recomputation cost and memory fragmentation from variable token
counts.
@syed-ahmed
syed-ahmed changed the base branch from gh/syed-ahmed/6/base to main October 8, 2026 00:41
@syed-ahmed
syed-ahmed merged commit c110a1b into main Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants