Skip to content

[HIP] [Perf] MLA: Run 96-head FP8 decode natively at qlen 7–8 under round-robin CP - #7245

Open
yuychang wants to merge 16 commits into
ROCm:mainfrom
yuychang:k3/mla-native-96-qlen8
Open

yuychang wants to merge 16 commits into
ROCm:mainfrom
yuychang:k3/mla-native-96-qlen8

Conversation

@yuychang

@yuychang yuychang commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Run 96-head FP8 MLA decode natively at query lengths 7–8 under round-robin context parallel (CP) on gfx950, on the existing qh32_qseqlen4 kernel.
  • Without CP, these shapes keep the folded route (six 16-head pseudo-batches).
  • Metadata buffers for these shapes shrink to one sixth.

Motivation

  • Kimi-K3 DCP8 with DSpark block 7 verifies 8 tokens over 96 gathered heads per rank.
  • On main, AITER folds this into six 16-head pseudo-batches. The fold adds about 0.1 ms of copy and index work per call.
  • SGLang and vLLM avoid the fold by padding to 128 heads. That adds a padding copy and 33% more head rows.
  • Native 96-head execution removes both costs and lets callers drop the 128-head padding.

Changes

Area Change
Head planner (csrc/include/mla_decode_shape.h, metadata.cu, v1_2_device.cuh) New cp_round_robin input. 96 FP8 heads stay native up to qlen 8 only under round-robin CP (was qlen ≤ 6).
Kernel routing (asm_mla.cu, opus_mla_decode_fwd.cu) ASM remap and OPUS a8w8 route accept 96 heads up to qlen 8.
Metadata sizing (get_mla_metadata_info_v1) Sizes for both the CP and the non-CP plan. At qlen 8, qo tiles per request go from 48 to 8.
CP-mode contract (get_mla_metadata_v1, mla_decode_fwd) get_mla_metadata_v1 records is_cp_round_robin with work_metadata_ptrs (on its storage, so views and deep copies keep it). mla_decode_fwd runs the head plan the record names; g_kv_indptr only selects the CP kernel. It raises ValueError only where CP changes the head plan and the mode is unknown (a clone/copy_ of the buffer) or CP-planned metadata gets no g_kv_indptr.
decode_update_mla_metadata_v1 Raises ValueError on metadata planned with is_cp_round_robin=True only where CP changes the head plan (96 fp8 heads, qlen 7-8, gfx950); elsewhere it updates as before (KV grows by 1 - num_reject_tokens).
Tests Planner, dispatch, FP32 reference, metadata sizing, CP boundary and CP-mode mismatch coverage.

Native-route condition (v1_2 / fast-mode planner):

Condition Route
gfx950, 96 heads, FP8 Q and KV, qlen ≤ 6 Native (unchanged)
Same, qlen 7–8, round-robin CP Native (new)
Same, qlen 7–8, no CP Folded (unchanged)
Same, qlen ≥ 9 Folded (unchanged)

Performance (if applicable)

Kernel setup (author): MI355X, DCP8 rank 0, query length 8, FP8 Q/KV, page size 1, LSE, AITER-planned KV splits. Median of 20 complete mla_decode_fwd calls, each after a 1 GiB cache flush. SGLang's padding copy is excluded. Baseline and PR alternate twice on one GPU; the table shows the mean; the two rounds differ by at most 3.9%.

Hardware Workload (batch, global context) Folded 96 (µs) Padded 128 (µs) Native 96 (µs) vs. folded vs. padded
MI355X 1, 16K 121.5 45.5 36.0 3.38× 1.27×
MI355X 1, 64K 140.2 54.0 44.7 3.14× 1.21×
MI355X 1, 350K 180.6 98.5 89.8 2.01× 1.10×
MI355X 4, 16K 146.4 52.2 45.6 3.21× 1.14×
MI355X 4, 64K 177.8 80.6 74.3 2.39× 1.08×
MI355X 4, 350K 301.4 265.1 242.3 1.24× 1.09×
MI355X 16, 16K 189.2 87.9 78.7 2.41× 1.12×
MI355X 16, 64K 268.8 206.9 188.6 1.43× 1.10×
MI355X 16, 350K 808.9 923.6 850.8 0.95× 1.09×
MI355X 56, 16K 311.2 201.1 187.1 1.66× 1.07×
MI355X 56, 64K 627.5 670.3 615.4 1.02× 1.09×
MI355X 56, 350K 2722.7 3392.0 3304.7 0.82× 1.03×
  • Speedup = baseline latency / native latency. Below 1× is a regression.
  • Native beats padded in every case. Folding still wins at 350K context with batch ≥ 16. With a split cap of 32, native is 1–10% faster than padded and 6–37% slower than folded at 350K.
  • Non-CP stays folded: an earlier native experiment regressed at larger batches and with capped splits. Main's plan/work counts are kept in all 44 checked non-CP cases.

Re-measured at 9ee92f116 (review run): MI355X (gfx950), one GPU, op_tests/test_mla_persistent_round_robin.py -d fp8 -kvd fp8 -n 96,7 96,8 -b 1 16 56 -c 16384 65536 -cpw 8 -ms 32 -lse, cp:rank_us column, base 274a74024 (merge base) vs head, 2 alternating rounds, mean. Same-harness per-rank latency, no cache flush; not comparable to the table above.

Hardware Workload (qlen, batch, global context) Before (µs) After (µs) Change
MI355X 7, 1, 16K 80.2 37.3 2.15×
MI355X 7, 1, 64K 92.4 82.0 1.13×
MI355X 7, 16, 16K 133.8 77.7 1.72×
MI355X 7, 16, 64K 243.2 185.6 1.31×
MI355X 7, 56, 16K 282.6 189.2 1.49×
MI355X 7, 56, 64K 602.8 563.8 1.07×
MI355X 8, 1, 16K 80.7 31.1 2.59×
MI355X 8, 1, 64K 93.6 55.8 1.68×
MI355X 8, 16, 16K 141.0 72.6 1.94×
MI355X 8, 16, 64K 253.0 186.2 1.36×
MI355X 8, 56, 16K 295.5 180.5 1.64×
MI355X 8, 56, 64K 613.3 605.7 1.01×

Testing

  • Add or update unit coverage.
  • Run performance benchmarks.
  • Validate on MI250X.
  • Validate on MI300X (only the two pytest files below).

Model accuracy (GSM8K): SGLang Kimi-K3, TP8/DCP8, DSpark block 7, FP8 KV, AITER-planned splits; sgl-eval 0.1.3, K3 preset, all 1,319 questions, real acceptance.

Verify configuration GSM8K
Native 96 heads (this PR) 95.00%
Padded 128 heads (baseline) 94.69%

Kernel checks found native output bitwise equal to the first 96 heads of padded output at every benchmark point.

Documentation

  • Refresh docstrings.
  • Update the user guide.
  • Update the performance guide.
  • No documentation update is required; explain below.

Docstrings state the CP metadata/decode flag contract and the incremental-update limit. User and performance guides are not changed.

Dependencies

  • No new external dependencies.
  • Describe additional dependencies below.

Breaking Changes

  • No public signature changes. Routing changes only for the gated shapes; metadata buffers get smaller.
  • New ValueErrors on misuse that was silently wrong before:
    • mla_decode_fwd, at 96 fp8 heads and qlen 7-8 only, when the planned CP mode is unknown (a cloned buffer) with g_kv_indptr, or CP-planned metadata gets no g_kv_indptr.
    • decode_update_mla_metadata_v1, on metadata planned with is_cp_round_robin=True at 96 fp8 heads, qlen 7-8.

PR Self-Review

Reviewed revision

9ee92f1164acfc61a0a8148c123644e8bc422e29

Behavior and intent

  • Native execution lets callers drop 128-head padding for 96-head FP8 round-robin CP verify at qlen 7–8.
  • Non-CP keeps folding because the fold is faster at larger batches.

Review findings (AITER review-pr + code-review, at cd1d49c4e)

Finding Result
mla_decode_fwd repeated the 10-argument launch-plan call for the CP-mismatch check Fixed in 9ee92f116 (shared argument tuple)
CP flag lives on the work_metadata_ptrs tensor object, so a view or copy skips the check Fixed in c08e32485: the mode is recorded on the buffer's storage; an unknown mode under CP raises instead of running a mismatched plan
Check fires only when the head plan changes, not on every CP-mode mismatch Kept: other shapes differ only in causal trim, and SGLang plans some DCP decode metadata without the flag, so a strict check would break it
Native under CP at any context length, though folding wins at 350K, batch ≥ 16 Kept: the head plan cannot see KV lengths (buffers are sized and graphs captured before them); native beats the 128-head padding callers use today in every case
Metadata sizing as the max of both plans could grow non-CP buffers Not a regression: measured sizes at qlen 7–8 are 1/6 of main for all callers, and equal at qlen 6
ASM/OPUS routing accepts 96 heads at qlen ≤ 8 without a CP check Not reachable without CP: the planner folds to 16 heads, and non-persistent 96-head launches fail before the remap on main too
decode_update_mla_metadata_v1 rejects all CP metadata Fixed in c08e32485: rejected only where CP changes the head plan
Shard 4 of Standard Tests (MI35X) failed on cd1d49c4e Infra: the step hit the 90-minute timeout in MoE tests, not in a test this PR changes

Validation and unverified scope

At 9ee92f116 on MI355X (gfx950), one GPU:

Check Result
validate-kernel-pr on op_tests/test_mla_shape_support.py, base f60ee45dd (main) vs head Merge-sim pass; head 18 passed / 1 skipped, base 14 passed / 1 skipped; verdict INCONCLUSIVE only because no shape grid or perf harness exists for this target
pytest op_tests/test_mla_shape_support.py op_tests/test_mla_decode_update_metadata.py 66 passed, 29 skipped, 6 xfailed (incl. an OPUS-route FP32-reference case at 96 heads, qlen 7-8, CP)
test_mla_persistent_round_robin.py -n 96,6 96,7 96,8 128,8 -b 1 32 -c 1200 8192 -cpw 8 -ms 32 -lse 225 checks passed, 0 failed
Non-CP 96-head persistent decode at qlen 6/7/8 vs FP32 causal reference Max abs error 0.041 / 0.036 / 0.033

Earlier author validation (at 0e47dbf88 / cd1d49c4e):

Check Result
Shape-support pytest (MI355X) 17 passed, 1 skipped
Round-robin CP sweep (MI355X) 266/2,520 tolerance checks failed; main: 271/2,520; no tracebacks (ref-vs-ref fails too)
OPUS CP sweep (AITER_MLA_USE_OPUS=1), 96 heads at qlen 7–8 and 128 at qlen 8 0 failed checks
Non-CP persistent sweep 29/131 failed checks on both revisions; no tracebacks
MI300X (gfx942) shape-support pytest at cd1d49c4e 15 passed, 4 skipped (gfx950/gfx1250-only tests)
MI300X test_mla_decode_update_metadata.py 26 passed, 54 skipped (existing arch gates)
  • Unverified: MI250X, MI300X beyond the two pytest files, gfx1250, and the experimental HK route.
  • With AITER_ENABLE_EXPERIMENTAL, the affected CP shape now selects ASM instead of HK.
  • The existing sparse legacy-table/planner query-length mismatch is outside this change.

PR-specific question

  • The new native boundary needs gfx950, 96 heads, FP8 Q and KV, round-robin CP, qlen 7 or 8.
  • Plan with is_cp_round_robin=True to get the native 96-head CP route; metadata planned without it still runs the fold under CP, as before. mla_decode_fwd raises only for an unknown mode (cloned buffer) at the affected shapes.

Changed op tests

  • op_tests/test_mla_shape_support.py: CP/non-CP boundary verdicts, planner/dispatch agreement, metadata bounds, rejection of metadata planned for the other CP mode, rejection of CP metadata by decode_update_mla_metadata_v1, and output/LSE against an FP32 causal reference on CP rank 3 of 8.
  • op_tests/test_mla_persistent_round_robin.py: adds (96, 7) to the default sweep, so the new lower boundary runs through the CP pipeline.

…8 on gfx950

- Raise the native 96-head limit from qlen 6 to 8 in the planner, the asm remap, the opus route and the Python table
- The qh32_qseqlen4 tile takes one token per 128-row tile, so qlen 7 and 8 need no kernel change, only the dispatch
- Before, 96 heads at qlen 7-8 folded into six 16-head pseudo-batches; Kimi-K3 DSpark block 7 verifies 8 tokens
- test_mla_shape_support pins native at qlen 6-8 and the fold at 9, and checks the launch agrees with the verdict there
- The round-robin test also sweeps 96 heads at qlen 7
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 7245 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@aiter-bot

aiter-bot commented Oct 31, 2026 •

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 307f50eb2188 · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which architecture, dtype and shape boundaries select the changed kernel path, and what invariant prevents unsupported inputs from reaching it?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

…eference

- test_native_96_head_fp8_decode_matches_reference runs the native route against an fp32 causal MLA reference on gfx950
- It fails on main, where 96 heads at qlen 7-8 still fold, and passes here
- _run_decode returns its output and inputs for the comparison
- Format test_mla_persistent_round_robin.py's default head list with Black
…robin CP

- Without CP the fold beats native from batch 16 up and under a fixed split cap at long context, so it stays there
- mla_decode_head_plan_v1_2 and mla_decode_head_plan take cp_round_robin; the planner and the head-plan query pass it
- The asm remap and the opus route still accept 96 heads at qlen <= 8: without CP the planner folds before them
- get_mla_metadata_info_v1 cannot tell CP apart, so it sizes for both plans: 8 qo tiles per request at qlen 8, not 48
- Document that is_cp_round_robin must match g_kv_indptr and that decode_update_mla_metadata_v1 is not for CP
- test_mla_shape_support: verdicts, planner agreement and launches with and without CP, a CP reference check, sizing
@yuychang yuychang changed the title [HIP] [Perf] MLA decode: run 96 fp8 heads natively at query lengths 7 and 8 on gfx950 [HIP] [Perf] MLA decode: run 96 fp8 heads natively at query lengths 7 and 8 under round-robin CP on gfx950 Oct 31, 2026
@yuychang yuychang changed the title [HIP] [Perf] MLA decode: run 96 fp8 heads natively at query lengths 7 and 8 under round-robin CP on gfx950 [HIP] [Perf] MLA: Run 96-head FP8 decode natively at qlen 7–8 under round-robin CP Nov 1, 2026
@yuychang
yuychang marked this pull request as ready for review November 1, 2026 04:35
@yuychang
yuychang requested a review from a team November 1, 2026 04:35
@github-actions github-actions Bot added the HIP label Nov 1, 2026
Copilot AI balanced review requested due to automatic review settings November 1, 2026 04:36

Copilot AI 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.

🟡 Changes recommended

The metadata-size test uses gfx950-specific expectations without GPU gating, causing it to reject correct legacy sizing on gfx942.

1 open issue
What changed in this PR

Enables native 96-head FP8 MLA decode for query lengths 7–8 under round-robin context parallelism on gfx950, avoiding head-folding overhead while preserving the non-CP route.

Changes:

  • Passes the CP flag through head planning and extends ASM/OPUS routing.
  • Sizes metadata for both native and folded plans and documents the metadata/decode flag contract.
  • Adds boundary, dispatch, metadata-sizing, and numerical-reference coverage.
File Description
op_tests/​test_mla_shape_support.py Adds CP boundary, sizing, dispatch, and reference checks.
op_tests/​test_mla_persistent_round_robin.py Adds 96-head query-length-7 coverage to the default sweep.
csrc/​py_itfs_cu/​asm_mla.cu Extends the 96-head ASM route through query length 8.
csrc/​kernels/​mla/​opus_mla_decode_fwd.cu Extends the matching OPUS route.
csrc/​kernels/​mla/​metadata/​v1_2_device.cuh Passes round-robin CP into device metadata head planning.
csrc/​kernels/​mla/​metadata.cu Threads the CP flag into shape-support planning.
csrc/​include/​mla_decode_shape.h Gates native 96-head query lengths 7–8 on gfx950 FP8 round-robin CP.
aiter/​ops/​attention.py Sizes metadata across both plans and clarifies CP usage constraints.

Review effort: Balanced

Comment thread op_tests/test_mla_shape_support.py Resolved
…obin CP mode

- get_mla_metadata_v1 records the is_cp_round_robin it planned with on work_metadata_ptrs
- mla_decode_fwd raises ValueError when g_kv_indptr disagrees and that changes the head plan (96 fp8 heads, qlen 7-8)
- Callers that agree, or that pass another tensor as work_meta_data, are unaffected
- test_decode_rejects_metadata_planned_for_the_other_cp_mode plans for one mode and launches in the other
Copilot AI balanced review requested due to automatic review settings November 1, 2026 09:44

Copilot AI 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.

🟡 Changes recommended

The gfx950-specific sizing test lacks an architecture skip, causing it to run on MI300X/gfx942 and fail against incompatible tile-count expectations.

2 open issues

Review effort: Balanced

Comment thread op_tests/test_mla_shape_support.py Resolved
- The expected 7/8 qo tiles per request only hold where 96 fp8 heads run natively, which is gfx950 only.
- On gfx942 the legacy bound keeps 42/48 tiles at qlen 7/8, so the assertion rejected correct sizing on MI300X.
- The incremental update grows every request's KV by one token and plans heads without CP, so it miscomputes CP metadata.
- For 96 fp8 heads at qlen 7 and 8 it would also rewrite a native plan as the 6x16 fold, which mla_decode_fwd cannot detect.
- Raise ValueError when work_metadata_ptrs was planned with is_cp_round_robin=True instead of only documenting the limit.
- Add a test that plans 96-head fp8 qlen-8 metadata under CP and expects the update to raise.
Copilot AI balanced review requested due to automatic review settings November 2, 2026 04:04

Copilot AI 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.

🔵 Needs a closer look

The gfx950 native CP route and reduced metadata bounds require final-revision GPU validation, since reported sweeps predate follow-up commits, include tolerance failures, and cannot be rerun in this environment.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

- Build the head-plan argument tuple once in mla_decode_fwd so the CP-mismatch recheck cannot drift from the launch plan
- Note in get_mla_metadata_v1 that the planned CP flag lives on the tensor object, so a view or copy skips the check
Copilot AI balanced review requested due to automatic review settings November 4, 2026 08:13

Copilot AI 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.

🟡 Changes recommended

Deep-copied buffer views lose the CP-mode record, causing valid metadata to be rejected at the 96-head FP8 CP boundary; copied-storage identity tracking and tests for both copy/view compositions are needed.

1 open issue

Review effort: Balanced

Comment thread aiter/ops/attention.py Resolved
- mla_decode_head_plan_v1_2 takes both main's page_size and this PR's cp_round_robin, in the outer planner's order
- test_mla_shape_support: _fold forwards both page_size and the round-robin CP kwargs; keep get_gfx for the gfx950 gates
Copilot AI balanced review requested due to automatic review settings November 6, 2026 07:45

Copilot AI 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.

🟡 Changes recommended

Cloned CP metadata can lose its mode record, causing an incorrect fold ratio to corrupt native work descriptors and allowing incompatible folded execution in the other consumer.

2 open issues

Review effort: Balanced

Comment thread aiter/ops/attention.py Resolved
…hanges the head plan

- A clone has no recorded is_cp_round_robin; mla_decode_fwd without g_kv_indptr ran it as non-CP metadata
- decode_update_mla_metadata_v1 did the same, so a cloned CP plan for 96 fp8 heads at qlen 7-8 got the fold ratio 6
- Both now raise ValueError there, since either plan could be wrong; other shapes are unchanged
- A view of a deep copy finds the recorded mode on its base, so it no longer reads as unknown
- Tests cover cloned metadata in both consumers, a view of a deep copy, and a deep copy of a view
Copilot AI balanced review requested due to automatic review settings November 6, 2026 10:33

Copilot AI 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.

🔵 Needs a closer look

Human assessment is needed because subtle metadata-state inconsistencies across copying and replanning can select incompatible attention execution paths.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

…ut round-robin CP

- The native 96-head qlen 7-8 route is gfx950 only, and its own tests skip on gfx942
- Pin arch=gfx942 and assert fold x6 at qlen 1-9 for e4m3fnuz and bf16, with and without CP
- Needs no GPU, so every CI runner covers the gfx950-only gate
Copilot AI balanced review requested due to automatic review settings November 6, 2026 15:21
@yuychang

yuychang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

gfx942 (MI300X) validation: validate-kernel-pr PASS.

On gfx942 96 heads stay folded x6 at every qlen, identical on base and head; new test_gfx942_96_heads_stay_folded pins this without a GPU. mla_decode_fwd perf head/base 1.0003 over 96 rows.

New commits for gfx942: d6e5dc3.

Reports were generated with the repo's validate-kernel-pr skill on a local head, so repo.head is null and they are not attached as PR evidence.

Copilot AI 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.

🔵 Needs a closer look

Human assessment is needed because critical metadata-mode tracking errors across tensor views, in-place copies, and deep copies can select the wrong FP8 decode head layout.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 9, 2026 03:59

Copilot AI 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.

🟡 Changes recommended

Replanning a copied metadata view leaves stale mode state that a subsequent deep copy can use to incorrectly select folded execution for native metadata on gfx950.

1 open issue

Review effort: Balanced

Comment thread aiter/ops/attention.py Resolved
…copy

- A deep copy carries its mode cell on the tensor but not on its new storage
- Replanning the copy through a view made a second cell on the storage and left the copy's own cell stale
- A later copy.deepcopy of the copy then recorded the old mode, so 96 fp8 heads at qlen 7-8 could use the wrong plan
- Adopt the tensor's (or same-address base's) existing cell when registering it on the storage
- Add copy, view-replan, copy cases for False to True and True to False; both fail without the change
- The buffer a copy was made from still keeps its own mode, and a clone still has none
Copilot AI balanced review requested due to automatic review settings November 9, 2026 12:42

Copilot AI 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.

🔵 Needs a closer look

Critical CP-mode tracking risks can select incorrect decode execution and bypass update safeguards, requiring human assessment.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 10, 2026 01:57

Copilot AI 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.

🟡 Changes recommended

CP-mode records can remain stale after in-place overwrites or be incorrectly inherited by offset slices, causing decode to select incompatible execution and potentially bypass incremental-update safeguards.

2 open issues

Review effort: Balanced

Comment thread aiter/ops/attention.py Resolved
Comment thread aiter/ops/attention.py Resolved
- The lookup fell back to the base's record for any view, so workspace[2:4] read the record of workspace[0:2]
- Copying native CP metadata into such a slice then saw a False record and could pick the folded head plan
- Use the base's record only when the view starts at the base's own address, as the registering side already does
- Document that a copy_ into a planned buffer keeps that buffer's own record; plan the destination instead
- Add an offset-slice case: it has no record until planned, and planning it leaves the base's record alone
- The case fails without the change; no code in the repo copies planned metadata with copy_
Copilot AI balanced review requested due to automatic review settings November 10, 2026 03:06

Copilot AI 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.

🔵 Needs a closer look

The gfx950 dispatch and metadata/workspace changes require exact-head GPU correctness and latency validation, which prior run summaries do not establish and this environment cannot perform.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants