Skip to content

ci: re-enable GLM-4.7-Flash ckpt save/load e2e test - #1592

Open
guapisolo wants to merge 6 commits into
mainfrom
ci/enable-glm47-flash-ckpt
Open

ci: re-enable GLM-4.7-Flash ckpt save/load e2e test#1592
guapisolo wants to merge 6 commits into
mainfrom
ci/enable-glm47-flash-ckpt

Conversation

@guapisolo

@guapisolo guapisolo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Re-enable GLM-4.7-Flash checkpoint CI without unsupported optimizer-memory settings.

Symptom & Reproduction

  • Symptom: tests/e2e/ckpt/test_glm47_flash_ckpt.py was disabled, leaving the save → load → async-save → load roundtrip without CI coverage.
  • Reproduction: python tests/ci/run_suite.py --hw cuda --suite stage-c-8-gpu-h200 --labels run-ci-ckpt --list-only omitted the disabled test before this PR.
  • Observed save failure: fully_reshardable triggered host OOM through 103–116 GiB of additional FP32 buffers per actor.

Root Cause

  1. register_cuda_ci kept the checkpoint roundtrip disabled after its original Megatron blocker was fixed.
  2. dp_reshardable keys param_state positionally, so uneven PP + MTP produced unmergeable optimizer lists.
  3. fully_reshardable uses name-keyed state but gathers every optimizer shard through FP32 buffers.
  4. HybridDeviceOptimizer ignores the three low-precision state dtypes, so TIGHT_HOST_MEMORY cannot shrink those buffers.

Fix

Re-enable the test in stage-c-8-gpu-h200 and remove the fully_reshardable save path, eliminating the profiled host-OOM allocation. Remove the ineffective FP16 optimizer-state overrides from CPU-offload E2E recipes and reject any non-FP32 optimizer-state dtype after Megatron argument normalization.

This fixes the observed host OOM only. The branch returns to dp_reshardable; the uneven-PP optimizer-list load mismatch remains unverified until the H200 checkpoint roundtrip completes.

Verification

  • Updated E2E: test_glm47_flash_ckpt.py is registered in stage-c-8-gpu-h200 under run-ci-ckpt; the remote checkpoint job has not completed yet.
  • New test: test_optimizer_cpu_offload_rejects_lower_precision_state_dtypes passes and verifies the fail-fast boundary.
  • Argument-path check: A real Megatron parse normalized all three requested dtypes to torch.float16, then Miles rejected the CPU-offload combination.
  • Recipe check: Shared Qwen3-30B-A3B/GLM-4.7-Flash recipes emit --optimizer-cpu-offload without the three low-precision dtype flags.

Review Focus

  • Scrutinize miles/backends/megatron_utils/arguments.py::validate_args for the CPU-offload dtype boundary.
  • Treat the H200 checkpoint roundtrip as the arbiter for the unresolved uneven-PP dp_reshardable load behavior.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request re-enables the GLM-4.7 flash checkpoint end-to-end test in the CUDA CI suite by removing the disabled parameter and its associated FIXME comment. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@guapisolo
guapisolo force-pushed the ci/enable-glm47-flash-ckpt branch from 65bf379 to 03f2dd6 Compare July 12, 2026 22:50
guapisolo and others added 4 commits July 14, 2026 04:01
Disabled in #1149 as "Disabled due to bugs" with a FIXME pointing at
Megatron. Since then the Megatron pin picked up the dist-ckpt load fix
for bare BytesIO _extra_state (radixark/Megatron-LM#53, fixes #1293),
and the sibling qwen3_4B ckpt test disabled in the same sweep proved
stale on re-run (#1271). The training config itself (TP2/PP2/CP2/EP4 +
MTP + EAGLE) already runs green in test_glm47_flash/test_r3_mtp; the
save -> load -> async_save -> load roundtrip is the only untested part.
Re-enable and let the run-ci-ckpt CI run on 8xH100 validate it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The re-enabled test fails deterministically at first load:
dist_checkpointing merge raises "Cannot merge two lists with different
lengths (736 and 768)" at ('optimizer', 1, 'param_state', ...). Under
dp_reshardable the expert optimizer's param_state is a positional
per-param list whose length differs across PP ranks (PP0 has 23 MoE
layers = 736 entries, PP1 has 23 + MTP = 768), and common.pt is written
from rank 0's view, so the other-shaped rank can never merge on load.
--dist-ckpt-optim-fully-reshardable stores optimizer state model-space
(name-keyed), which is PP-heterogeneity-safe; load follows the ckpt
metadata automatically. Optimizer DP=1 in this config, so the
save-side gather costs nothing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Round 2 moved the failure from load to save: fully_reshardable's
default NCCL variant all-gathers optimizer state into GPU buffers and
died allocating 12.94 GiB with 8.47 GiB free on the 80 GB H100 (the
state normally lives CPU-side under --optimizer-cpu-offload).
--distrib-optim-fully-reshardable-mem-efficient switches the gather to
Gloo, keeps it in host memory, and returns it only on DP rank 0 --
matching this test's CPU-offloaded optimizer; the DP=1 layout makes
the lost save parallelism irrelevant. Requires gloo process groups,
which are on by default.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Run the checkpoint roundtrip in the 8-GPU H200 suite and enable its tight-host-memory configuration by default for the target CI environment.
@guapisolo
guapisolo force-pushed the ci/enable-glm47-flash-ckpt branch from b08d4f0 to 660421a Compare July 14, 2026 11:01
The GLM checkpoint CI allocates excessive FP32 gather buffers in fully-reshardable mode. Use dp_reshardable and disable the ineffective tight-host-memory override by default.
HybridDeviceOptimizer forces master parameters and Adam states to FP32 while accepting lower-precision dtype flags. Remove those flags from shared E2E recipes and fail validation instead of silently ignoring them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant