Enhance mla numeric check mechanism#137
Merged
msaroufim merged 1 commit intogpu-mode:mainfrom Mar 18, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts correctness checking for the AMD 202602 Mixed-MLA problem by adding an MLA-specific “mismatch ratio” allowance in the shared match_reference helper, and by loosening the Mixed-MLA reference tolerances. It also refactors the Mixed-MLA submission template to use an aiter persistent MLA decode path and expands the inline documentation.
Changes:
- Add
_is_mla_casedetection and an MLA-only mismatch-ratio “pass with warning” path inmatch_reference. - Update Mixed-MLA submission template to call aiter
mla_decode_fwdwith persistent-mode metadata helpers. - Loosen Mixed-MLA
check_implementationtolerances (rtol/atol) inreference.py.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
problems/amd_202602/utils.py |
Adds MLA-case detection and a mismatch-ratio relaxation path in match_reference. |
problems/amd_202602/mixed-mla/submission.py |
Refactors the template to an aiter-based decode reference path and adds quant/dequant helpers and metadata plumbing. |
problems/amd_202602/mixed-mla/reference.py |
Loosens check_implementation rtol/atol thresholds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
24
to
+26
| import torch.nn.functional as F | ||
| from task import input_t, output_t | ||
| from utils import make_match_reference |
Comment on lines
+268
to
+274
| page_size=PAGE_SIZE, | ||
| nhead_kv=nkv, | ||
| sm_scale=SM_SCALE, | ||
| logit_cap=0.0, | ||
| num_kv_splits=NUM_KV_SPLITS, | ||
| q_scale=q_scale, | ||
| kv_scale=kv_scale, |
Comment on lines
+152
to
+160
| # Only for MLA: aligned with aiter | ||
| if (not good) and _is_mla_case(data) and output.shape == expected.shape: | ||
| mismatch_mask = ~torch.isclose(output, expected, rtol=rtol, atol=atol) | ||
| mismatch_ratio = (mismatch_mask.sum() / output.numel()).item() | ||
| if mismatch_ratio <= tol_err_ratio: | ||
| return True, ( | ||
| f"warning: mismatch_ratio={mismatch_ratio:.6f} " | ||
| f"(<= tol_err_ratio={tol_err_ratio}) with rtol={rtol}, atol={atol}" | ||
| ) |
|
|
||
|
|
||
| check_implementation = make_match_reference(ref_kernel, rtol=2e-02, atol=2e-02) | ||
| check_implementation = make_match_reference(ref_kernel, rtol=1e-01, atol=1e-01) |
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.
No description provided.