fix(repo): main 복구 -- #230 이 되돌린 다른 세션의 작업 33 파일 복원 + KDA 2라운드 재적용 - #232
Conversation
… KDA 2라운드 변경만 다시 적용 워크트리들이 .git 을 공유해 다른 세션의 fetch 가 내 origin/main 을 새 main(0bd06b7)으로 올려놓은 상태에서, 옛 base(83c2896) 기준 작업 트리를 `git reset --soft origin/main` 으로 스쿼시하자 #226~#229 의 추가분(prep_fused v2, indexer gate split-K, step-composition 문서, 프로필, 테스트, tools/probes)을 통째로 지우는 커밋이 만들어졌고 #230 으로 머지됐다(#224 도 같은 방식으로 prep_fused 를 한 번 지웠다). 이 커밋 = 0bd06b7 의 전체 트리 + (83c2896..7a287e0 의 megakernel .cu / README / tests / MEASUREMENTS 차이, 3-way 적용, 충돌 없음) + 복구된 프로필로 다시 합성한 build/glm53 (33 overlays from 22 modules). 0bd06b7 대비 바뀐 파일은 KDA 2라운드의 5개뿐이다. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
리뷰 처리분 (main 복구 #232 위에 재적용). 자율 머지 위임 범위.
There was a problem hiding this comment.
🟡 Changes recommended
The newly added probe/tools scripts have confirmed runtime errors on valid inputs (CUDA/CPU mask mismatch and unguarded indexing on short/no-gate traces) that should be fixed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Restores and re-applies previously reverted GLM53 optimization work by introducing three opt-in overlay modules (prep-fused, async-dflash allowlist, indexer head-gate split-K), plus accompanying probes, documentation, and contract-style logic tests to prevent silent drift/regressions.
Changes:
- Add
glm53_prep_fusedoverlay to fuse decode-step host-side input prep into a single Triton launch (with preimage pinning + shadow/self-check modes). - Add
glm53_async_dflashoverlay to allow async scheduling fordflashbehind an explicit env knob. - Add
glm53_indexer_gate_splitkoverlay to optionally replace the indexer fp32 head-gatetorch.mmwith a split-K Triton kernel for small-M decode shapes, and wire it into both attention + prefill fastpath.
File summaries
| File | Description |
|---|---|
| tools/trace_step_timeline.py | Adds a trace timeline helper (needs a couple robustness guards). |
| tools/trace_step_composition.py | Adds per-step kernel-category composition analysis (needs a guard for short traces). |
| tests/test_logic.py | Expands overlay contract tests and makes symbol-contract checking profile-aware. |
| STEP_KERNEL_MAP.md | Adds supplemental trace decomposition/interpretation write-up. |
| RUNBOOK_KERNEL_CAMPAIGN2.md | Updates runbook and adds EXP-7/8/9 arming ladders and caller-env guidance. |
| profiles/glm53.env | Mounts the new overlay modules and introduces new opt-in knobs (default off). |
| probes/run_prep_fused_check.sh | Adds a containerized probe wrapper with base-preimage verification. |
| probes/prep_fused_check.py | Adds an offline bit-exactness + timing probe for prep-fused (has a device bug). |
| probes/moe_gate_tile_sweep.py | Adds an offline Triton tile sweep script for MoE gate kernel configs. |
| probes/indexer_gate_check.py | Adds offline numerics + timing probe for indexer head-gate split-K. |
| overlay/modules/glm53_prep_fused/requires | Declares module dependencies for prep-fused overlay. |
| overlay/modules/glm53_prep_fused/README.md | Documents rationale, contract, guards, and arming for prep-fused. |
| overlay/modules/glm53_prep_fused/manifest.tsv | Adds the new glm53_prep_fused.py file to the overlay manifest. |
| overlay/modules/glm53_model_wiring/glm5next_model.py | Installs prep-fused at model init with safe ImportError handling. |
| overlay/modules/glm53_model_wiring/glm53_prefill_fastpath.py | Routes indexer head-gate through a lazily-resolved helper. |
| overlay/modules/glm53_indexer_gate_splitk/requires | Declares dependency on model wiring for the split-K module. |
| overlay/modules/glm53_indexer_gate_splitk/README.md | Documents split-K behavior, numerics caveat, and arming. |
| overlay/modules/glm53_indexer_gate_splitk/manifest.tsv | Overlays attention.py and adds glm53_indexer_gate.py into image. |
| overlay/modules/glm53_indexer_gate_splitk/glm5next_attention.py | Attention overlay uses _glm53_head_gate helper for head-gate projection. |
| overlay/modules/glm53_indexer_gate_splitk/glm53_indexer_gate.py | Implements split-K Triton kernel and opt-in routing logic. |
| overlay/modules/glm53_async_dflash/README.md | Documents async-dflash allowlisting mechanism and operational checks. |
| overlay/modules/glm53_async_dflash/manifest.tsv | Overlays vllm/config/vllm.py with a pinned preimage. |
| MEASUREMENTS.md | Records trace findings and offline measurements for EXP-7/8/9 and lever analysis. |
| build/glm53/manifest.tsv | Updates composed build manifest to include new overlay artifacts. |
| build/glm53/glm5next_model.py | Composed build output mirroring wiring changes for prep-fused install. |
| build/glm53/glm5next_attention.py | Composed build output mirroring attention overlay changes. |
| build/glm53/glm53_prep_fused.py | Composed build output for prep-fused implementation. |
| build/glm53/glm53_prefill_fastpath.py | Composed build output mirroring fastpath head-gate helper routing. |
| build/glm53/glm53_indexer_gate.py | Composed build output for split-K head-gate kernel helper. |
Review details
Suppressed comments (1)
tools/trace_step_timeline.py:27
gates[0]andstatistics.median(...)will crash when there are no_deneb_gate_partial*kernels in the selected step segment. Handle the empty case so the timeline tool still works on traces without gate kernels.
- Files reviewed: 30/33 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| nacc = rs["num_accepted"].new_ones(num_reqs) | ||
| nacc[:num_reqs] = rs["num_accepted"][idx_mapping] | ||
| # GDN builders, FULL branch, all rows spec decodes (gdn_attn.py build()) | ||
| mask_cpu = torch.ones(num_reqs, dtype=torch.bool) |
| starts = [i for i, e in enumerate(ev) if e["name"].startswith("_gather_block_tables_kernel")] | ||
| print("kernels", len(ev), "steps (gather_block_tables)", len(starts)) |
| starts = [i for i, e in enumerate(ev) if e["name"].startswith("_gather_block_tables_kernel")] | ||
| a, b = starts[10], starts[11] | ||
| seg = ev[a:b] |


무엇이 잘못됐나
워크트리들이
.git을 공유하므로 다른 세션의git fetch가 이 세션의origin/main참조를 새 main(0bd06b7)으로 올려놓았고, 옛 base(83c2896) 기준 작업 트리를git reset --soft origin/main으로 스쿼시한 커밋(7a287e0)이 #226~#229 의 추가분을 통째로 되돌린 채 #230 으로 머지됐습니다(36 파일, 11,145 줄 삭제). 감사 결과 #224(MHC)도 같은 방식으로 prep_fused 작업을 한 번 지웠고, 그쪽이 #226/#228 로 다시 올렸던 것입니다.이 PR
0bd06b7(머지 직전 main)의 전체 트리로 되돌린 뒤, KDA 2라운드의 진짜 차이(83c2896..7a287e0 의 megakernel
.cu/ README / tests / MEASUREMENTS)만 3-way 로 재적용(충돌 없음)하고 복구된 프로필로 build/glm53 을 다시 합성했습니다(33 overlays from 22 modules).git diff --stat 0bd06b7= KDA 2라운드의 5개 파일뿐(MEASUREMENTS +6, README, overlay/buildglm53_megakernel.cu, tests +27).tests/test_logic.py통과(그쪽 테스트 + 내 계약).재발 방지(메모리에 기록): 스쿼시 base 는
git merge-base origin/main HEAD; PR 전git fetch origin && git diff --stat origin/main...HEAD로 내 파일만인지 확인; 머지 후 first-parent diff 로 삭제 여부 확인.🤖 Generated with Claude Code
Note
High Risk
Changes decode input preparation, speculative scheduling, and fp32 indexer numerics on serving-critical paths; mitigated by env opt-in, preimage DISARM, and shadow/self-check for prep-fused, but armed modes can still affect KV/attention if guards fail.
Overview
Restores GLM-5.3 kernel-campaign work that had been dropped from main, alongside documentation and build/glm53 artifacts for three opt-in decode optimizations.
glm53_prep_fused(EXP-7) adds a Triton fused prep path that replaces per-step eagerprepare_inputs/prepare_attn/ KV metadata builders with one H2D copy, one_glm53_prep_fused_kernellaunch, and deep_gemm schedule setup. It patches the V2 GPU runner (preimage checks, shadow/self-check, live UVA handle reads, metadata cache for DFlash-only boots).glm53_async_dflash(EXP-8) vendors a forkedconfig/vllm.pywith_deneb_dflash_async_oksoVLLM_GLM53_ASYNC_DFLASH=1whitelists dflash for async scheduling (stock vLLM disables async for dflash by method name only).glm53_indexer_gate_splitk(EXP-9) adds a small-M Triton split-K head-gate and wiresglm53_prefill_fastpaththrough_glm53_head_gatewhenVLLM_GLM53_INDEXER_GATE_SPLITK=1.MEASUREMENTS.md, STEP_KERNEL_MAP.md, and RUNBOOK_KERNEL_CAMPAIGN2.md document trace-driven ceilings, v2 offline gates, and experiment ladders; the runbook also fixes megakernel launcher examples to use caller env instead of invalid
EXTRA_ENV=profile keys.Reviewed by Cursor Bugbot for commit 0e01d48. Bugbot is set up for automated code reviews on this repo. Configure here.