Repository navigation
Refresh skill docs for current multimodal/CUDA behavior - #282
Conversation
Update 3 high-priority skills to reflect current state: debugging-memcpy: - Opset lowering now disabled by default (opt-in via env var) - Remove recommendation to always lower opset; instead recommend updating ORT kernel registration - Add note: prefer float additive bias for complex attention patterns debugging-multimodal: - Opset lowering disabled by default - Add f32 Cast-at-entry as standard for encoder inputs - Add GQA for KV-shared layers via kv_sequence_length=0 quality-checklist: - Opset lowering disabled by default - Add: past_present_share_buffer must be false for dual head_dim - Add: verify f32 Cast-at-entry for encoder inputs Co-authored-by: Copilot <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Performance Comparison
|
There was a problem hiding this comment.
Pull request overview
Updates three high-priority internal “skills” documents to reflect the post-PR #281 default behavior (opset lowering now opt-in) and to add updated CUDA/multimodal guidance and checklist items.
Changes:
- Update opset-24/kernel-registration guidance to reflect
ort_lower_opset_for_epbeing disabled by default and enabled viaMOBIUS_ORT_LOWER_OPSET_FOR_EP=1. - Add multimodal guidance around encoder input casting and KV-shared attention/GQA notes.
- Extend the quality checklist with GenAI runtime configuration checks (e.g.,
past_present_share_buffer) and encoder input guidance.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .agents/skills/quality-checklist/SKILL.md | Updates CUDA checklist items for opset lowering defaults and adds GenAI/encoder-input checks. |
| .agents/skills/debugging-multimodal/SKILL.md | Refreshes CUDA gotchas section with opset-24 notes and new multimodal guidance. |
| .agents/skills/debugging-memcpy/SKILL.md | Removes “always lower opset” recommendation and reframes it as a historical workaround for older ORT. |
| ### f32 Cast-at-entry for encoder inputs | ||
|
|
||
| Vision and audio encoder inputs should be cast to float32 at the entry | ||
| of the encoder sub-model to prevent FP16 overflow in encoder operations. | ||
| Use the `_cast_encoder_input()` helper from `src/mobius/tasks/_base.py` | ||
| in all encoder task builders. This is now standard for all multimodal | ||
| tasks. |
| Models with KV-shared attention (e.g. Gemma4) can use | ||
| `GroupQueryAttention` for KV-shared layers by setting | ||
| `kv_sequence_length=0` to signal that the layer has no independent KV | ||
| cache. This eliminates Transpose/Reshape ops for cache handling. | ||
| See ORT PR microsoft/onnxruntime#28242. | ||
|
|
| - [ ] `past_present_share_buffer` must be `false` in `genai_config.json` | ||
| for models with dual head_dim (e.g. Gemma4: 256 for sliding, 512 | ||
| for full attention) — GenAI allocates uniform KV cache shapes |
| - [ ] Encoder inputs (vision/audio) use `_cast_encoder_input()` to cast | ||
| to float32 at sub-model entry, preventing FP16 overflow |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
titaiwangms
left a comment
There was a problem hiding this comment.
Review summary
Direction is right (treating opset lowering as a workaround, not the default), and the new checklist items are concrete. A few accuracy/freshness items below.
Verifications
- ✅ mobius#281 — MERGED 2026-05-06 ("Disable opset lowering by default") — matches PR description
⚠️ microsoft/onnxruntime#28242 — currently OPEN ("[GQA] Make present_key/present_value outputs optional and add Gemma4 support"). The new section indebugging-multimodal/SKILL.mdreads as if it has landed.- Cross-PR consistency: PR #283 (also under review) references microsoft/onnxruntime#28318 for the same shared-KV GQA feature. #28318 is closed as DUPLICATE; #28242 is the live PR. Both files should converge on a single canonical link.
Major
-
debugging-multimodal/SKILL.md"GQA for KV-shared layers" cites microsoft/onnxruntime#28242 as if the support exists. That PR is still open as of this review. A reader who setskv_sequence_length=0on stock ORT today will hit the failure modes documented in the (deduped) issue #28318. Either:- phrase as "requires ORT built with PR #28242 (not yet merged as of <date>)", or
- hold this section until the PR lands.
-
Cross-skill drift with PR #283. Once both PRs land, the repo will document the same shared-KV GQA mechanism with two different upstream references (#28242 here, #28318 in #283). #28318 is closed as DUPLICATE — make #28242 canonical and update both files to match. This is a tiny coordination cost now and a real grep-hazard later.
Minor
-
"Current ORT" / "newer ORT versions" needs a version pin. Three places replace prescriptions with phrases like "On current ORT this is unnecessary" and "This has been fixed in newer ORT versions." In 6 months "current" will be wrong. Pin the version where the kernel registrations actually landed (e.g. "Fixed in ORT ≥1.25") so a future reader can act without changelog spelunking.
-
debugging-memcpy/SKILL.mdcommented-out code. The diff comments out the opset-lowering snippet rather than deleting it:# if model.opset_imports.get("", 0) > 23: # model.opset_imports[""] = 23
Commented-dead-code-with-explanation is a smell — readers tend to copy the whole block including the comment. Either delete the lines (and rely on the NOTE comment alone) or extract the snippet into a clearly-labeled "If running on ORT ≤1.24.x" sub-section so it's clear it's a workaround path, not the default.
-
past_present_share_bufferchecklist item. "must befalsefor dual head_dim models (e.g. Gemma4: 256 for sliding, 512 for full attention)" — head_dim numbers are stated as fact but vary by Gemma4 variant (E2B vs E4B). If 256/512 is correct specifically for E2B, say so; otherwise verify against the variant you actually measured. (PR #283 makes a relatedhead_dim=512claim — same caveat applies; resolve them together.) -
_cast_encoder_input()reference. Naming the helper is good. A one-liner pointing to where it's called from (e.g. "called as the first step inside each encoder task'sbuild()") would help a reader adding a new multimodal task spot when it's needed without grepping.
Nit
- The MEA / float-additive-bias note ("prefer float additive bias for complex attention patterns") is good. One-line "why": bool masks broadcast inconsistently across batch with MEA, float additive bias doesn't. That's the actionable takeaway and the only reason a reader will remember the rule.
Praise
- The directional shift (lowering opset is a workaround, not the fix) is the right framing — encourages fixing ORT instead of permanently shimming around it.
- The env-var name
MOBIUS_ORT_LOWER_OPSET_FOR_EP=1is repeated consistently across all three files, keeping the workaround discoverable. - The new
past_present_share_bufferchecklist item captures a real footgun ingenai_config.jsonthat's easy to miss.
|
@copilot update according to the latest state of the code base. Also update PR description and title |
Updated to the latest codebase state in
Proposed PR title: Refresh skill docs for current multimodal/CUDA behavior Proposed PR description: |
Co-authored-by: Copilot Autofix powered by AI <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Align skill docs with current mobius behavior: encoder inputs are declared with config.dtype, KV-shared Gemma4 GQA emits empty K/V with runtime dependency on ORT KV-shared support, and quality checklist now points to search.past_present_share_buffer in genai_config.json.