Skip to content

[HybridEP] Read comm_backend from model config instead of ParallelismConfig - #3177

Merged
syed-ahmed merged 1 commit into
pytorch:mainfrom
syed-ahmed:fix-hybridep-comm-backend
Apr 30, 2026
Merged

syed-ahmed merged 1 commit into
pytorch:mainfrom
syed-ahmed:fix-hybridep-comm-backend

Conversation

@syed-ahmed

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

Copy link
Copy Markdown
Collaborator

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 

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 30, 2026
@syed-ahmed syed-ahmed added the ciflow/h100.8 Trigger H100.8 CI label Apr 30, 2026
@syed-ahmed
syed-ahmed force-pushed the fix-hybridep-comm-backend branch from 002ca91 to c00a971 Compare April 30, 2026 16:23
…Config

expert_parallel_comm_backend was removed from ParallelismConfig in
pytorch#3167 (ETP deprecation). Read comm_backend from the model's token
dispatcher config instead, which is set by moe_comm_backend in
model_registry / config factories.

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

Copy link
Copy Markdown
Collaborator Author

Will wait for the CI to be actually green this time.

@syed-ahmed

Copy link
Copy Markdown
Collaborator Author

The two failing tests are broken before the hybridep+graph_trainer PR at c4b409a:

So concluding the hybridep+graph_trainer PR doesn't introduce any new regressions, and merging.

@syed-ahmed
syed-ahmed merged commit 0138bde into pytorch:main Apr 30, 2026
15 of 17 checks passed
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.

3 participants