Skip to content

[FlyDSL] perf(flydsl): launch a repeated gfx1250 pa_decode call without re-checking it - #7869

Closed
lirui927 wants to merge 4 commits into
ROCm:mainfrom
lirui927:perf/pa-decode-launch-cache
Closed

lirui927 wants to merge 4 commits into
ROCm:mainfrom
lirui927:perf/pa-decode-launch-cache

Conversation

@lirui927

@lirui927 lirui927 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Sparse-prefill PA calls on gfx1250 are host-bound: an ATOM sparse PA call spent about 50 µs inside aiter's pa_decode, mostly in argument checks and dispatch, and only about 6 µs in the FlyDSL launch itself.

pa_decode now records the validated launch of a gfx1250 tile kernel that writes the final output itself (direct or cluster merge; no reducer, no standalone-quant fallback).

  • Key: two keys, looked up in turn: the call's options and plan, then its operands. Together they hold what the checks and the dispatch read of a call: each scalar option and plan field with its type, the shape, strides, dtype and device of each operand and plan tensor, the address of the partials modulo 8 and the current device. Not keyed: the architecture (one per process), the other address bits and the contents of the tensors. The plan enters by its fields, not its identity, so the per-forward plans ATOM builds for the same shape reuse the launch.
  • Reuse: a later call with both keys re-reads the tensor addresses and launches, skipping the checks and the dispatch. The checked call and the recorded one launch through the same _tile_launch, so their arguments cannot drift.
  • Calls that are never recorded: sinks and calls without caller workspace are turned away before any key is built. A call whose options and plan recorded no launch (a reducer plan, the standalone-quant fallback, FP8 KV with constant scales) reads the plan's three tensors and no operand. An output whose strides differ from the query's stops after three operands.
  • Size: the table is cleared once it holds 1024 keys (one per launch, and one per set of options and plan that has launches).
  • Cost elsewhere: no call builds a key until a checked call could record a launch (the table is None until then), so a gfx942/gfx950 call tests one module global. Its launch goes through _tile_launch, with shared null pointers and FlyDSL types that the checks work out once; against main that is about -0.6 µs per BF16-KV call and about +0.2 µs per FP8-KV call on the host (table below).
  • Kernels: no new compiled kernels, and nothing changes on the GPU.

Benefit

Host time of one pa_decode call in µs. The three revisions of pa_decode.py are loaded side by side and run the same calls in alternating batches; the value is the median. "recorded" is a repeated call whose launch is recorded, "launches recorded" a call that is never recorded while the table holds launches, "nothing recorded" what every gfx942/gfx950 call sees.

MI455X (gfx1250), at 224c2b0 (2d45f7f with main merged in; pa_decode.py is the same file):

  • Host time per call (measure_pa_decode_host.py, a script outside the tree; median of 9 batches of 2000 calls per revision, alternating):
call table main 99211b6 4eaa731 224c2b0 224c2b0 - main 99211b6 224c2b0 - 4eaa731
op test cluster8, FP8 KV, 20 rows, FP8 output recorded 67.02 22.82 22.64 -44.38 -0.18
ATOM sparse prefill, FP8 KV, 200 rows, FP8 output recorded 63.22 23.05 22.86 -40.36 -0.19
op test mtp4-g16-page128: sinks launches recorded 70.84 82.68 68.17 -2.67 -14.51
op test head128-mixed-np96: reducer plan launches recorded 80.33 92.46 81.51 +1.18 -10.95
op test cluster2-shared, FP8 KV, 243 rows, FP8 output launches recorded 98.36 112.98 100.06 +1.70 -12.92
cluster8, FP8 KV, no caller workspace, FP8 output launches recorded 73.22 87.65 73.14 -0.08 -14.51
op test decode, FP8 KV, None scales launches recorded 53.10 66.11 54.66 +1.56 -11.45
op test mtp4-g16-page128: sinks nothing recorded 71.78 76.68 69.09 -2.69 -7.59
op test head128-mixed-np96: reducer plan nothing recorded 82.16 87.18 79.55 -2.61 -7.63
op test cluster2-shared, FP8 KV, 243 rows, FP8 output nothing recorded 99.49 105.79 97.63 -1.86 -8.16
op test decode, FP8 KV, None scales nothing recorded 53.55 59.74 51.92 -1.63 -7.82

CPU, kernel compile and launch mocked (the checks, the dispatch and the launch-argument marshalling are the real code; Python 3.12, FlyDSL 0.5.0, median of 15 batches of 3000 calls). gfx942 gives the same picture as gfx950:

call table main 99211b6 4eaa731 2d45f7f
gfx1250: op test cluster8, FP8 KV, 20 rows, FP8 output recorded 27.6 13.7 13.1
gfx1250: ATOM sparse prefill, FP8 KV, 200 rows, FP8 output recorded 24.3 13.9 13.2
gfx1250: op test mtp4-g16-page128: sinks launches recorded 18.7 23.3 16.9
gfx1250: op test head128-mixed-np96: reducer plan launches recorded 19.2 24.0 18.7
gfx1250: op test cluster2-shared, FP8 KV, 243 rows, FP8 output launches recorded 32.1 41.1 33.7
gfx1250: cluster8, FP8 KV, no caller workspace, FP8 output launches recorded 30.2 40.0 30.5
gfx1250: op test decode, FP8 KV, None scales launches recorded 19.4 25.2 19.9
gfx1250: op test mtp4-g16-page128: sinks nothing recorded 18.5 18.6 16.7
gfx1250: op test head128-mixed-np96: reducer plan nothing recorded 18.9 19.1 17.1
gfx1250: op test cluster2-shared, FP8 KV, 243 rows, FP8 output nothing recorded 31.4 33.7 30.3
gfx1250: op test decode, FP8 KV, None scales nothing recorded 19.9 21.0 18.8
gfx950: op test cluster8, FP8 KV, 20 rows nothing recorded 19.1 21.1 19.4
gfx950: ATOM sparse prefill, FP8 KV, 200 rows nothing recorded 19.3 21.2 19.5
gfx950: op test mtp4-g16-page128: sinks nothing recorded 16.6 17.8 16.0
gfx950: op test head128-mixed-np96: reducer plan nothing recorded 16.5 17.7 15.9
gfx950: op test cluster2-shared, FP8 KV, 243 rows nothing recorded 19.2 21.2 19.5
gfx950: cluster8, FP8 KV, no caller workspace nothing recorded 20.9 22.8 21.1
gfx950: op test decode, FP8 KV, None scales nothing recorded 17.3 19.2 17.5

End to end, the author's measurements on an earlier gfx1250 stack, before rebasing onto main; not re-measured: MiniMax-M3 TP4 on MI455X with ROCm/ATOM#2949. These numbers combine this PR with #7401's fused FP8 output (now on main), which were measured together. Method: CUDA events around run_model, slowest rank, 2 interleaved server runs per arm.

shape before after change
token-graph prefill, 200 tokens 23.30 ms 18.17 ms -22.0%
token-graph prefill, 500 tokens 23.01 ms 18.32 ms -20.4%
token-graph prefill, 1999 tokens 27.89 ms 26.82 ms -3.9%
eager prefill, 4600 tokens 65.11 ms 62.55 ms -3.9%

Testing

MI455X, one idle GPU, image rocm/fw-bringup:gfx1250-minimax-m3-20261112, at 224c2b0: 2d45f7f with main e6d2d31 merged in, which changes nothing under pa_decode.

  • python3 -m pytest -q op_tests/test_flydsl_pa_decode.py: 369 passed, 174 skipped in 292 s (4eaa731: 368 passed, 174 skipped).

  • python3 -m pytest -q op_tests/test_flydsl_pa_decode.py op_tests/test_flydsl_pa_decode.py --keep-duplicates -k 'recorded_launch or merge_alignment or (test_pa_decode and (cluster or merge or graph-workspace))': 258 passed (the 129 tests that pass caller workspace or pin a merge path, each twice in one process).

  • The fused FP8-output cases that pass caller workspace, as ATOM does, repeat the call twice: once as-is and once with a new plan cloned from the first one's fields (the next forward's plan). This covers the M3 decode shapes on the cluster8 and cluster16 step splits. Neither repeat may compile anything, and both must stay bitwise equal to PA + the standalone quant. Graph capture must then take the recorded launch too, and the checks for a fallback plan, which is never recorded.

  • test_pa_decode_recorded_launch_refusals: a recorded launch does not serve a call that the checks refuse. That is an option of another type that compares equal to the recorded one (store_output=1, quantized_pad_rows=False, sliding_window=0.0, query_length=1.0, a float max_context_length, a plan with a float max_batch_size), or an operand that is never recorded (alibi_slopes, query_scale, sinks). Each refused call differs from the recorded valid one in that argument only. The test also checks that a launch reads the plan it is called with (the recorded call's plan is emptied and a plan of the same fields in other tensors must still serve), and what a new process does: gfx1250 opens the table by itself and repeats the launch by the third call; gfx942/gfx950 record nothing. No CI lane records a launch, so it also asserts on every arch, without a launch, that the keys tell apart equal values of other types, a plan of another capacity and partials at another alignment.

  • An autouse fixture gives every test an empty table, so a launch recorded by another test cannot hide the dispatch that the tests pin. The second command runs the workspace cases twice in one process.

  • The recorded launch and the checked path build their arguments with the same _tile_launch, so the two cannot drift apart.

  • Never recorded: reducer calls, and FP8-output calls that fall back to the standalone quant (shared clusters, several KV heads, the last-arriver merge, query-split tiles).

On the host, without a GPU (CPU tensors, kernel compile and launch mocked, pinned FlyDSL 0.5.0):

  • Differential check: for 13 call forms and 5736 variants of them (each scalar option and plan field replaced by equal values of other types, other values and junk; each operand and plan tensor by clones, other shapes, dtypes, strides and alignments, subclasses, sparse tensors and non-tensors), a call with launches recorded does what the checks alone do: the same exception, or the same kernels with the same arguments. 0 diverge (306 at 4eaa731). With an open, empty table gfx942 and gfx950 do what they do without one, and the checked path launches what main launches on all three (about 5750 calls each).
  • Eight threads calling at once with the table bound lowered to 8: no call raises and every call launches its own operands (453k calls).
  • The op test itself with its numeric assertions stubbed: gfx1250 321 passed, 0 failed, also when every test runs twice in one process (at 4eaa731 with its own tests, 68 of the reruns fail with IndexError in _check_pipe_policy); gfx950 and gfx942 fail only what main fails in that harness.
  • black --check, ruff check and git diff --check are clean.

Not covered

  • Calls whose operands are tensor subclasses or non-PADecodePlan plans always take the checked path.
  • A single process that drives several GPUs is keyed by the current device; this is covered by the key but not by a multi-GPU test.
  • Calls without caller workspace (pa_decode allocates it) are not recorded and always take the checked path.
  • The first recordable call of a process is not recorded: it opens the table and the next one is recorded.
  • No CI lane runs gfx1250: the recorded launch on the GPU is covered by the MI455X run above only.

PR Self-Review

Reviewed revision

224c2b0

Behavior and intent

  • pa_decode records the validated launch of a gfx1250 tile kernel that writes the final output itself (direct or cluster merge; no reducer, no standalone-quant fallback) under two keys, the call's options and plan and then its operands: scalar options and plan fields with their types, the shape, strides, dtype and device of each operand and plan tensor, the partials' address modulo 8 and the current device.
  • A later call with both keys re-reads tensor addresses and launches, skipping checks and dispatch. The table is cleared at 1024 keys. No GPU-side change.
  • Why: sparse-prefill PA calls are host-bound; the author measured ~50 us inside pa_decode (mostly checks/dispatch) vs ~6 us for the launch itself, and 50.6 -> 24.7 us per call after this change on an earlier gfx1250 stack.
  • Calls that are never recorded stay cheap: sinks and missing caller workspace stop before any key; a call whose options and plan recorded no launch reads the plan's three tensors only.
  • gfx942/gfx950 calls build no key: the table is None until a checked gfx1250 call could record a launch.

Validation and unverified scope

  • Head 224c2b0 merges main e6d2d31 into 2d45f7f (the branch base predates main's Triton 3.9 fixes, so op_tests/test_gemm_a4w4.py would fail in CI): no conflicts, and main changed nothing under aiter/ops/flydsl/kernels/pa_decode*, aiter/ops/flydsl/pa_decode.py or the op test since that base. The CPU evidence below was taken at 2d45f7f.

  • MI455X, one idle GPU, at 224c2b0: the full op test, the workspace cases twice in one process, and the host time per call of main, 4eaa731 and this head:

  • python3 -m pytest -q op_tests/test_flydsl_pa_decode.py: 369 passed, 174 skipped in 292 s (4eaa731: 368 passed, 174 skipped).

  • python3 -m pytest -q op_tests/test_flydsl_pa_decode.py op_tests/test_flydsl_pa_decode.py --keep-duplicates -k 'recorded_launch or merge_alignment or (test_pa_decode and (cluster or merge or graph-workspace))': 258 passed (the 129 tests that pass caller workspace or pin a merge path, each twice in one process).

  • Host time per call (measure_pa_decode_host.py, a script outside the tree; median of 9 batches of 2000 calls per revision, alternating):

call table main 99211b6 4eaa731 224c2b0 224c2b0 - main 99211b6 224c2b0 - 4eaa731
op test cluster8, FP8 KV, 20 rows, FP8 output recorded 67.02 22.82 22.64 -44.38 -0.18
ATOM sparse prefill, FP8 KV, 200 rows, FP8 output recorded 63.22 23.05 22.86 -40.36 -0.19
op test mtp4-g16-page128: sinks launches recorded 70.84 82.68 68.17 -2.67 -14.51
op test head128-mixed-np96: reducer plan launches recorded 80.33 92.46 81.51 +1.18 -10.95
op test cluster2-shared, FP8 KV, 243 rows, FP8 output launches recorded 98.36 112.98 100.06 +1.70 -12.92
cluster8, FP8 KV, no caller workspace, FP8 output launches recorded 73.22 87.65 73.14 -0.08 -14.51
op test decode, FP8 KV, None scales launches recorded 53.10 66.11 54.66 +1.56 -11.45
op test mtp4-g16-page128: sinks nothing recorded 71.78 76.68 69.09 -2.69 -7.59
op test head128-mixed-np96: reducer plan nothing recorded 82.16 87.18 79.55 -2.61 -7.63
op test cluster2-shared, FP8 KV, 243 rows, FP8 output nothing recorded 99.49 105.79 97.63 -1.86 -8.16
op test decode, FP8 KV, None scales nothing recorded 53.55 59.74 51.92 -1.63 -7.82
  • Host, no GPU, kernel compile and launch mocked (local harness scripts, not in the repo: host_diff_fuzz.py, host_cross_rev.py, host_threads.py, host_tests.py, measure_pa_decode_host.py --host, each on gfx1250, gfx950 and gfx942): 0 of 5736 call variants diverge from the checks with launches recorded; the checked path launches what main launches; no call raises under eight threads; the op test's path assertions pass on gfx1250, also with every test run twice; the host times above. black --check, ruff check and git diff --check are clean.
  • The recorded and the checked path share _tile_launch; reducer calls and FP8-output calls that fall back to the standalone quant (shared clusters, several KV heads, last-arriver merge, query-split tiles) are never recorded.
  • Unverified: the host checks mock the kernel compile and the launch, so nothing was computed at this head off the GPU; the end-to-end numbers are from an earlier stack; multi-GPU-per-process keying has no test; tensor subclasses, non-PADecodePlan plans and calls without caller workspace always take the checked path; no gfx942/gfx950 GPU run of this head besides CI.
  • Kernels are unchanged: the diff touches only the host-side launcher in pa_decode.py (no kernel builder or compile argument changes).

PR-specific question

Could a recorded launch be reused for a call that the full checks would have rejected or dispatched differently?

  • The two keys hold every input the checks and the dispatch read of a call except the architecture, which is constant in a process, the address bits other than the partials' alignment, and the contents of tensors, which the GPU reads either way. Scalar options and plan fields are keyed with their types, because the checks tell True from 1 and 0.0 from 0 while a tuple key does not.
  • The plan enters the key as its typed fields plus the signatures of work_info, reduce_info and arrival_counters; their addresses, the values inside them and capacity are read at call time, as the checked path does.
  • An operand or option that the lookup cannot key (a tensor subclass, a tensor without storage, a non-tensor, another plan type, an unhashable value) falls through to the checks, which raise their own error.
  • Checked on the host for 5736 call variants: none takes a recorded launch that the checks refuse or dispatch differently (at 4eaa731: 73 did, among them the type collisions the reviews found).
  • Remaining exposure: someone adding a new check or dispatch input without adding it to the key. Sharing _tile_launch limits drift in argument building, but not in the key; this is a reviewer point.

Changed op tests

  • op_tests/test_flydsl_pa_decode.py
    • Covers: for fused FP8-output cases with caller workspace and capture, a repeated call, a call with a new plan of the same fields and the graph capture take the recorded launch (no new compile) and stay bitwise equal to PA + standalone quant; a fallback plan's capture takes the checks. test_pa_decode_recorded_launch_refusals pins that a recorded launch serves neither an option of another type that compares equal to the recorded one nor an operand that is never recorded, that a launch reads the plan it is called with, what the first calls of a process do, and (on every arch, without a launch) that the keys hold the option types, the plan's size and the partials' alignment. An autouse fixture gives every test an empty launch table.
    • Before this PR: the launch table does not exist, so the fixture and the new test fail on _VALIDATED_LAUNCHES. At 4eaa731 the new test fails (store_output=1 is not refused) and a rerun of a workspace case in one process fails in _check_pipe_policy.
    • Not redundant: extends the existing _check_quant_output; the new test is the only one that calls with equal values of other types, the only one that moves a plan's records to other tensors while the first plan is emptied, and the only one that starts from the table of a new process.

@fsx950223 fsx950223 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.

Reviewed exact head a9d9558 against the supplied base. No concrete blocking defect was found. Four targeted gfx942 tests passed with pinned FlyDSL 0.5.0, covering the shared launch refactor. Essential validation of the new gfx1250 recorded-launch path remains unavailable on the configured hosts.

Validation:

  • PASS on local: git -C checkout rev-parse HEAD
    Verified a9d9558 in the isolated checkout.
  • PASS on local: python3 -m compileall -q checkout/aiter/ops/flydsl/pa_decode.py checkout/op_tests/test_flydsl_pa_decode.py
    Exit status 0.
  • PASS on hjbog-srdc-39.amd.com / sixifang_dev: flock -w 30 /tmp/codex-pr-review-7869-a9d9558c/gpu.lock timeout 300 /tmp/codex-pr-review-7869-a9d9558c/venv/bin/python -m pytest -q op_tests/test_flydsl_pa_decode.py -k "bf16-decode or bf16-window or bf16-cluster8"
    Exit status 0: 4 passed, 480 deselected in 11.03s. Verified gfx942, exact checkout SHA, intended aiter import, and isolated FlyDSL 0.5.0 import. Used idle GPU 0 and separate compilation caches. Details in validation-record.json and gfx942-tests-retry.log.
  • FAIL on dzm-mi355-gpu34-dev: ssh -o BatchMode=yes -o ConnectTimeout=10 -o RequestTTY=no -o ControlMaster=no -o ControlPath=none -o RemoteCommand=none dzm-mi355-gpu34-dev "squeue -h -u zhiming_ding_qle -o '%i|%N|%t'"
    SSH exit status 255: connection to aac16.amd.com port 22 timed out. Allocation discovery and gfx950 testing could not proceed; evidence in allocation.log.
  • SKIP on gfx1250: python3 -m pytest -q op_tests/test_flydsl_pa_decode.py
    No configured gfx1250 host. The recorded-launch reuse and fused FP8 repeat/new-plan cases were not executed by this review.

Remaining validation:

  • gfx942 tests validate the shared launch refactor but do not exercise the gfx1250 cache-hit path.
  • The author's reported gfx1250 results were not independently reproduced; GitHub exposed no CI results or existing review feedback.
  • Multi-GPU cache reuse and the claimed host-time improvement were not measured.
  • The initial isolated-environment attempt failed before test execution because torch was absent from its import path; the corrected attempt passed. Both logs are preserved.

Automated Codex review of commit a9d9558c806c.

@lirui927
lirui927 force-pushed the perf/pa-decode-launch-cache branch from a9d9558 to db7efd1 Compare November 18, 2026 02:34
@lirui927
lirui927 changed the base branch from lirui927/stack-on-7401 to main November 18, 2026 02:34
@lirui927
lirui927 requested a review from a team November 18, 2026 02:34
@github-actions github-actions Bot changed the title perf(flydsl): launch a repeated gfx1250 pa_decode call without re-checking it [FlyDSL] perf(flydsl): launch a repeated gfx1250 pa_decode call without re-checking it Nov 18, 2026
@aiter-bot

aiter-bot commented Nov 18, 2026 •

Copy link
Copy Markdown

DRAFT — evaluation paused

PR Self-Review

Revision 224c2b0e03aa · mode shadow

This pull request is a draft, so readiness evaluation is paused and no verdict applies. Evaluation resumes when it is marked ready for review and the required CI completes.

@fsx950223 fsx950223 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.

Reviewed exact head db7efd1 and its complete merge-base diff. No concrete blocking defect was found in the launch-cache key or shared launch refactor. Four targeted gfx942 regression tests passed, but essential validation of the new gfx1250 cache-hit path remains unavailable on the configured hosts.

Validation:

  • PASS on local: git -C checkout rev-parse HEAD
    Exit 0; verified db7efd1 in an isolated checkout. Merge-base d6ea3d1; complete PR diff preserved in pr.diff.
  • PASS on local: python3 -m compileall -q checkout/aiter/ops/flydsl/pa_decode.py checkout/op_tests/test_flydsl_pa_decode.py
    Exit 0; output preserved in compileall.log.
  • PASS on hjbog-srdc-39.amd.com / sixifang_dev: flock -w 30 /tmp/codex-pr-review-20261119-7869-db7efd1a/gpu.lock timeout 300 python3 -m pytest -q op_tests/test_flydsl_pa_decode.py -k "bf16-decode or bf16-window or bf16-cluster8"
    Exit 0: 4 passed, 491 deselected in 10.41s. Verified exact head SHA, gfx942, intended aiter checkout import, and isolated pinned FlyDSL 0.5.0 import. Used idle GPU 1 with HIP_VISIBLE_DEVICES=1 and separate AITER, FlyDSL and Triton caches. Logs preserved in gfx942-setup.log, gfx942-activity.log and gfx942-tests.log.
  • FAIL on dzm-mi355-gpu34-dev: ssh -o BatchMode=yes -o ConnectTimeout=10 -o RequestTTY=no -o ControlMaster=no -o ControlPath=none -o RemoteCommand=none dzm-mi355-gpu34-dev "squeue -h -u zhiming_ding_qle -o '%i|%N|%t'"
    Exit 255: connection to aac16.amd.com port 22 timed out. Allocation discovery and gfx950 tests could not proceed. Evidence preserved in allocation.log.
  • SKIP on gfx1250: python3 -m pytest -q op_tests/test_flydsl_pa_decode.py
    No configured gfx1250 environment. Recorded-launch reuse and fused FP8 repeat/new-plan cases were not independently executed.

Remaining validation:

  • gfx942 tests validate the shared launch refactor; they do not exercise the gfx1250 cache-hit path. The author's reported gfx1250 results were not independently reproduced.
  • Current CI has a failed Aiter Test Gate. The failing shard reports an unrelated all-reduce rank-agreement test failure: CustomAllreduce lacks _is_gfx1250. Detailed evidence is preserved in ci-raw.log; this failure is outside the PR diff.
  • Multi-GPU cache reuse and the claimed host-time improvement were not measured.

Automated Codex review of commit db7efd1ad405.

lirui927 and others added 2 commits November 19, 2026 02:23
…cking it

Token-graph and eager sparse prefill are host-bound: one ATOM sparse PA call
spent ~50 us in aiter's pa_decode, ~6 us of it in the FlyDSL launch itself.
pa_decode now records a validated gfx1250 tile launch that writes the final
output (direct or cluster merge; no reducer, no standalone-quant fallback),
keyed on everything its checks and dispatch read except tensor addresses:
operand shapes, strides, dtypes and devices, scalar options, the plan's fields
(not its identity, so a per-forward plan of the same shape reuses it), the
partials' alignment and the current device. The shapes and the plan capacity
also fix the cluster mode (cluster_seqs, cluster_steps, cluster_runs). A later
call with the same key re-reads the addresses and launches. The checked call
and the recorded one share one launch builder, so their arguments cannot
drift. The table is bounded (cleared at 1024 keys), and the key is computed
only when the table has entries or a launch is recorded, so calls on other
archs pay nothing. No new compiled kernels.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… launch

With caller workspace (as ATOM passes it), a repeated fused FP8-output call
and a call with a new plan of the same fields must compile nothing and still
give bytes equal to PA + the standalone per-token quant. Launches recorded by
earlier cases are cleared first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lirui927
lirui927 force-pushed the perf/pa-decode-launch-cache branch from db7efd1 to 4eaa731 Compare November 19, 2026 02:50

@fsx950223 fsx950223 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.

Reviewed exact head 4eaa731, the complete diff, validation and dispatch logic, callers, tests, and earlier review feedback. No concrete blocking defect was found. Four targeted gfx942 regression tests passed, but essential validation of the new gfx1250 recorded-launch path remains unavailable on the configured hosts.

Validation:

  • PASS on local: git -C checkout rev-parse HEAD
    Verified 4eaa731 in the isolated checkout. Supplied-base and merge-base diffs are preserved in complete.diff and merge-base.diff.
  • PASS on local: python3 -m compileall -q checkout/aiter/ops/flydsl/pa_decode.py checkout/op_tests/test_flydsl_pa_decode.py
    Exit status 0; compileall.log preserved.
  • PASS on hjbog-srdc-39.amd.com / sixifang_dev: flock -w 30 /tmp/codex-pr-review-20261120-7869-4eaa7319/gpu.lock timeout 300 /tmp/codex-pr-review-20261120-7869-4eaa7319/venv/bin/python -m pytest -q op_tests/test_flydsl_pa_decode.py -k 'bf16-decode or bf16-window or bf16-cluster8'
    Exit status 0: 4 passed, 538 deselected in 11.11s. Verified gfx942, idle GPU 0, intended source import, isolated FlyDSL 0.5.0 import, and separate compilation caches. Remote HEAD matched the supplied SHA and git diff --exit-code passed. Logs: gfx942-env.log, gfx942-sha.log, gfx942-tests-retry.log.
  • FAIL on hjbog-srdc-39.amd.com / sixifang_dev: Initial isolated virtual-environment import check
    Stopped before test execution with ModuleNotFoundError: No module named 'torch'. Corrected the import path to include the container's torch installation; the subsequent targeted tests passed. Initial evidence preserved in gfx942-tests.log.
  • FAIL on dzm-mi355-gpu34-dev: ssh -o BatchMode=yes -o ConnectTimeout=10 -o RequestTTY=no -o ControlMaster=no -o ControlPath=none -o RemoteCommand=none dzm-mi355-gpu34-dev "squeue -h -u zhiming_ding_qle -o '%i|%N|%t'"
    SSH connection to aac16.amd.com port 22 timed out. Allocation discovery and gfx950 testing could not proceed. Evidence preserved in allocation.log.
  • SKIP on gfx1250: python3 -m pytest -q op_tests/test_flydsl_pa_decode.py
    No configured gfx1250 environment. Recorded-launch reuse and fused FP8 repeat/new-plan cases were not independently executed.

Remaining validation:

  • gfx942 tests cover the shared launch refactor, not the gfx1250 cache-hit path. The author's reported gfx1250 results were not independently reproduced.
  • Available CI statuses are green, including MI35X test shards, but do not establish gfx1250 recorded-launch coverage.
  • Multi-GPU cache reuse and the claimed host-time improvement were not measured.

Automated Codex review of commit 4eaa73192821.

@lirui927

Copy link
Copy Markdown
Contributor Author

@coderfeli could you take a look when you have a moment? CI is green at 4eaa731, there are no open review threads, and the automated review found no blocking issues. This PR only needs a code-owner approval.

@valarLip valarLip left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Action required before merge (5)

  1. Don't compute the 16-tensor signature for gfx1250 calls that can never be recorded. aiter/ops/flydsl/pa_decode.py:831. Once any launch is recorded, every later gfx1250 call builds _launch_signature and then misses. That covers reducer plans, sinks, the standalone-quant fallback, calls without caller workspace and FP8 calls with None scales. The miss costs about 12-13 µs per call on CPU (control 0.03 µs), so about 0.7 ms per step at about 60 layers in a mixed sparse-prefill batch. Run the cheap reject tests first (sinks is None, all three workspace tensors given, output.stride() == query.stride(), scale tensors present for FP8). Better, record the eligibility verdict with the key, so a miss on a known-ineligible shape stays cheap. Another option is an explicit prepare-style API that returns _tile_launch's callable to the caller. That would remove the global table and the hand-kept key.
  2. Build key_inputs only when it is used. "Other archs pay nothing" is not true today. pa_decode.py:786-830. Every call on every arch builds scale_tensors, both key tuples and temporary_output.data_ptr() % 8 before the if _VALIDATED_LAUNCHES test. That is about 0.5 µs per call, and ATOM calls FlyDSL pa_decode per layer on gfx942/gfx950 under ATOM_PA_FLYDSL, so about 30 µs per step. Wrap the build in a local function and call it only in the lookup branch and the record branch. Then fix the comment at :791-792 and the commit/PR text.
  3. Clear the table for every test, not only in _check_quant_output. op_tests/test_flydsl_pa_decode.py:2826. _run_pa_decode_case (:2550-2588) and other gfx1250 tests that pass caller workspace also record entries. A later case with the same signature then skips dispatch, so compile_kwargs[-1] / _check_pipe_policy see a stale or empty list, and the result depends on test order (reruns in one process, pytest-repeat). Add an autouse fixture: monkeypatch.setattr(pa_module, "_VALIDATED_LAUNCHES", {}). Also assert len(compile_kwargs) is unchanged across the graph-capture block, so the test proves that capture takes the recorded path. Fix the PR body sentence "The table is cleared before each case".
  4. Key the scalar options by type as well as value, or narrow the comment. pa_decode.py:806-829. True == 1 and 0 == 0.0 hash equal. A hit therefore launches for store_output=1, quantized_pad_rows=False, sliding_window=0.0, query_length=True and max_context_length=True, all of which the checked path rejects (:865/871/891/897/1352). Use (type(x), x). The comment at :569-574 says the key holds "everything the checks and the dispatch read except tensor addresses". That is not accurate either: the arch is not keyed, and one address property (temporary_output % 8) is.
  5. Re-measure at this head and post the numbers. The 50.6 -> 24.7 µs and end-to-end figures come from an earlier stack, combined with #7401. Post before/after pa_decode host time at 4eaa731 for a hit, for a gfx1250 miss with a non-empty table (item 1), and for a gfx950 call (item 2). No CI lane runs gfx1250, so the hit path is covered only by your MI455X run. Please include that log.

Checked and fine: the hit path passes the same pointers as the checked path (scales are reshape/squeeze views, the workspace tensors are the caller's own, and the reducer and quant fallback are never recorded). Every PADecodePlan field is keyed (capacity = work_info.shape[0]). The NHD data_ptr % 16 check is gfx950-only. Device and stream match.


Reviewed at 4eaa731 (Deep; hunter A + independent pass B + orchestrator probe re-run). First valarLip review.

@fsx950223 fsx950223 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.

Reviewed exact head 4eaa731. A host-side reproduction confirms that scalar-type collisions let cached calls bypass explicit argument validation. Four targeted gfx942 regression tests passed. Independent validation of the gfx1250 cache-hit path remains unavailable.

[P2] Preserve scalar types in the validated-launch key — aiter/ops/flydsl/pa_decode.py:614

After a valid gfx1250 call records a launch, repeating the same operands with store_output=1, quantized_pad_rows=False (instead of 0), or sliding_window=0.0 (instead of 0) hits the same key because Python hashes and compares these values equal to their valid counterparts. The cached path launches and returns before the explicit type checks, whereas the checked path rejects each call. This makes argument acceptance depend on cache history and violates the validated-launch contract. The exact-head host-side reproduction confirmed all three cases using a mocked cached launch. Include types in keys for type-sensitive scalar options and plan fields, or perform their type checks before cache lookup.

Validation:

  • PASS on local: git -C source rev-parse HEAD
    Exit 0; verified 4eaa731 in an isolated checkout. Complete supplied-base and merge-base diffs preserved.
  • PASS on local: python3 -m compileall -q source/aiter/ops/flydsl/pa_decode.py source/op_tests/test_flydsl_pa_decode.py
    Exit 0.
  • PASS on hjbog-srdc-39.amd.com / sixifang_dev: docker exec -i sixifang_dev python3 - < scalar-repro.py
    Exit 0. Exact-head functions extracted through AST, with real CPU tensors and mocked current device/cached launch. All three invalid scalar calls invoked the cached launch; the checked path raised the expected TypeError or ValueError. Evidence: scalar-repro.py and scalar-repro.log.
  • PASS on hjbog-srdc-39.amd.com / sixifang_dev: flock -w 30 /tmp/codex-pr-review-20261125-7869-4eaa7319/gpu.lock timeout 300 python3 -m pytest -q op_tests/test_flydsl_pa_decode.py -k 'bf16-decode or bf16-window or bf16-cluster8'
    Exit 0: 4 passed, 538 deselected in 13.73s. Verified remote HEAD, clean tracked source, gfx942, idle GPU 0, intended aiter import, isolated FlyDSL 0.5.0 and compilation caches. Commands and output preserved in gfx942-run.sh, gfx942-sha.log and gfx942-tests.log.
  • FAIL on dzm-mi355-gpu34-dev: ssh -o BatchMode=yes -o ConnectTimeout=10 -o RequestTTY=no -o ControlMaster=no -o ControlPath=none -o RemoteCommand=none dzm-mi355-gpu34-dev "squeue -h -u zhiming_ding_qle -o '%i|%N|%t'"
    Exit 255: connection to aac16.amd.com port 22 timed out. Allocation discovery and gfx950 testing could not proceed. Evidence: gfx950-discovery.log.
  • SKIP on gfx1250: python3 -m pytest -q op_tests/test_flydsl_pa_decode.py
    No configured gfx1250 environment; recorded-launch GPU reuse and fused FP8 repeat/new-plan cases were not independently executed.

Remaining validation:

  • gfx942 tests cover the shared launch refactor, not gfx1250 cache-hit GPU behavior.
  • The scalar reproduction validates host control flow with a mocked launch; it does not demonstrate GPU numerical corruption.
  • Author-reported MI455X results were not independently reproduced. Available green MI35X CI statuses do not establish gfx1250 coverage.
  • Multi-GPU cache reuse and host-time performance claims were not measured. Detailed validation records are preserved in validation-record.json.

Automated Codex review of commit 4eaa73192821.

lirui927 and others added 2 commits November 25, 2026 10:28
… by type

Review of ROCm#7869:

- A gfx1250 call that is never recorded no longer reads 16 tensor signatures
  once a launch is recorded. Sinks and missing caller workspace are turned
  away before any key. The lookup takes two keys in turn, the call's options
  and plan and then its operands: a call whose options and plan recorded no
  launch (reducer plans, the standalone-quant fallback, constant FP8 scales)
  reads the plan's three tensors only, and an output with other strides than
  the query's stops after three operands.
- No call builds a key until a checked call could record a launch (the table
  is None until then), so gfx942/gfx950 calls test one global. key_inputs,
  which every call built on every arch, is gone; so are the three null
  pointers and the closure that every checked call built for its launch
  and its second read of the current stream, and the checks now map the
  operands' dtypes to FlyDSL types once instead of every launch doing it.
- Scalar options and plan fields are keyed with their types.
  store_output=1, quantized_pad_rows=False, sliding_window=0.0,
  query_length=1.0, a float max_context_length and a plan with a float
  max_batch_size no longer take the launch recorded for the value they
  equal, and an unhashable option reaches the checks instead of raising
  from the lookup.
- Tests: an autouse fixture gives every test an empty table, graph capture
  must take the recorded launch of a fused plan and the checks of a
  fallback plan, and a new test pins the refusals above, that a launch
  reads the plan it is called with, and what the first calls of a process
  do.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@lirui927

Copy link
Copy Markdown
Contributor Author

Thanks for the review. All five items are addressed in 2d45f7f (one commit on top of 4eaa731). CPU numbers below are Python 3.12 with the pinned FlyDSL 0.5.0, kernel compile and launch mocked, so the checks, the dispatch and the launch-argument marshalling are the real code.

1. No 16-tensor signature for calls that are never recorded. Both of your suggestions are in.

  • Cheap rejects first (pa_decode.py:828): sinks and missing caller workspace stop before any key is built.
  • The verdict is recorded with the key. The lookup has two steps, _launch_options (scalar options and the plan) and _launch_operands, and a call reads its operands only when a launch was recorded for its options and plan. Reducer plans, the standalone-quant fallback and FP8 KV with constant scales never record one, so their calls stop after the plan's three tensors. An output whose strides differ from the query's stops after three operands.
  • Tensor signatures read by a repeated call, 4eaa731 -> now: recorded forms 16 -> 16; sinks 16 -> 0; no caller workspace 16 -> 0; reducer plan 16 -> 3; quant fallback (several KV heads, shared clusters) 16 -> 3; FP8 KV with None or host-scalar scales 16 -> 3; an output with other strides than the query's 16 -> 6 (the plan's three and three operands). The 3s hold even when the same options and plan serve a recorded call (a plain call next to its FP8-output twin that falls back, tensor scales next to constant ones): whether the call has an FP8 output and the kind of its scales are part of the first key.
  • What recorded launches add to the host time of such a call (against the same call with nothing recorded, main subtracted from both): 4eaa731 +4.5 to +6.7 µs, now +0.1 to +2.6 µs. Per-form numbers are in the table under item 5.
  • I kept the table instead of a prepare-style API. The caller would have to decide when a prepared launch still applies, which means re-deriving in ATOM what aiter's checks and dispatch read (shapes, strides, dtypes, device, alignment, plan sizes): the hand-kept key moves out of aiter, where it cannot follow the dispatch. ATOM's sparse prefill sees a new row count on most prefill tails, so it would still need a table of prepared launches. It also needs a public API and an ATOM change in lockstep. _tile_launch is now a plain function and the recorded launch is partial(_tile_launch, spec), which is the callable such an API would return, so it can be added later without touching the launch code.

2. key_inputs is gone; other archs build nothing.

  • The first key is built in one place, the lookup branch, from the arguments as passed, and the record branch reuses it (the operands key is built where it is first needed, in the lookup or when recording). No call builds a key until a checked call could record a launch: the table is None until then (pa_decode.py:583), so a gfx942/gfx950 call tests one module global. The first recordable call of a process therefore only opens the table and the next one is recorded.
  • I did not use a local function. A nested function that closes over pa_decode's arguments costs more per call than the tuples did (+325 ns against +169 ns over a bare call with 26 arguments: every captured argument becomes a cell), and it would read sliding_window and compute_type after the checks rebind them, so a call with compute_type=None or a negative window would record a key that its next lookup does not find.
  • While measuring this I found a larger cost of the same kind at 4eaa731: every checked call, on every arch, built three null pointers (flyc.from_c_void_p, about 0.36 µs each) and a closure in _tile_launch, and read the current stream twice. The null pointers are module constants now, the closure is gone, and the stream is passed in. Every launch also mapped its operands' dtypes to FlyDSL types; the checks now do that once and the launch reuses the result, which pays for the type keying on the recorded path.
  • gfx950 and gfx942 dispatch, host time per call against main: 4eaa731 was +1.2 to +2.0 µs; now about -0.6 µs for BF16 KV and about +0.2 µs for FP8 KV. The comment and the PR text say this now.

3. The table is empty for every test.

  • Autouse fixture _no_recorded_launches (op_tests/test_flydsl_pa_decode.py:39) sets _VALIDATED_LAUNCHES to {} with monkeypatch; the clear() in _check_quant_output is gone.
  • The capture block asserts (len(compile_kwargs) == calls) == fused (:2982): capture takes the recorded launch of a fused plan, and the checks of a fallback plan, which is never recorded.
  • Order dependence reproduced on the host: at 4eaa731, running each test a second time in the same process fails 68 reruns, all with IndexError at _check_pipe_policy or in test_pa_decode_merge_alignment; now 0.
  • The PR body sentence is fixed.

4. Scalar options and plan fields are keyed with their types (tuple(map(type, scalars)) in _launch_options, pa_decode.py:614), and the comment now states what is keyed and what is not (the architecture, the address bits other than the partials' alignment, tensor contents).

  • Of your five examples, four are refused by the checks. query_length=True passes isinstance(True, int), so the checks accept it; it now gets a key of its own like any other value and is checked once, instead of taking the launch recorded for the int.
  • New test test_pa_decode_recorded_launch_refusals (:2794): after the valid call was recorded and repeated, store_output=1, quantized_pad_rows=False, sliding_window=0.0, query_length=1.0, a float max_context_length and a plan with a float max_batch_size are refused, and so are alibi_slopes, query_scale and a sinks tensor, which the lookup turns away. It fails at 4eaa731 (DID NOT RAISE TypeError for store_output=1) and passes now. Each refused call differs from the recorded one in that argument only, so a refusal that regressed would launch the valid call again. No CI lane records a launch, so assertions on _launch_options and _launch_operands pin the type keying, the plan's size and the partials' alignment on every arch as well, without a launch.
  • To look for more of these I ran a differential check on the host: 13 call forms and 5736 variants of them (each scalar option and plan field replaced by equal values of other types, other values and junk; each operand and plan tensor by clones, other shapes, dtypes, strides and alignments, subclasses, sparse tensors and non-tensors). With launches recorded, a call must do what the checks alone do: the same exception, or the same kernels with the same arguments. At 4eaa731, 306 diverge: 73 where the checks refuse and the recorded launch runs (the type collisions, including plan.max_batch_size), 177 where an unhashable option (for example query_length=[1]) raises TypeError: unhashable type from the lookup instead of the checks' own error, and 56 where both launch but the checks would compile with the other type (mask_unowned_kv=1, query_length=True). Now 0 diverge.

5. Numbers at this head. Host time of one pa_decode call in µs; main 99211b6, 4eaa731 and 2d45f7f of pa_decode.py loaded side by side, the same calls through each in alternating batches, median.

MI455X, at 224c2b0 (2d45f7f with main merged in for CI; pa_decode.py is the same file):

  • Host time per call (measure_pa_decode_host.py, a script outside the tree; median of 9 batches of 2000 calls per revision, alternating):
call table main 99211b6 4eaa731 224c2b0 224c2b0 - main 99211b6 224c2b0 - 4eaa731
op test cluster8, FP8 KV, 20 rows, FP8 output recorded 67.02 22.82 22.64 -44.38 -0.18
ATOM sparse prefill, FP8 KV, 200 rows, FP8 output recorded 63.22 23.05 22.86 -40.36 -0.19
op test mtp4-g16-page128: sinks launches recorded 70.84 82.68 68.17 -2.67 -14.51
op test head128-mixed-np96: reducer plan launches recorded 80.33 92.46 81.51 +1.18 -10.95
op test cluster2-shared, FP8 KV, 243 rows, FP8 output launches recorded 98.36 112.98 100.06 +1.70 -12.92
cluster8, FP8 KV, no caller workspace, FP8 output launches recorded 73.22 87.65 73.14 -0.08 -14.51
op test decode, FP8 KV, None scales launches recorded 53.10 66.11 54.66 +1.56 -11.45
op test mtp4-g16-page128: sinks nothing recorded 71.78 76.68 69.09 -2.69 -7.59
op test head128-mixed-np96: reducer plan nothing recorded 82.16 87.18 79.55 -2.61 -7.63
op test cluster2-shared, FP8 KV, 243 rows, FP8 output nothing recorded 99.49 105.79 97.63 -1.86 -8.16
op test decode, FP8 KV, None scales nothing recorded 53.55 59.74 51.92 -1.63 -7.82

CPU, launch mocked (median of 15 batches of 3000 calls):

call table main 99211b6 4eaa731 2d45f7f
gfx1250: op test cluster8, FP8 KV, 20 rows, FP8 output recorded 27.6 13.7 13.1
gfx1250: ATOM sparse prefill, FP8 KV, 200 rows, FP8 output recorded 24.3 13.9 13.2
gfx1250: op test mtp4-g16-page128: sinks launches recorded 18.7 23.3 16.9
gfx1250: op test head128-mixed-np96: reducer plan launches recorded 19.2 24.0 18.7
gfx1250: op test cluster2-shared, FP8 KV, 243 rows, FP8 output launches recorded 32.1 41.1 33.7
gfx1250: cluster8, FP8 KV, no caller workspace, FP8 output launches recorded 30.2 40.0 30.5
gfx1250: op test decode, FP8 KV, None scales launches recorded 19.4 25.2 19.9
gfx1250: op test mtp4-g16-page128: sinks nothing recorded 18.5 18.6 16.7
gfx1250: op test head128-mixed-np96: reducer plan nothing recorded 18.9 19.1 17.1
gfx1250: op test cluster2-shared, FP8 KV, 243 rows, FP8 output nothing recorded 31.4 33.7 30.3
gfx1250: op test decode, FP8 KV, None scales nothing recorded 19.9 21.0 18.8
gfx950: op test cluster8, FP8 KV, 20 rows nothing recorded 19.1 21.1 19.4
gfx950: ATOM sparse prefill, FP8 KV, 200 rows nothing recorded 19.3 21.2 19.5
gfx950: op test mtp4-g16-page128: sinks nothing recorded 16.6 17.8 16.0
gfx950: op test head128-mixed-np96: reducer plan nothing recorded 16.5 17.7 15.9
gfx950: op test cluster2-shared, FP8 KV, 243 rows nothing recorded 19.2 21.2 19.5
gfx950: cluster8, FP8 KV, no caller workspace nothing recorded 20.9 22.8 21.1
gfx950: op test decode, FP8 KV, None scales nothing recorded 17.3 19.2 17.5
gfx942: op test cluster8, FP8 KV, 20 rows nothing recorded 19.3 21.2 19.4
gfx942: ATOM sparse prefill, FP8 KV, 200 rows nothing recorded 19.5 21.3 19.5
gfx942: op test mtp4-g16-page128: sinks nothing recorded 16.7 17.9 16.1
gfx942: op test head128-mixed-np96: reducer plan nothing recorded 16.6 17.8 16.0
gfx942: op test cluster2-shared, FP8 KV, 243 rows nothing recorded 19.6 21.4 19.7
gfx942: cluster8, FP8 KV, no caller workspace nothing recorded 21.2 23.0 21.2
gfx942: op test decode, FP8 KV, None scales nothing recorded 17.2 19.1 17.3

The recorded path alone, 4eaa731 against this head in 12 separate processes: -0.42 µs on average (-0.74 to -0.10).

MI455X at 224c2b0:

  • python3 -m pytest -q op_tests/test_flydsl_pa_decode.py: 369 passed, 174 skipped in 292 s (4eaa731: 368 passed, 174 skipped).
  • python3 -m pytest -q op_tests/test_flydsl_pa_decode.py op_tests/test_flydsl_pa_decode.py --keep-duplicates -k 'recorded_launch or merge_alignment or (test_pa_decode and (cluster or merge or graph-workspace))': 258 passed (the 129 tests that pass caller workspace or pin a merge path, each twice in one process).

The end-to-end figures in the PR body are still the earlier stack's and are labelled so.

Concurrent calls are as safe as before: a recording is a few single dict operations with a len() bound and nothing iterates the table. Eight threads calling at once with the bound lowered to 8: 453k calls, none raises and each launches its own operands.

@lirui927

Copy link
Copy Markdown
Contributor Author

Fixed in 2d45f7f.

[P2] Preserve scalar types in the validated-launch key. Scalar options and plan fields are now keyed with their types (tuple(map(type, scalars)) in _launch_options, aiter/ops/flydsl/pa_decode.py:614), so a value of another type that compares equal to a recorded one misses the table and reaches the checks.

  • New test test_pa_decode_recorded_launch_refusals (op_tests/test_flydsl_pa_decode.py:2794): after the valid call is recorded and repeated, store_output=1, quantized_pad_rows=False, sliding_window=0.0, query_length=1.0, a float max_context_length and a plan with a float max_batch_size must each raise the checked path's error. On the host (CPU tensors, mocked launch) it fails at 4eaa731 with DID NOT RAISE TypeError for store_output=1 and passes at 2d45f7f. Each refused call differs from the recorded one in that option only, so the test stays in bounds on the GPU even if a refusal regressed. Two assertions on _launch_options pin the type keying on gfx942/gfx950 too, where no launch is recorded.
  • A host differential check over 5736 call variants (options and plan fields of other types and values, operands of other shapes, dtypes, strides, alignments and kinds) compares a call with launches recorded against the checks alone: 306 diverge at 4eaa731, 0 at 2d45f7f. Besides the type collisions it found that an unhashable option raised TypeError: unhashable type from the lookup instead of the checks' own error; the lookup now falls through to the checks.

Validation on gfx1250 (MI455X) at 224c2b0, which is 2d45f7f with main merged in for CI:

  • python3 -m pytest -q op_tests/test_flydsl_pa_decode.py: 369 passed, 174 skipped in 292 s (4eaa731: 368 passed, 174 skipped).

@fsx950223 fsx950223 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.

Reviewed exact head 224c2b0 and the complete diff against e6d2d31. The earlier blocking scalar-type collision is addressed by typed keys and the new refusal test. No concrete blocking defect was found. Five targeted gfx942 tests passed, but essential independent GPU validation of the gfx1250 recorded-launch path remains unavailable.

Validation:

  • PASS on local: git -C source rev-parse HEAD
    Verified the supplied head SHA in an isolated checkout. The merge-base equals the supplied base. Complete diff preserved in complete.diff.
  • PASS on local: python3 -m compileall -q source/aiter/ops/flydsl/pa_decode.py source/op_tests/test_flydsl_pa_decode.py
    Exit 0. git diff --check also passed; logs preserved.
  • PASS on hjbog-srdc-39.amd.com / sixifang_dev: flock -w 30 /tmp/codex-pr-review-20261127-7869-224c2b0e/gpu.lock timeout 300 /tmp/codex-pr-review-20261127-7869-224c2b0e/venv/bin/python -m pytest -q op_tests/test_flydsl_pa_decode.py -k 'recorded_launch_refusals or bf16-decode or bf16-window or bf16-cluster8'
    Exit 0: 5 passed, 538 deselected in 11.62s. Verified exact remote HEAD, clean tracked source, gfx942, idle GPU 0, intended aiter import and isolated FlyDSL 0.5.3 import. Final run used isolated AITER, FlyDSL runtime and Triton caches. Commands and output preserved in gfx942-final.sh and gfx942-tests-final.log.
  • FAIL on hjbog-srdc-39.amd.com / sixifang_dev: Initial isolated-environment import check
    Stopped before tests because PYTHONPATH selected the container's FlyDSL 0.4.0. Corrected import precedence; subsequent tests passed. Initial log preserved in gfx942-tests.log.
  • FAIL on dzm-mi355-gpu34-dev: ssh -o BatchMode=yes -o ConnectTimeout=10 -o RequestTTY=no -o ControlMaster=no -o ControlPath=none -o RemoteCommand=none dzm-mi355-gpu34-dev "squeue -h -u zhiming_ding_qle -o '%i|%N|%t'"
    SSH exit 255: connection to aac16.amd.com port 22 timed out. Allocation discovery and gfx950 testing could not proceed. Evidence preserved in gfx950-discovery.log.
  • SKIP on gfx1250: python3 -m pytest -q op_tests/test_flydsl_pa_decode.py
    No configured gfx1250 environment. Recorded-launch GPU reuse, fused FP8 repeat/new-plan behavior and graph capture were not independently executed.

Remaining validation:

  • gfx942 results validate the shared launcher and refusal/key assertions, but do not exercise gfx1250 cache-hit GPU execution.
  • Author-reported MI455X correctness and performance results were reviewed but not independently reproduced.
  • Available CI checks are green and MI35X logs list this test file; they do not establish gfx1250 recorded-launch coverage.
  • Multi-GPU cache reuse and host-time performance claims were not independently measured. Detailed evidence is preserved in this task directory.

Automated Codex review of commit 224c2b0e03aa.

@lirui927
lirui927 marked this pull request as draft November 27, 2026 08:19
@lirui927

lirui927 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Closing: MiniMax-M3.1 now uses the NVFP4 sparse PA ops (sparse_pa_nvfp4_prefill / sparse_pa_nvfp4_decode), which do not go through pa_decode, so this launch record no longer sits on the path it was written for. If the host cost of pa_decode matters again for FP8 / MXFP4 K/V, making its checks cheaper is the better fix than recording validated launches.

@lirui927 lirui927 closed this Dec 2, 2026
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