Skip to content

Raise GPT-OSS Dynamo recompile limit - #3737

Merged
aditvenk merged 2 commits into
mainfrom
aditvenk/recompile-fix
Jun 23, 2026
Merged

aditvenk merged 2 commits into
mainfrom
aditvenk/recompile-fix

Conversation

@aditvenk

Copy link
Copy Markdown
Contributor

Fixes the gpt-oss FSDP+TP+EP+compile integration test with newer PyTorch.

GPT-OSS TP/EP compile can specialize on AsyncCollectiveTensor vs Tensor states, and sliding-window attention adds extra variants. Raise Dynamo's recompile limit locally for this path so fullgraph compile does not fail before all expected variants are cached.

The underlying Dynamo caching issue is tracked at pytorch/pytorch#187073.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 22, 2026
@aditvenk
aditvenk force-pushed the aditvenk/recompile-fix branch from c144943 to fbb100c Compare June 22, 2026 20:58
Comment on lines +101 to +102
if parallel_dims.tp_enabled or parallel_dims.ep_enabled:
_raise_dynamo_recompile_limit(model)

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.

maybe we can delete this which is for inference only?

# With TP, collectives may return AsyncCollectiveTensor (overlap
# path) or plain Tensor (sync path) depending on timing. Dynamo
# specializes on tensor type, so each switch triggers a
# recompile. Because of this, the default recompile_limit (8) is
# too low; exceeding it fails under
# fullgraph=True so set to 10 for now and bump to 12 for sliding window
has_sliding_window = any(
getattr(layer_cfg.attention, "sliding_window_size", None) is not None
for layer_cfg in model_config.layers
)
if compile_config.enable:
torch._dynamo.config.recompile_limit = 12 if has_sliding_window else 10

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Were they running into this inference issue with gpt-oss ? I wonder if some other model also needs this recompile limit increase...

@tianyu-l tianyu-l Jun 23, 2026 •

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.

Yes, it was for gpt-oss. I think gpt-oss is unique because it's the only model with sliding window attention (non homogenous across all layers)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, I can remove it. I hope it will be tested sufficiently if I trigger RL ci flow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed.

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.

Fixes the gpt-oss FSDP+TP+EP+compile integration test with newer PyTorch.

GPT-OSS TP/EP compile can specialize on AsyncCollectiveTensor vs Tensor states, and sliding-window attention adds extra variants. Raise Dynamo's recompile limit locally for this path so fullgraph compile does not fail before all expected variants are cached.

The underlying Dynamo caching issue is tracked at pytorch/pytorch#187073.
@aditvenk
aditvenk force-pushed the aditvenk/recompile-fix branch from fbb100c to 325a40e Compare June 23, 2026 00:54
Update rl_grpo_moe_debug_tp4_ep4 to use the GPT-OSS debug varlen config while preserving the existing CI selector name.

@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.

trunk was broken due to another issue @pianpwk is resolving.

@aditvenk

Copy link
Copy Markdown
Contributor Author

trunk was broken due to another issue @pianpwk is resolving.

@tianyu-l I will wait for RL CI in trunk to be fixed. looks like RL tests are stopping on first failure and so I am not able to test the modified integration test in this PR.

@aditvenk
aditvenk merged commit 46c7971 into main Jun 23, 2026
20 of 24 checks passed
aryamazaheri added a commit to PanocularAI/torchtitan that referenced this pull request Sep 30, 2026
Controller._start_rollout_producers/_stop_rollout_producers factor the
producer pipeline (rollout workers + data input) out of run(), and
RolloutGroupWorkBuffer gains pause()/resume(), so panofabric-engine's
decentralized_rl windowed loop can drive the consume side itself and keep
rollouts from straddling an outer weight merge.

Rebased onto upstream a182e53 (torchtitan/experiments/rl -> torchtitan/rl,
pytorch#4773). Dropped from this commit versus the 1c7ab80 rebase:
- the HF transformers-backend vLLM glue (vllm_wrapper/vllm_registry/
  attention): it composed at ModelSpec, which pytorch#4810 deleted, and only served
  the never-working rl_*_hf* A/B baseline presets.
- the global torch._dynamo recompile_limit = 10: a stale copy of code
  upstream moved into models/gpt_oss in pytorch#3737.
- a comment-only hunk in training_sample_builder.py.

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

Labels

ciflow/rl ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants