cosmos3: re-pin to cosmos-framework HEAD (5eee9ed) + unblock torch.compile on H100/H200 - #1237
Open
bluecrayon52 wants to merge 7 commits into
Open
cosmos3: re-pin to cosmos-framework HEAD (5eee9ed) + unblock torch.compile on H100/H200#1237bluecrayon52 wants to merge 7 commits into
bluecrayon52 wants to merge 7 commits into
Conversation
…chcodec 0.10 needs ffmpeg<=7)
…ompile on H100/H200 torch.compile-enabled MoT post-training OOMs at loss.backward() compile on p5/p5en: PyTorch 2.10 Inductor's mix-order-reduction fusion (new in 2.10) fuses the Qwen3-VL RMSNorm backward reductions + RoPE token-mask into one persistent Triton kernel over the full hidden axis, needing ~272 KB shared memory vs the ~227 KB/SM limit -> 'No valid triton configs. OutOfMemoryError: out of resource: shared memory'. Set TORCHINDUCTOR_MIX_ORDER_REDUCTION=0 as a Dockerfile ENV so Inductor emits the reductions as separate looped (non-persistent) kernels that fit shared memory, keeping compile enabled with no measured throughput regression. Documented in README under Software versions; upstream bug tracked at pytorch/pytorch#175250 (remove the env var once the pinned torch has the fix). Validated on the re-pinned HEAD image: single-node 20-iter + 2x p5en 100-iter compiled DROID action-policy training reach completion with DCP checkpoints and 0 OOM (previously OOM'd at first backward compile).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Re-pin the Cosmos 3 sample (
3.test_cases/pytorch/cosmos3) fromcosmos-framework90cd348to HEAD5eee9ed, adapt to the framework's breaking changes, drop a now-redundant monkeypatch, and unblocktorch.compile-enabled training on H100/H200 (p5/p5en).Changes
Framework adaptation (breaking changes carried from the pin bump):
data.vfm→data.generator(B1/B2) across the action-policy src + tests."policy"→"wam"(B3), matching the framework's renamed vocabulary.cosmos-frameworkpin90cd348→5eee9ed(Dockerfile + build script +env_vars.example).NormMonitormonkeypatch (norm_monitor_guard.py+sitecustomize.py) — fixed upstream; one runtime patch (the wandb→OTLP bridge) remains.7.1.xgpl-shared build (the previous asset 404'd; torchcodec 0.10 requires FFmpeg ≤ 7).torch.compile fix (H100/H200 shared-memory OOM):
TORCHINDUCTOR_MIX_ORDER_REDUCTION=0as a DockerfileENV, with a README note under "Software versions".On PyTorch 2.10 (new in 2.10; the same code compiles on 2.9), Inductor's mix-order-reduction fusion fuses the Qwen3-VL RMSNorm backward reductions together with the RoPE token-mask into a single persistent Triton reduction kernel over the full hidden axis. That kernel needs ~272 KB of shared memory, over the ~227 KB-per-SM limit on H100/H200, so the first
loss.backward()fails to compile with:Disabling just that fusion makes Inductor emit the reductions as separate looped (non-persistent) kernels that fit shared memory —
torch.compilestays enabled with no measured throughput regression. This is an upstream PyTorch bug with a fix in flight; tracked at pytorch/pytorch#175250. The env var can be removed once the pinned PyTorch version includes the fix.Validation
Validated end-to-end on the re-pinned image (clean HEAD framework + the Dockerfile
ENV, no source patch), single- and multi-node:NET/OFI … provider efa, efa-direct, 16 nics, 16 ranks),torch.compilesucceeds, 0 OOM, 100 iterations,Done with training, DCP checkpoint +latest_checkpoint.txtwritten.POST /v1/videos/sync→ HTTP 200, valid MP4 (h264, 1280×704, 121 frames).GET /info→ HTTP 200 with a valid model-info payload.ENV, so no per-manifest change is needed.Notes
TORCHINDUCTOR_MIX_ORDER_REDUCTION=0env var is a temporary workaround for the pinned torch 2.10; remove it once torch carries the #175250 fix.