Skip to content

[HybridEP] Enable HybridEP with graph_trainer - #3007

Merged
syed-ahmed merged 4 commits into
pytorch:mainfrom
syed-ahmed:hybridep-graph-trainer
Apr 30, 2026
Merged

syed-ahmed merged 4 commits into
pytorch:mainfrom
syed-ahmed:hybridep-graph-trainer

Conversation

@syed-ahmed

@syed-ahmed syed-ahmed commented Apr 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Enables HybridEP to work with graph_trainer's aot_fx_trace compilation path, including full composability with SAC (selective activation checkpointing) and CUDA graph capture.

Fixes

  1. Wire HybridEP config through graph_trainer's parallelize_deepseekv3 — Pass comm_backend to apply_moe_ep_tp() and thread non_blocking_capacity_factor through all DeepSeekV3 config factories. Pre-initialize HybridEP buffer in parallelize_deepseekv3 before tracing.

  2. Guard _disable_current_modes() with _buffer is None — Instead of unconditionally calling get_buffer inside _disable_current_modes(), only call it when the buffer hasn't been initialized yet. This prevents re-initialization during make_fx tracing.

  3. Fix fake dispatch scores shape — Change from (0,) to (out_tokens,) to prevent shape mismatch during tracing.

  4. Replace @torch.compiler.disable() on sync_combine — The decorator breaks make_fx tracing. Use an is_compiling() guard inside the function body instead.

  5. Add FunctionalTensor/FakeTensor fallback in dispatch/combine backward — During tracing, DispatchHandle.value is None because the opaque handle doesn't survive fake tensor execution. Detect this and return zero gradients (the traced backward graph will use real handles at runtime). Preserves the RuntimeError raise on the eager path.

  6. Remove _grouped_mm cudagraph incompatibility check — The is_cudagraph_compatible function conservatively blocked CUDA graph capture for graphs containing aten._grouped_mm. This is overly conservative — _grouped_mm is CUDA graph compatible (verified empirically). Removing this allows cudagraph to be applied automatically for MoE models in the aot_fx_trace default pass pipeline.

  7. Add cudagraph pass logging — Add "Applied cudagraph pass." log message for parity with SAC logging.

  8. Add HybridEP integration test — Add aot_fx_trace_deepseek_v3_hybridep integration test entry using the graph_trainer_deepseek_v3_debugmodel_hybridep config with FSDP+TP+EP. DeepEP is installed (pinned to commit 1b8f467) in the H100 CI workflow before running the test suite.

  9. Add TODO for HybridEP refactoring — HybridEP applies to other sparse models (e.g. Qwen3). Added TODO to refactor the common HybridEP buffer init into a shared utility.

Note: the aot compile mode path has a known upstream regression (DispatchHandle as FakeScriptObject in graph output) and is not supported in this PR.

Setup

Requires DeepEP with the hybrid-ep branch:

git clone --branch hybrid-ep https://github.com/deepseek-ai/deepep.git /tmp/deepep
cd /tmp/deepep && git checkout 1b8f467 && CUDA_HOME=/usr/local/cuda TORCH_CUDA_ARCH_LIST="10.0" pip install -e .

Test plan

  • Smoke test: aot_fx_trace with HybridEP (3 steps, 4×GB200). SAC and cudagraph are applied automatically by the default pass pipeline — no --compile.passes or --compile.joint_passes flags needed:
rm -rf /tmp/torchtitan_fx_codegen /tmp/torchtitan_fx_codegen_0 /tmp/torchinductor_root

CUDA_HOME=/usr/local/cuda NCCL_GRAPH_REGISTER=0 NGPU=4 \
  MODULE=graph_trainer.deepseek_v3 CONFIG=graph_trainer_deepseek_v3_debugmodel_hybridep \
  ./run_train.sh \
  --compile.mode aot_fx_trace \
  --parallelism.data_parallel_shard_degree=2 \
  --parallelism.tensor_parallel_degree=2 \
  --parallelism.expert_parallel_degree=2 \
  --training.steps=3

Smoke test output (4×GB200):

INFO - Building graph_trainer/deepseek_v3 debugmodel
INFO - CUDA capacity: NVIDIA GB200 with 187.28GiB memory
INFO - Total parameter count: dense 23,173,376, sparse 9,840,640, active 28,098,816
INFO - Compiling the loss function with torch.compile
INFO - Applying HYBRIDEP to MoE layer
INFO - Applying HYBRIDEP to MoE layer
INFO - Applying HYBRIDEP to MoE layer
INFO - Applying HYBRIDEP to MoE layer
INFO - Applying HYBRIDEP to MoE layer
INFO - activation_checkpoint.mode is 'selective', added apply_sac to compile.joint_passes
INFO - Applied Data Parallel (simple_fsdp) (dp mode=fully_shard) to the model
INFO - Pre-initialized HybridEP buffer (hidden_dim=256, num_tokens=16384, num_local_experts=4)
INFO - aot_fx_trace compile mode: graph capture will happen at training time
INFO - Training starts at step 1
INFO - Removed 62 aten.detach.default node(s) from the graph
INFO - Removed 669 identity view/reshape node(s) from the graph
INFO - Removed 66 identity slice node(s)
INFO - Applied selective activation checkpointing (SAC) graph pass.
INFO -   Forced 5 nodes to MUST_SAVE at layer boundaries
INFO -   Layer non-layer: 6 MUST_SAVE, 58 PREFER_RECOMPUTE
INFO -   Layer 0: 22 MUST_SAVE, 78 PREFER_RECOMPUTE
INFO -   Layer 1: 30 MUST_SAVE, 103 PREFER_RECOMPUTE
INFO -   Layer 2: 30 MUST_SAVE, 103 PREFER_RECOMPUTE
INFO -   Layer 3: 30 MUST_SAVE, 103 PREFER_RECOMPUTE
INFO -   Layer 4: 30 MUST_SAVE, 103 PREFER_RECOMPUTE
INFO -   Layer 5: 30 MUST_SAVE, 103 PREFER_RECOMPUTE
INFO - Applied cudagraph pass.
INFO - step:  1  loss:  4.04367  grad_norm:  3.5169  memory:  1.93GiB(1.03%)  tps: 370      tflops: 0.20   mfu: 0.01%
INFO - step:  2  loss:  3.07626  grad_norm:  4.4144  memory:  1.93GiB(1.03%)  tps: 37,316   tflops: 20.26  mfu: 0.81%
INFO - step:  3  loss:  2.48693  grad_norm:  3.0514  memory:  1.93GiB(1.03%)  tps: 154,557  tflops: 83.91  mfu: 3.36%
INFO - Training completed
  • Integration test (runs in H100 CI with deep_ep installed, 4×GB200):
rm -rf /tmp/test_output /tmp/torchtitan_fx_codegen /tmp/torchtitan_fx_codegen_0 /tmp/torchinductor_root

CUDA_HOME=/usr/local/cuda NCCL_GRAPH_REGISTER=0 \
  python -m torchtitan.experiments.graph_trainer.tests.integration_tests \
  --test_suite graph_trainer_h100 --test_name aot_fx_trace_deepseek_v3_hybridep \
  --gpu_arch_type cuda /tmp/test_output --ngpu 4

Integration test output (4×GB200):

INFO - Building graph_trainer/deepseek_v3 debugmodel
INFO - CUDA capacity: NVIDIA GB200 with 187.28GiB memory
INFO - Total parameter count: dense 23,173,376, sparse 9,840,640, active 28,098,816
INFO - Compiling the loss function with torch.compile
INFO - Applying HYBRIDEP to MoE layer
INFO - Applying HYBRIDEP to MoE layer
INFO - Applying HYBRIDEP to MoE layer
INFO - Applying HYBRIDEP to MoE layer
INFO - Applying HYBRIDEP to MoE layer
INFO - activation_checkpoint.mode is 'selective', added apply_sac to compile.joint_passes
INFO - Applied Data Parallel (simple_fsdp) (dp mode=fully_shard) to the model
INFO - Pre-initialized HybridEP buffer (hidden_dim=256, num_tokens=16384, num_local_experts=4)
INFO - aot_fx_trace compile mode: graph capture will happen at training time
INFO - Training starts at step 1
INFO - Removed 62 aten.detach.default node(s) from the graph
INFO - Removed 669 identity view/reshape node(s) from the graph
INFO - Removed 66 identity slice node(s)
INFO - Applied selective activation checkpointing (SAC) graph pass.
INFO -   Forced 5 nodes to MUST_SAVE at layer boundaries
INFO -   Layer non-layer: 6 MUST_SAVE, 58 PREFER_RECOMPUTE
INFO -   Layer 0: 22 MUST_SAVE, 78 PREFER_RECOMPUTE
INFO -   Layer 1: 30 MUST_SAVE, 103 PREFER_RECOMPUTE
INFO -   Layer 2: 30 MUST_SAVE, 103 PREFER_RECOMPUTE
INFO -   Layer 3: 30 MUST_SAVE, 103 PREFER_RECOMPUTE
INFO -   Layer 4: 30 MUST_SAVE, 103 PREFER_RECOMPUTE
INFO -   Layer 5: 30 MUST_SAVE, 103 PREFER_RECOMPUTE
INFO - Applied cudagraph pass.
INFO - step:  1  loss:  4.04167  grad_norm:  3.5349  memory:  1.93GiB(1.03%)  tps: 351      tflops: 0.19   mfu: 0.01%
INFO - step:  2  loss:  3.02292  grad_norm:  4.5966  memory:  1.93GiB(1.03%)  tps: 57,945   tflops: 31.46  mfu: 1.26%
INFO - step:  3  loss:  2.43557  grad_norm:  3.0576  memory:  1.93GiB(1.03%)  tps: 144,958  tflops: 78.70  mfu: 3.15%
INFO - step:  4  loss:  2.38998  grad_norm:  2.6843  memory:  1.93GiB(1.03%)  tps: 134,592  tflops: 73.07  mfu: 2.92%
INFO - step:  5  loss:  2.21116  grad_norm:  2.4768  memory:  1.93GiB(1.03%)  tps: 154,326  tflops: 83.79  mfu: 3.35%
INFO - step:  6  loss:  2.12107  grad_norm:  2.0482  memory:  1.93GiB(1.03%)  tps: 134,649  tflops: 73.11  mfu: 2.92%
INFO - step:  7  loss:  2.03298  grad_norm:  1.8383  memory:  1.93GiB(1.03%)  tps: 157,360  tflops: 85.44  mfu: 3.42%
INFO - step:  8  loss:  1.99672  grad_norm:  1.8210  memory:  1.93GiB(1.03%)  tps: 152,331  tflops: 82.71  mfu: 3.31%
INFO - step:  9  loss:  2.21667  grad_norm:  1.5196  memory:  1.93GiB(1.03%)  tps: 152,393  tflops: 82.74  mfu: 3.31%
INFO - step: 10  loss:  1.95824  grad_norm:  1.6616  memory:  1.93GiB(1.03%)  tps: 137,813  tflops: 74.82  mfu: 2.99%
INFO - Training completed

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 17, 2026
@pytorch-bot

pytorch-bot Bot commented Apr 17, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@tianyu-l
tianyu-l requested a review from shuhuayu April 18, 2026 05:27

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds OK to me, would like @shuhuayu @yiming0416 @xmfan to take a look


torch.compile Compatibility:
Decorated with @torch.compiler.disable() to always run in eager mode.
This avoids issues with CUDA event operations not being traceable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to update the docstring to reflect the changes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will do.

hidden_dim=hidden_states.shape[1],
num_tokens=hidden_states.shape[0],
num_local_experts=num_local_experts,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need this condition in

with _disable_current_modes():

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is only targeting CUDAGraph + HybridEP composability (through graph trainer). I believe DeepEP fundamentally won't work with CUDAGraph because of CPU syncs. Should we rather just document that DeepEP is not composable with CUDAGraphs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. DeepEP has d2h sync for both handle_id and and dispatch metadata num_recv_token. The former can be unified as the same as hybridep but the latter is fundamental. I think we can skip this.

@yiming0416 yiming0416 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For aot_fx_trace mode, you need to run the command with --compile.mode aot_fx_trace

@syed-ahmed syed-ahmed changed the title [HybridEP] Enable HybridEP with graph_trainer AOT compilation [HybridEP] Enable HybridEP with graph_trainer Apr 22, 2026
@syed-ahmed
syed-ahmed force-pushed the hybridep-graph-trainer branch from dee0cf4 to 9e9f813 Compare April 22, 2026 00:09
@syed-ahmed

Copy link
Copy Markdown
Collaborator Author

For aot_fx_trace mode, you need to run the command with --compile.mode aot_fx_trace

@yiming0416

  • Updated the PR summary testing both default aot mode and aot_fx_trace mode.
  • Rebased and created new debug config enabling hybrid ep and non blocking mode.

@tianyu-l

Copy link
Copy Markdown
Contributor

@yiming0416 could you help review?

@syed-ahmed

syed-ahmed commented Apr 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

It looks like the latest TorchTitan/PyTorch broke the aot path (apparently because of the DispatchHandle):

File "/opt/pytorch/pytorch/torch/_functorch/partitioners.py", line 3649, in classify_nodes                                                     
        forward_only_graph = _extract_graph_with_inputs_outputs(                                                                                   
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                   
    File "/opt/pytorch/pytorch/torch/_functorch/partitioners.py", line 380, in _extract_graph_with_inputs_outputs                                  
        raise AssertionError(f"Node {x} was invalid, but is output")                                                                               
    AssertionError: Node tangents_2 was invalid, but is output
                                                                                                                                                   
    And from our debug instrumentation, the context around the failing node:                                                                       
                                
    DEBUG: Invalid output node: tangents_2                                                                                                         
      name=tangents_2, op=placeholder                                                                                                              
      val type=FakeScriptObject, dtype=?, shape=(2,)                                                                                               
      users: ['output']                                                                                                                            
      All 7 outputs:                                                                                                                               
        [0] add_4 op=call_function val_type=FakeTensor                                                                                             
        [1] add_37 op=call_function val_type=FakeTensor                                                                                            
        [2] add_70 op=call_function val_type=FakeTensor                                                                                            
        [3] add_103 op=call_function val_type=FakeTensor                                                                                           
        [4] add_136 op=call_function val_type=FakeTensor                                                                                           
        [5] _unsafe_view_27 op=call_function val_type=FakeTensor                                                                                   
        [6] tangents_2 op=placeholder val_type=FakeScriptObject

aot_fx_trace still works. Let me try to add a unit test. Related: #3013, #3061

@yiming0416 yiming0416 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Changes to graph trainer are guarded under comm_backend.

It's expected that aot doesn't work given some recent regression. Let's try to add a test for aot_fx_trace

@syed-ahmed

Copy link
Copy Markdown
Collaborator Author

Thanks! Will add a test for aot_fx_trace.

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stamp

return config


def graph_trainer_deepseek_v3_debugmodel_hybridep() -> GraphTrainer.Config:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a test case for this model in integration test?

@syed-ahmed syed-ahmed Apr 28, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an integration test exercising this config. See note below.

"Applied Data Parallel (simple_fsdp) (dp mode=%s) to the model", dp_mode
)

if comm_backend == "hybridep" and parallel_dims.ep_enabled:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is HybridEP also applicable to other Sparse model, e.g Qwen3?

Please leave a todo here to refactor the common part out into util?

Non blocking comment tho

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, HybridEP is also applicable to models like Qwen3. Left a TODO.

@syed-ahmed
syed-ahmed force-pushed the hybridep-graph-trainer branch 2 times, most recently from 3260299 to 5798c4e Compare April 28, 2026 21:17
@syed-ahmed syed-ahmed added the ciflow/h100.8 Trigger H100.8 CI label Apr 28, 2026
@syed-ahmed
syed-ahmed force-pushed the hybridep-graph-trainer branch from 5798c4e to f9e679b Compare April 28, 2026 21:32
@syed-ahmed

syed-ahmed commented Apr 28, 2026 •

Copy link
Copy Markdown
Collaborator Author

@SherlockNoMad Address your review comments - added the TODO and the integration test.

  • Note the integration test installs hybrid ep, which take ~1.5 minutes to install. Is that okay? Otherwise, we can write a unit test, but that adds maintenance burden.
  • One new thing that came up during testing was the cudagraph pass and grouped_mm - PyTorch's grouped_mm is cudagraph'able, so not sure why it was excluded in this PR: [GraphTrainer][AutoDev] Enable cudagraph in aot_fx_trace mode #2868. I removed that check from the cudagraph pass in this PR. Could you please confirm if that's ok?
  • Also updated the PR summary with the latest run.

@syed-ahmed

Copy link
Copy Markdown
Collaborator Author

Ah I see why #2868 blocks grouped_mm from cuda graph. The sync is there for pre-blackwell architecture.

@syed-ahmed
syed-ahmed force-pushed the hybridep-graph-trainer branch from f9e679b to d2c17be Compare April 28, 2026 23:58
@syed-ahmed

Copy link
Copy Markdown
Collaborator Author

@SherlockNoMad Made the grouped mm exclusion in the cudagraph pass architecture dependent (if that's ok).

@syed-ahmed
syed-ahmed force-pushed the hybridep-graph-trainer branch from d2c17be to 535f00a Compare April 29, 2026 02:32
Enable HybridEP to work with graph_trainer's aot and aot_fx_trace
compilation paths.

1. Wire comm_backend through graph_trainer's parallelize_deepseekv3
   to apply_moe_ep_tp. Pre-initialize HybridEP buffer before
   apply_compile so it's available at trace time.
2. Replace @torch.compiler.disable() on sync_combine with an
   is_compiling() guard — the decorator breaks fullgraph tracing
   under Dynamo. Under make_fx (aot_fx_trace), is_compiling() is
   False but the function is still safe since _pending_combine_event
   is None during tracing.
3. Fix fake dispatch scores shape from (0,) to (out_tokens,).
4. Guard _disable_current_modes() with _buffer is None instead of
   is_compiling() — is_compiling() returns False under make_fx.
5. Add FunctionalTensor/FakeTensor fallback in dispatch/combine
   backward for aot and aot_fx_trace tracing respectively.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@syed-ahmed
syed-ahmed force-pushed the hybridep-graph-trainer branch 2 times, most recently from 33f438d to cf16bd9 Compare April 30, 2026 03:40
@syed-ahmed

Copy link
Copy Markdown
Collaborator Author

@SherlockNoMad Here's the integration test to be added later after figuring out how to run DeepEP in the CI: syed-ahmed@857c500

And here's what I tried so far to upgrade the CI, but need to think about it a little more: syed-ahmed@4f8beed. The current base container is 12.4, doesn't have cuda toolkit, nvshmem, ibverbs, and installs pytorch with cuda 13 - because of which DeepEP can't be installed.

Also since we don't have blackwell in the CI, cudagraph pass disables torch._grouped_mm, so the integration test can't really exercise the cudagraph pass with hybridep in the CI, until we have blackwell runners for torchtitan.

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one nit

def _671b(
attn_backend: str,
moe_comm_backend: str,
non_blocking_capacity_factor: float | None = None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since model_registry has default value for this field, we don't need default values for concrete model flavors

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tests actually call the concrete model flavors directly. So rejecting this nit in the fix-up PR: #3177

@syed-ahmed
syed-ahmed force-pushed the hybridep-graph-trainer branch from 4094c6d to cf16bd9 Compare April 30, 2026 15:29
syed-ahmed and others added 3 commits April 30, 2026 08:32
Add non_blocking_capacity_factor parameter to DeepSeek-v3 config
factories (_debugmodel, _16b, _236b, _671b) and both model_registry
functions (core and graph_trainer) so HybridEP non-blocking mode
can be configured at model construction time.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Mark MoE custom ops (hybridep dispatch/combine, grouped_mm) as
  cudagraph-safe so the cudagraph pass doesn't bail out.
- Log HybridEP application in parallelize_deepseekv3.
- Add debug logging for pass application in passes.py.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@syed-ahmed
syed-ahmed force-pushed the hybridep-graph-trainer branch from cf16bd9 to 8c21fea Compare April 30, 2026 15:35
@syed-ahmed
syed-ahmed merged commit 115f4c9 into pytorch:main Apr 30, 2026
14 of 17 checks passed
@syed-ahmed

syed-ahmed commented Apr 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks for all the approvals! Landed.

syed-ahmed added a commit that referenced this pull request Apr 30, 2026
…Config (#3177)

`expert_parallel_comm_backend` was removed from
#3167.
#3007 didn't take it into
account and broke graph trainer CI.

- This PR reads comm backend from the model config to initialize
hybridep buffers.
- Also restores non_blocking_capacity_factor default value for the
concrete model flavors, since some tests call the concrete flavors
directly.

Tested locally:
```
  + NGPU=4                                                                                                                                                                                                                                                 
  + export LOG_RANK=0                                                                                                                                                                                                                                      
  + LOG_RANK=0                                                                                                                                                                                                                                             
  + MODULE=graph_trainer.deepseek_v3                                                                                                                                                                                                                       
  + CONFIG=graph_trainer_deepseek_v3_debugmodel_hybridep                                                                                                                                                                                                   
  + COMM_MODE=                                                                                                                                                                                                                                             
  + TORCHFT_LIGHTHOUSE=http://localhost:29510                                                                                                                                                                                                              
  + '[' -n '' ']'                        
  + PYTORCH_ALLOC_CONF=expandable_segments:True                                                                                                                                                                                                            
  + TORCHFT_LIGHTHOUSE=http://localhost:29510                                                                                                                                                                                                              
  + torchrun --nproc_per_node=4 --rdzv_backend c10d --rdzv_endpoint=localhost:0 --local-ranks-filter 0 --role rank --tee 3 -m torchtitan.train --module graph_trainer.deepseek_v3 --config graph_trainer_deepseek_v3_debugmodel_hybridep --compile.mode
  aot_fx_trace --parallelism.data_parallel_shard_degree=2 --parallelism.tensor_parallel_degree=2 --parallelism.expert_parallel_degree=2 --training.steps=3                                                                                                 
  [rank0]:[titan] 2026-04-30 09:24:36,606 - root - INFO - torchtitan version: 0.2.2                                                  
  [rank0]:[titan] 2026-04-30 09:24:37,184 - root - INFO - Building device mesh with parallelism: pp=1, dp_replicate=1, dp_shard=2, cp=1, tp=2, ep=2                                                                                                        
  [rank0]:[titan] 2026-04-30 09:24:37,204 - root - INFO - Successfully created meshes with active dimensions: ['batch', 'loss', 'fsdp', 'tp', 'ep', 'efsdp']                                                                                               
  [rank0]:[titan] 2026-04-30 09:24:38,881 - root - INFO - Building graph_trainer/deepseek_v3 debugmodel                                                                                                                                                    
  [rank0]:[titan] 2026-04-30 09:24:38,924 - root - INFO - CUDA capacity: NVIDIA GB200 with 184.00GiB memory                                                                                                                                                
  [rank0]:[titan] 2026-04-30 09:24:38,942 - root - INFO - Total parameter count: dense 23,173,376, sparse 9,840,640, active 28,098,816                                                                                                                     
  [rank0]:[titan] 2026-04-30 09:24:38,942 - root - INFO - Model graph_trainer/deepseek_v3 debugmodel size: 33,014,016 total parameters                                                                                                                     
  [rank0]:[titan] 2026-04-30 09:24:39,022 - root - INFO - Applied Data Parallel (simple_fsdp) (dp mode=fully_shard) to the model                                                                                                                           
  [rank0]:[titan] 2026-04-30 09:24:39,817 - root - INFO - Pre-initialized HybridEP buffer (hidden_dim=256, num_tokens=16384, num_local_experts=4)                                                                                                          
  [rank0]:[titan] 2026-04-30 09:24:39,817 - root - INFO - aot_fx_trace compile mode: graph capture will happen at training time                                                                                                                            
  [rank0]:[titan] 2026-04-30 09:24:40,725 - root - INFO - Peak FLOPS used for computing MFU: 2.500e+15                                                                                                                                                     
  [rank0]:[titan] 2026-04-30 09:24:40,725 - root - INFO - CUDA memory usage for model: 0.04GiB(0.02%)                                                                                                                                                      
  [rank0]:[titan] 2026-04-30 09:24:42,931 - root - INFO - Trainer is initialized with local batch size 8, global batch size 16, gradient accumulation steps 1, sequence length 2048, total steps 3 (warmup 2)                                              
  [rank0]:[titan] 2026-04-30 09:24:42,931 - root - INFO - Training starts at step 1                                                                                                                                                                        
  [rank0]:[titan] 2026-04-30 09:24:47,646 - root - INFO - Removed 62 aten.detach.default node(s) from the graph                                                                                                                                            
  [rank0]:[titan] 2026-04-30 09:24:47,708 - root - INFO - Removed 669 identity view/reshape node(s) from the graph                                                                                                                                         
  [rank0]:[titan] 2026-04-30 09:24:47,709 - root - INFO - Removed 66 identity slice node(s)                                                                                                                                                                
  [rank0]:[titan] 2026-04-30 09:24:47,880 - root - INFO - Applied selective activation checkpointing (SAC) graph pass.                                                                                                                                     
  [rank0]:[titan] 2026-04-30 09:24:47,880 - root - INFO -   Forced 5 nodes to MUST_SAVE at layer boundaries                                                                                                                                                
  [rank0]:[titan] 2026-04-30 09:24:47,880 - root - INFO -   Layer non-layer: 2 MUST_SAVE, 62 PREFER_RECOMPUTE                                                                                                                                              
  [rank0]:[titan] 2026-04-30 09:24:47,880 - root - INFO -   Layer 0: 10 MUST_SAVE, 90 PREFER_RECOMPUTE                                                                                                                                                     
  [rank0]:[titan] 2026-04-30 09:24:47,880 - root - INFO -   Layer 1: 13 MUST_SAVE, 120 PREFER_RECOMPUTE                                                                                                                                                    
  [rank0]:[titan] 2026-04-30 09:24:47,880 - root - INFO -   Layer 2: 13 MUST_SAVE, 120 PREFER_RECOMPUTE                              
  [rank0]:[titan] 2026-04-30 09:24:47,880 - root - INFO -   Layer 3: 13 MUST_SAVE, 120 PREFER_RECOMPUTE                                                                                                                                                    
  [rank0]:[titan] 2026-04-30 09:24:47,880 - root - INFO -   Layer 4: 13 MUST_SAVE, 120 PREFER_RECOMPUTE
  [rank0]:[titan] 2026-04-30 09:24:47,880 - root - INFO -   Layer 5: 13 MUST_SAVE, 120 PREFER_RECOMPUTE                                                                                                                                                    
  [rank0]:[titan] 2026-04-30 09:24:50,157 - root - INFO - Applied cudagraph pass.                                                    
  [rank0]:[titan] 2026-04-30 09:25:00,187 - root - INFO - step:  1  loss:  4.03640  grad_norm:  3.3902  memory:  1.93GiB(1.05%)  tps: 386  tflops: 0.21  mfu: 0.01%
  [rank0]:[titan] 2026-04-30 09:25:00,345 - root - INFO - step:  2  loss:  3.05691  grad_norm:  4.5189  memory:  1.93GiB(1.05%)  tps: 52,168  tflops: 28.32  mfu: 1.13%
  [rank0]:[titan] 2026-04-30 09:25:00,389 - root - INFO - step:  3  loss:  2.46308  grad_norm:  2.7644  memory:  1.93GiB(1.05%)  tps: 186,611  tflops: 101.32  mfu: 4.05%
  [rank0]:[titan] 2026-04-30 09:25:02,389 - root - INFO - Training completed                                                                                                                                                                               
  [rank0]:[titan] 2026-04-30 09:25:03,816 - root - INFO - Process group destroyed 
```

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/h100.8 Trigger H100.8 CI 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.

5 participants