Skip to content

test(bench): measure the 2026-11 memory and MLA changes on CUDA and ROCm #3133

Closed

Description

@inureyes

Requires a CUDA host (and a ROCm host if one is available). It cannot be done on the macOS development machine.

Problem

These 2026-11 changes were measured only on Apple Silicon (M5 Max):

The quantized folds and the causal-mode dispatch run on every backend, so a CUDA or ROCm regression would currently go unnoticed.

Acceptance Criteria

On GB10 hosts run GPU work under gpu-lock run --tag <purpose> -- <command>.

Added: DeepSeek V2 KV sizing follows the runtime layout

Since #3136, DeepSeek V2 caches the MLA latent by default wherever the fused Metal kernel runs: mla::absorbed_enabled(), which is AbsorbedMode::resolve(fused_decode_enabled()). src/execution/kv_arch.rs still classifies every deepseek_v2 config as KvArchKind::MlaDecompressed (around line 370) and sizes it per head. On V2-Lite that is 10240 bytes/token/layer against the 1152 actually cached (8.9x). The estimate feeds prompt-cache snapshot sizing (src/server/prompt_cache/snapshot_sizing.rs) and the KV cache advisor (src/execution/kv_cache_advisor.rs). Overcounting is safe for budgeting, but it shrinks the prompt-cache budget and skews the advisor's recommendation on Metal. This item belongs here because the CUDA/ROCm measurement above decides whether the default, and with it the sizing, changes on those backends too.

  • kv_arch resolves the deepseek_v2 layout through the same decision the loader uses (the MLXCEL_MLA_ABSORBED tri-state plus fused-kernel availability), and keeps decompressed where the runtime declines absorption (non-FP16 KV modes, paged caches)
  • Unit tests cover latent sizing under the Metal default, decompressed under MLXCEL_MLA_ABSORBED=0 and on a backend without the fused kernel, and the decline cases. The existing mla_v2_uses_decompressed_per_head test is updated accordingly
  • Prompt-cache snapshot sizing and the advisor output checked on the real V2-Lite checkpoint, before and after
  • If the CUDA/ROCm measurement switches the default on those backends, the sizing follows it in the same change (CUDA switched in update(mla): absorb DeepSeek V2 by default on CUDA, add GB10 results #3149; ROCm not measured, no host)

Resolution

CUDA (GB10) measured and recorded in #3149 (docs/benchmark_results/mla-and-prefill-memory-cuda-gb10-2026-11-18.md), which also made absorbed MLA the DeepSeek V2 default on CUDA. The kv_arch items were done in #3137. ROCm was not measured because no host was available.

Activity

  1. added
    status:ready
    type:test
    priority:medium
    area:benchmark
    platform:linux
    on Nov 16, 2026
  2. inureyes commented on Nov 16, 2026

    @inureyes
    MemberAuthor

    Runbook for the CUDA / ROCm measurement

    Everything needed to complete this issue on a Linux CUDA host (and a ROCm host if one is available). The Metal baselines it compares against are linked in each section. Report results under docs/benchmark_results/ (md plus CSV, no raw logs) in a PR that closes this issue.

    0. Ground rules

    • Measure commit 453c085e or a later main, and record the exact commit in every results file. bench_decode.sh stamps the commit from git, so rebuild after every checkout; the harness refuses a binary older than src/.
    • On a GB10 host, run every command that touches the GPU as gpu-lock run --tag mlxcel-3133 -- <command>. Never run two GPU jobs at once, and keep builds out of throughput runs (they cost 10 to 18% on a shared host).
    • A/B arms run interleaved (A, B, B, A), at least 2 repetitions per cell, with a 60 s idle period before each run. Report medians and keep every run in the CSV.
    • Record the host: GPU, driver, nvcc --version (the backend column, e.g. cuda-13.0), total memory, and whether memory is unified (GB10) or discrete.
    • Correctness is judged by the teacher-forced trace, never by byte identity or perplexity alone: scripts/compare_logit_traces.py REF.tsv CAND.tsv --decided 2, reporting decided-position disagreement. See docs/benchmarks.md#judging-a-change-that-moves-the-numbers.

    1. Checkpoints

    Download into models/ (not ~/.cache/mlxcel/models) with ./target/release/mlxcel download <id>:

    local dir HF id used for
    deepseek-v2-lite-chat-4bit-mlx mlx-community/DeepSeek-V2-Lite-Chat-4bit-mlx sections 3, 4, 7
    kimi-vl-a3b-thinking-4bit mlx-community/Kimi-VL-A3B-Thinking-4bit section 3
    glm-4.7-flash-4bit mlx-community/GLM-4.7-Flash-4bit section 5
    gpt-oss-20b-mxfp4-q4 mlx-community/gpt-oss-20b-MXFP4-Q4 section 5
    llama-4-scout-17b-16e-instruct-4bit mlx-community/Llama-4-Scout-17B-16E-Instruct-4bit section 6 (about 61 GB of weights; skip on a host under 96 GB and say so)

    2. Build and gate

    git fetch origin && git checkout 453c085e   # or current main
    cargo build --release --features cuda
    cargo build --release --features cuda --example logit_trace
    make verify-test-cuda

    make verify-test-cuda is the CUDA gate (cargo test --workspace --profile test-fast --features cuda --no-fail-fast -- --test-threads=1). Report the pass/fail counts and triage every failure: say whether it reproduces on main before these PRs, and file anything new separately. For ROCm use --features rocm and make verify-rocm.

    For the before/after cells in section 5 you also need builds of the parents of the PRs under test. Build each in its own worktree so the arms never share a target/:

    git worktree add ../mlxcel-pre3114 b21825cf   # parent of #3114 (e544c331)
    git worktree add ../mlxcel-pre3119 3efb3fb2   # parent of #3119 (08da8ed5)
    (cd ../mlxcel-pre3114 && cargo build --release --features cuda)
    (cd ../mlxcel-pre3119 && cargo build --release --features cuda)

    3. Absorbed MLA correctness on the composed path (the main question)

    On CUDA and ROCm the fused absorbed-decode kernel does not exist. mla::fused_decode_enabled() is false, so absorbed decode takes the composed path, and since #3136 the DeepSeek V2 default there is still decompressed. Verify both facts first.

    Use the same corpus as the Metal run: docs/architecture.md, docs/benchmarks.md and docs/turbo-kv-cache.md concatenated into corpus.txt. logit_trace arguments are MODEL TEXT CHUNK_TOKENS MAX_CHUNKS TOPK PREFILL. PREFILL is consumed untraced as context, and each remaining row is traced as a width-one decode step under MLXCEL_TRACE_BATCH_ROWS=1.

    M=models/deepseek-v2-lite-chat-4bit-mlx
    T="MLXCEL_TRACE_MLA_STATS=1 MLXCEL_TRACE_BATCH_ROWS=1 MLXCEL_LOGIT_TRACE_SCALAR_REFERENCE=1"
    env $T MLXCEL_MLA_ABSORBED=0 ./target/release/examples/logit_trace $M corpus.txt 64 8 8 1024 > v2-dec-1k.tsv
    env $T                       ./target/release/examples/logit_trace $M corpus.txt 64 8 8 1024 > v2-def-1k.tsv
    env $T MLXCEL_MLA_ABSORBED=1 ./target/release/examples/logit_trace $M corpus.txt 64 8 8 1024 > v2-abs-1k.tsv
    # repeat with "64 4 8 4096" for the 4K context rows
    python3 scripts/compare_logit_traces.py v2-dec-1k.tsv v2-abs-1k.tsv --decided 2
    python3 scripts/compare_logit_traces.py v2-dec-1k.tsv v2-def-1k.tsv --decided 2

    Expected:

    • Unset (default) is decompressed. v2-def should be byte-identical to v2-dec (same path; a difference means the default did not resolve to decompressed or the CUDA path is nondeterministic, and either is worth reporting), and the stats line shows no absorbed_* steps.
    • MLXCEL_MLA_ABSORBED=1 shows absorbed_composed, never absorbed_fused.
    • Decided disagreement of =1 against =0 is 0. Metal measured 0/209 at 1K and 0/106 at 4K; any decided disagreement on CUDA is a defect to investigate.

    Kimi-VL (a deepseek_v3 decoder, absorbed unconditionally) runs the composed path on CUDA by construction. Trace it once with "64 8 8 1024" and check that the stats show absorbed_composed and the run finishes with finite perplexity (Metal composed reference: ppl 18.04 at 1K).

    4. Should CUDA switch the V2 default too?

    Decode throughput, mlxcel-bench-decode, 128 tokens, 16 warmup, median tok/s:

    for P in 512 2048 16384; do
      MLXCEL_MLA_ABSORBED=1 ./target/release/mlxcel-bench-decode -m $M -p Hello -n 128 --warmup-tokens 16 --ignore-eos --prompt-tokens $P
      MLXCEL_MLA_ABSORBED=0 ./target/release/mlxcel-bench-decode -m $M -p Hello -n 128 --warmup-tokens 16 --ignore-eos --prompt-tokens $P
    done

    Decision rule (the one #3102 set for Metal): switch the CUDA default to absorbed only if =1 is within a few percent of =0 at 512 tokens and section 3 shows no decided disagreement. Metal had absorbed composed at about -10% at 512 before the fused kernel (#3102), so expect the CUDA composed path to fail the rule. State the measured numbers and the verdict explicitly either way. If the rule passes, change AbsorbedMode::resolve (src/lib/mlxcel-core/src/mla/mod.rs) so the default absorbs on that backend, with a unit test and doc updates, in the same PR.

    Metal reference (docs/benchmark_results/mla-absorbed-default-m5max-2026-11-16.md): 512: -1.7%, 2048: +1.8%, 16K: +48% (fused kernel).

    5. Prefill peak memory regressions (#3114, #3119)

    Prompt: python3 scripts/bench/metal_sdpa_chunk/make_prompt.py 28000 > prompt_28000.txt (the generator is backend-neutral despite the directory name). Measure each model with each pair of binaries (../mlxcel-pre3114 vs current for GLM, ../mlxcel-pre3119 vs current for gpt-oss), at MLXCEL_PREFILL_CHUNK=2048 and MLXCEL_PREFILL_CHUNK=0 (single pass):

    MLXCEL_PREFILL_CHUNK=0 /usr/bin/time -v ./target/release/mlxcel generate \
      -m models/glm-4.7-flash-4bit -p "$(cat prompt_28000.txt)" -n 48 --temp 0 --profile --show-reasoning

    /usr/bin/time -l (the macOS footprint used in the Metal tables) does not exist on Linux, and RSS does not count device memory on a discrete GPU. Record two figures:

    • the MLX allocator peak, from mlxcel-bench-decode -m <model> --prompt-tokens 28000 ..., line [Memory] after warmup (prefill + warmup tokens): ... phase peak X GB. This is backend-neutral and the primary number.
    • Maximum resident set size from /usr/bin/time -v. It is meaningful on unified-memory GB10 only.

    Also record prefill time from --profile and whether the greedy text is identical between the arms. The old single-pass GLM path is expected to fail (on Metal it timed out building a [20, L, S] f32 score per layer). Record the error text as the result. Metal reference: GLM 2048 chunks 28.82 to 20.51 GB, single pass failed to 24.11 GB; gpt-oss-20b single pass 22.54 to 17.86 GB.

    6. Llama 4 Scout past the 8192 chunk (#3117, #3126, #3135)

    Skip if the checkpoint does not fit; say so in the results.

    • Long single-pass trace (fits on Metal at 71 GB since fix(trace): score logit_trace rows in blocks so a 9216-wide forward fits #3135): ./target/release/examples/logit_trace models/llama-4-scout-17b-16e-instruct-4bit corpus2.txt 9216 1 8 0 > one.tsv against ... 4608 2 8 4608 > two.tsv, where corpus2.txt is docs/architecture.md followed by docs/installation.md. Report decided disagreement (Metal: 0/3651) and the MLX peak.
    • Decode past 8192: mlxcel generate --temp 0 -n 64 on a prompt of about 8,600 tokens, with MLXCEL_PREFILL_CHUNK=0 and with the default, must produce the same tokens.

    Metal references: docs/benchmark_results/llama4-long-prefill-memory-m5max-2026-11-16.md, llama4-rope-m5max-2026-11-16.md.

    7. KV sizing follows the runtime layout (the item added to this issue)

    Implement the "DeepSeek V2 KV sizing follows the runtime layout" checklist in the issue body after section 4 decides the CUDA default, so src/execution/kv_arch.rs matches whatever the default is on each backend. This part is pure code plus unit tests and can be developed on any host. Check the before and after numbers on the real V2-Lite checkpoint, from the KV cache advisor and prompt-cache snapshot sizing output, on CUDA (decompressed) and, if available, a Metal host (latent, 1152 vs 10240 bytes/token/layer).

    8. What to deliver

    • docs/benchmark_results/mla-and-prefill-memory-cuda-<host>-<date>.md with CSVs beside it (trace.csv, decode.csv, prefill-peak.csv), one file per host
    • the gate result and failure triage
    • the V2 CUDA default verdict with numbers, and the code change if it passes
    • the kv_arch change with tests
    • a PR closing this issue, its body carrying the tables above
  3. inureyes commented on Nov 16, 2026

    @inureyes
    MemberAuthor

    CUDA results (GB10, sm_121, main 5e9caf8a)

    Release builds on a quiet box, under gpu-lock, ABBA order with 60 s idle between runs.

    Section 3, V2-Lite composed MLA. The default arm is byte-identical to MLXCEL_MLA_ABSORBED=0 at 1K and 4K. With =1, stats show absorbed_composed only (absorbed_fused=0), and the KV cache drops from 10240 to 1152 bytes/token/layer. Decided disagreement against =0 is 0/208 at 1K (ppl 14.6543 vs 14.6582) and 0/106 at 4K (12.9485 vs 12.9960), matching Metal's 0/209 and 0/106. Kimi-VL also takes the composed path, with ppl 18.01 (Metal 18.04).

    Section 4, V2-Lite decode (tok/s, -n 128, two runs per arm).

    Prompt =0 =1
    512 101.8 / 101.1 90.6 / 98.0
    2048 83.8 / 79.1 98.7 / 96.9
    16384 30.1 / 30.4 72.0 / 73.7

    At 512, absorbed is 3 to 11% slower, which misses #3102's "within a few percent" bar. Keep =0 as the CUDA default. Absorbed wins from 2048 up (2.4x at 16K), so a length-based switch is worth considering.

    Section 5, prefill peak memory, 28K-token prompt (MLX phase peak from mlxcel-bench-decode).

    Model Path Before After Prefill tok/s
    GLM-4.7-flash (pre-#3114) 2048 chunks 24.79 GB 22.73 GB 421 to 535
    GLM-4.7-flash (pre-#3114) single pass 74.56 GB 30.18 GB 284 to 727
    gpt-oss-20b (pre-#3119) 2048 chunks 14.52 GB 14.52 GB 1698 to 1699
    gpt-oss-20b (pre-#3119) single pass 26.63 GB 26.63 GB 886 to 890

    The old GLM single pass did not fail on CUDA. It peaked at 74.56 GB. After the change, its greedy output matches the chunked runs, while the old single pass differed in wording (still coherent). gpt-oss is unchanged on CUDA by design: maskless_route_is_fused is Metal only, so the sink prefill keeps the band, and the output is identical across trees.

    Section 6, Llama 4 Scout past 8192. A 9216-token single pass vs two 4608 chunks gives decided disagreement 0/3642 (Metal 0/3651), ppl 11.8001 vs 11.7992. Generation from an 8720-token prompt was garbage on CUDA (also on the pre-#3114 and pre-#3119 builds). The cause is the CUDA SDPA overlay. is_kv_cache_slice lacked the kv.offset() != 0 check, so the chunked cache's decode window, a slice that starts mid-buffer, was rebased to the buffer start, and cuDNN read the wrong keys once the window reached 256. With the check, Scout answers correctly, and a teacher-forced decode after the 8720 prefill gives 0/149 decided disagreements (NLL 1.853 vs 1.854). A regression test fails without the fix (relative rms 1.12) and passes with it. That fix goes in a separate PR.

    Gate. make verify-test-cuda did not finish. The run was killed under host memory pressure in maskless_padded_prefill_parity (olmo3 case) after 72 test binaries: 12688 passed, 0 failed, 279 ignored. The rest still needs a run.

    Not done here: the results doc under docs/benchmark_results/ and the section 7 kv_arch sizing change.

  4. inureyes commented on Nov 16, 2026

    @inureyes
    MemberAuthor

    The "DeepSeek V2 KV sizing follows the runtime layout" item is done in #3137 (be70b63): kv_arch sizes the latent when absorbed decode is selected and the KV cache is FP16, decompressed otherwise, and the advisor no longer advises int8 for an absorbing V2. On the V2-Lite config at 32K tokens, mlxcel inspect reports 972.0 MiB of KV instead of 8.44 GiB. The last checkbox of that item (sizing follows a CUDA/ROCm default change) stays open with the measurements above; the sizing already reads the same mla::absorbed_enabled() decision, so a default change there carries over without further code.

  5. inureyes commented on Nov 17, 2026

    @inureyes
    MemberAuthor

    Section 4 follow-up: is the 512-token slowdown real?

    The 3 to 11% gap at 512 decides the CUDA default, so it needs more than two runs per arm before we act on it.

    Prefill does not leak into the decode figure. DirectEngine::generate starts the decode clock after complete_prefill has sampled and evaluated the first token (src/lib/mlxcel-core/src/engine/direct.rs, decode_start), and the rate counts generated - 1 tokens inside that window. The absorbed cold prefill reads the latent back through view.update_and_fetch before the dense SDPA (src/models/deepseek_v2.rs, forward_absorbed), so the cache write sits on the logits path and is evaluated with the first token, not deferred into the first decode step.

    Three explanations remain:

    1. Noise. The =1 runs at 512 are 90.6 and 98.0 (8% apart) while =0 is 101.8 and 101.1. Taking 98.0 alone, the gap is 3.4%, close to perf(models): decide DeepSeek V2's default MLA cache layout by measurement #3102's bar.
    2. Per-step cost of the composed path. Absorbed composed decode launches the q absorb matmul, latent scores, softmax and output projection separately, against one SDPA call for the decompressed cache. At short context, launch count outweighs KV bytes read. Metal showed about -10% at 512 before the fused kernel.
    3. First-seen shapes (hypothesis). The composed matmuls change shape with the cache length T. The default warmup of 20 tokens covers T up to about 532, while the measured -n 128 pass reaches 640, so cuBLASLt plan selection for each new shape may land in the decode window, and more of it on the =1 arm.

    Requested on GB10, V2-Lite, 512-token prompt, same build, quiet box, gpu-lock, ABBA order:

    • -n 128, default warmup, 5 runs per arm. Report median and spread. Separates 1 from the rest.
    • -n 128 --warmup-tokens 160, 5 runs per arm. If the gap closes here, 3 is the cause.
    • -n 512, default warmup, 3 runs per arm. A fixed first-shape cost shrinks relative to the window; a per-step cost (2) keeps the gap at the same ratio.

    Please include prefill_time_ms and decode_time_ms from the CSV and the MLA path counts the harness prints for each run, so every =1 run is confirmed to have taken absorbed_composed. If 2 holds, the length-based switch mentioned in the results comment becomes the candidate for the CUDA default; if 1 or 3 holds, the absorbed default may be fine on CUDA as is.

  6. inureyes commented on Nov 17, 2026

    @inureyes
    MemberAuthor

    Section 4 follow-up results (GB10)

    Same build (main 5e9caf8a), V2-Lite 4-bit, 512-token prompt, --ignore-eos, quiet box, gpu-lock, ABBA order, 60 s idle before each run. mlxcel-bench-decode prints no MLA counters, so the measurement build adds one line after Decode path: printing mla::stats::snapshot().summary(). The counters are always recorded, so the measured code is unchanged. The line is not committed.

    Decode tok/s, median (min to max):

    Cell =0 =1 =1 vs =0
    -n 128, default warmup (20), 5 runs 96.05 (92.51 to 97.21) 98.52 (93.23 to 100.20) +2.6%
    -n 128 --warmup-tokens 160, 5 runs 98.63 (97.34 to 99.61) 98.92 (92.69 to 101.49) +0.3%
    -n 512, default warmup, 3 runs 93.47 (64.01 to 96.03) 94.43 (91.43 to 94.90) +1.0%

    The 64.01 run (=0, -n 512, rep 6) is a single outlier; the other two =0 runs are 96.03 and 93.47. Prefill is 1942 to 1999 ms in every run, with no arm difference.

    Every =1 run took the composed path: absorbed_composed = 3942 / 7722 / 14310 per cell, and absorbed_fused=0. Each =0 run shows only decompressed. The 54 decompressed calls in each =1 run are the two cold prefills (27 layers each), which matches absorbed_prefill=0. The counts are cumulative over the warmup and measured passes.

    Reading. This is explanation 1, noise. With five runs, each arm spans 4 to 8% from run to run, and the medians are within 3% in every cell, with =1 never behind. The first round's 90.6 was a low run of the same kind (the second =1 run there was 98.0). The longer warmup does not change the ratio (3), and -n 512 keeps the arms level rather than at a fixed per-step gap (2). Together with the 0/208 and 0/106 decided disagreements above, =1 meets #3102's bar on CUDA. Switching the CUDA default to absorbed needs no length-based switch. This replaces the "keep =0" recommendation in my results comment above.

    Per-run data
    Cell Run Arm prefill_ms decode_ms decode tok/s MLA paths (nonzero)
    n128 1 =1 1958.17 1267.49 100.20 decompressed=54 absorbed_composed=3942
    n128 2 =0 1986.78 1314.65 96.60 decompressed=3996
    n128 3 =0 1997.50 1346.15 94.34 decompressed=3996
    n128 4 =1 1964.65 1362.18 93.23 decompressed=54 absorbed_composed=3942
    n128 5 =1 1965.68 1281.86 99.07 decompressed=54 absorbed_composed=3942
    n128 6 =0 1962.45 1306.44 97.21 decompressed=3996
    n128 7 =0 1953.16 1322.27 96.05 decompressed=3996
    n128 8 =1 1963.06 1289.02 98.52 decompressed=54 absorbed_composed=3942
    n128 9 =1 1944.20 1297.95 97.85 decompressed=54 absorbed_composed=3942
    n128 10 =0 1954.69 1372.78 92.51 decompressed=3996
    n128w160 1 =1 1955.89 1274.46 99.65 decompressed=54 absorbed_composed=7722
    n128w160 2 =0 1946.31 1304.64 97.34 decompressed=7776
    n128w160 3 =0 1949.87 1274.98 99.61 decompressed=7776
    n128w160 4 =1 1949.83 1251.32 101.49 decompressed=54 absorbed_composed=7722
    n128w160 5 =1 1950.03 1283.87 98.92 decompressed=54 absorbed_composed=7722
    n128w160 6 =0 1944.38 1287.61 98.63 decompressed=7776
    n128w160 7 =0 1949.29 1289.59 98.48 decompressed=7776
    n128w160 8 =1 1942.49 1342.12 94.63 decompressed=54 absorbed_composed=7722
    n128w160 9 =1 1955.89 1370.22 92.69 decompressed=54 absorbed_composed=7722
    n128w160 10 =0 1954.03 1281.10 99.13 decompressed=7776
    n512 1 =1 1955.42 5411.48 94.43 decompressed=54 absorbed_composed=14310
    n512 2 =0 1968.04 5321.51 96.03 decompressed=14364
    n512 3 =0 1949.67 5467.20 93.47 decompressed=14364
    n512 4 =1 1998.85 5589.22 91.43 decompressed=54 absorbed_composed=14310
    n512 5 =1 1957.57 5384.50 94.90 decompressed=54 absorbed_composed=14310
    n512 6 =0 1973.11 7982.53 64.01 decompressed=14364
  7. inureyes commented on Nov 17, 2026

    @inureyes
    MemberAuthor

    CUDA gate (GB10, main fab141b1)

    cargo test --workspace --profile test-fast --features cuda --no-fail-fast -- --test-threads=1 --skip glm4v_moe_maskless_padded_prefill_matches_unpadded: all 184 test binaries ran, 15910 passed, 0 failed, 498 ignored.

    The one skip is needed because the plain make verify-test-cuda cannot finish on this 121 GB host. The kernel OOM killer stopped it twice inside tests/maskless_padded_prefill_parity.rs: glm4v_moe alone takes MemAvailable from 101 GB to 13 GB, and memory from earlier tests in the binary is not returned. That run also hit one failure in distributed::stage_assignment::coordinator_names_peers_that_did_not_commit, which then passed 5 of 5 times alone and in the full run above; it is a port reservation race in the test helper. Both are filed as #3147.

    Defects found while working on this issue: #3138 (CUDA SDPA mid-buffer KV, fixed and merged), #3140, #3147.

  8. added
    status:done
    and removed
    status:ready
    on Nov 18, 2026
  9. inureyes commented on Nov 18, 2026

    @inureyes
    MemberAuthor

    ROCm row (gfx1151) and the default it implies

    The CUDA row (#3149) is above; this fills the ROCm row #3133 was closed without. Host: Ryzen AI MAX+ 395 with Radeon 8060S (gfx1151, 20 WGP), 30 GiB unified memory, HIP 7.15, release build from c27b86f4 with --features rocm, every GPU run under the ROCm guard lock, ABBA order with 60 s idle before each run.

    Section 3 (absorbed MLA on the composed path). MLXCEL_MLA_ABSORBED=1 traces absorbed_composed on every step and absorbed_fused=0, as expected without a fused kernel. Decided-position disagreements against =0: 0 of 208 behind 1024 tokens and 0 of 105 behind 4096 (top-1 disagrees 6 of 512 and 3 of 256, all where the reference's own top two sat within 0.25 logits). Kimi-VL runs the composed path too (absorbed_composed=13824), ppl 17.97 against the Metal composed reference of 18.04. The unset default on the measured commit still resolved to decompressed and traced byte-identical to =0.

    Section 4 (should ROCm switch the default). decode tok/s, deepseek-v2-lite, tg128:

    prompt =0 =1 composed
    512 (5 runs/arm) 42.72 (41.62 to 43.57) 41.28 (36.94 to 41.78) -3.4%
    2048 35.28 41.41 +17%
    16384 22.04 36.49 +65%

    The 512 cell was measured twice (the first pair read +5.6% with a 14% spread in the decompressed arm); the five-run repeat puts the composed path 3.4% behind, inside the band the Metal switch was made under, with a 3.7 GB smaller phase peak behind 16K. Both of #3102's conditions therefore hold, so the V2 default now absorbs on ROCm as it does on CUDA.

    Section 5 (prefill peak). GLM-4.7-Flash 2048-token chunks: 25.26 to 20.53 GB; a 28K single pass that asked for 62.72 GB on the pre-#3114 tree now fits in 21.13 GB; generate prefill 919.2 to 306.9 s (3.0x). gpt-oss-20b is unchanged at 26.21 GB and its single pass fails on both trees as designed.

    Not covered. Llama 4 Scout (about 61 GB) does not fit this host. make verify-rocm-held was stopped by the harness memory guard on this 30 GiB machine, so the gate half is hosted CI plus the narrow runs listed in the PR.

    Results: docs/benchmark_results/mla-and-prefill-memory-rocm-gfx1151-2026-11-18.md with per-run CSVs. Code and docs land in #3152.

  10. inureyes commented on Nov 18, 2026

    @inureyes
    MemberAuthor

    The ROCm row is measured now, on a gfx1151 host (Ryzen AI MAX+ 395, Radeon 8060S, 30 GiB unified memory, HIP 7.15.26333, MLX pin fc344c98, overlay 75915908). Results record: docs/benchmark_results/mla-and-prefill-memory-rocm-gfx1151-2026-11-18.md, carried by #3152.

    Measured

    • Section 3, correctness. 0 of 208 decided disagreements behind 1024 tokens and 0 of 105 behind 4096, comparing MLXCEL_MLA_ABSORBED=1 (composed path) against =0 with teacher-forced traces. Kimi-VL counts absorbed_composed only, ppl 17.9719.
    • Section 4, decode. Median tok/s over five runs per arm at 512: 42.72 decompressed against 41.28 composed, so -3.4%. At 2048: 35.28 against 41.41, +17%. At 16384: 22.04 against 36.49, +65%, with the phase peak falling from 16.06 to 12.39 GB.
    • Section 5, prefill peak. GLM-4.7-Flash 2048-token chunks go from 25.26 to 20.53 GB and generate prefill from 919.2 s to 306.9 s. A 28K single pass that fails to allocate 62.72 GB on the pre-perf(models): fold the remaining hand-masked MLA prefills into SDPA #3114 tree now fits in 21.13 GB.
    • Section 7, sizing. mlxcel inspect on a build of the change reports 972.0 MiB of KV (12.12 GiB total) with the default and 8.44 GiB (21.10 GiB total) under =0.

    The switch lands in #3152: mla::default_absorbs_on now absorbs on ROCm, the same rule Metal and CUDA follow. The 512-token cell is 3.4% behind, inside the "within a few percent" band the Metal default was switched under (-1.7%), and the longer prompts gain 17% and 65%.

    Omitted, with reasons

  11. added this to the 0.9 milestone on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:benchmarkplatform:linuxpriority:mediumstatus:donetype:test

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions