Repository navigation
Conversation
Lands the segKI design document next to its implementation (segment_ki.py, kernel_reference.py). The segKI implementation has already merged; this ships the accompanying design contract so agents and humans modifying segKI read the boundary, refresh_weights, lineage and extension policies before making changes. Signed-off-by: Guokai Ma <guokai.ma@intel.com>
Codex Review Summary: ✅ CompletedThis 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. |
segKI and PR #8602 have merged; the draft/submission note no longer applies. Signed-off-by: Guokai Ma <guokai.ma@intel.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10267b6553
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@jinyouzhi @nathon-lee @anyadontfly @LiRunGuo hoping to get your comments on this design doc. I hope we can build a design doc on segKI together that alignes with your planned optimizations on HybridEngineRollout. Thanks! |
Codex review on #9130 flagged that the design doc promised a refresh_weights() opbuilder contract while segki_refresh() still hardcoded the backend-internal clear_glu_cat_cache hook, so a new backend following the doc would silently serve stale derived caches. - fused_glu.cu: expose refresh_weights() (drops the backend-owned GLU concat cache); clear_glu_cat_cache stays internal. - segment_ki.py: segki_refresh() collects every injected opbuilder handle (_ki_gdn_op, _ki_dual_op) and calls refresh_weights() on each distinct handle; no backend-internal hook names remain in the dispatcher; a stateless backend omits the method and is skipped. - segki_design.md: refresh_weights is the contract (§2.1); §2.4 drops the not-yet-true 'alias' wording and describes the dispatcher walk. - tests: dispatcher contract unit tests (per-handle call, stateless skip, python-side cache drop). Signed-off-by: Guokai Ma <guokai.ma@intel.com>
Codex review on #9130: §2.2 claimed 'exactly 7 functions, one per compute interface method', but the file holds 5 compute-method references plus 2 glue ops, and gdn_recurrent_step / decode_step_graph have no function there at all — contradicting the porting instruction to treat those 7 functions as the whole math contract. State the real coverage and name the executable oracle for each of the two missing methods (FLA's public API; the decode_step_graph contract tests). Signed-off-by: Guokai Ma <guokai.ma@intel.com>
|
Pushed two commits addressing both Codex findings: 1.
2. §2.2 kernel_reference coverage stated accurately (2663f02) — doc-only: the file holds 5 compute-method references + 2 glue ops; CI re-running; pre-commit and the CPU test classes pass locally. |
Summary
Adds the segKI design document at
deepspeed/module_inject/segki_design.md, next to its implementation (segment_ki.py,kernel_reference.py). Starts as a doc-only change (one new file); commit 3 additionally makesrefresh_weightsa real opbuilder contract in code — see Update below.The segKI implementation has already merged; per the document's own rule — the implementation must stay in sync with it — this lands the accompanying design guide so agents and humans modifying segKI can read the contracts (opbuilder boundary, kernel_reference executable spec, refresh_weights, lineage and extension policies) before making changes.
The document was previously drafted on the
gma/segki-designbranch; this is its submission after PR #8602 merged, as noted in the doc header. Supersedes #9129.Update: refresh_weights is now the enforced contract (commits 3-4)
Codex review on this PR flagged two doc-vs-code drifts, both fixed:
refresh_weightswas only a paper contract. The doc promised auniform
refresh_weights()opbuilder method ("clear_glu_cat_cacheisits alias"), but
segki_refresh()hardcoded the backend-internalclear_glu_cat_cachehook — a new backend following the doc wouldsilently serve stale derived caches after an in-place weight sync.
Now enforced end to end:
fused_glu.cuexposesrefresh_weights()(drops the backend-ownedGLU concat cache;
clear_glu_cat_cachestays internal);segki_refresh()collects every injected opbuilder handle(
_ki_gdn_op,_ki_dual_op) and callsrefresh_weights()on eachdistinct handle — no backend-internal hook names in the dispatcher;
a stateless backend omits the method and is skipped;
TestSegkiRefreshDispatcherunit tests (CPU-safe) coverper-handle dispatch, stateless skip, and Python-side cache drops.
compute-method references plus 2 glue ops;
gdn_recurrent_step(FLA'spublic API) and
decode_step_graph(contract tests) intentionally haveno function there. §2.2 now says so and names the executable oracle for
each.