Skip to content

[GEMM] Keep GLM-5.3 BF16 projections consistent across batch sizes - #6

Closed
Qubitium wants to merge 3 commits into
mainfrom
fix/glm53-bf16-batch-invariance
Closed

Qubitium wants to merge 3 commits into
mainfrom
fix/glm53-bf16-batch-invariance

Conversation

@Qubitium

@Qubitium Qubitium commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

The same GLM-5.3 token can get different BF16 projections when the batch size changes. Select compatible kernel families before per-M speed tuning for five (N,K) shapes on gfx950/256 CUs.

Differing output values versus the same rows at M=8192 (seed 0, MI350X):

(M, N, K) main This PR
(1, 4096, 8192) 1,593 0
(320, 8192, 128) 35 0
(1, 32768, 512) 4 0
(1, 288, 4096) 1 0
(1, 128, 4096) 1 0

Use compatible non-split Triton and ASM kernels across M buckets. Select the next marked bucket, or the last for larger batches. Shared Qwen/Q3VL rows are updated in place; this applies to all matching shapes, regardless of model.

Warm-cache GPU-graph latency on MI350X: main at 2bafed472 versus this PR.

(M, N, K) Main (µs) This PR (µs)
(1, 4096, 8192) 12.49 11.90
(64, 4096, 8192) 15.43 21.79
(8192, 4096, 8192) 435.70 440.41
(8192, 32768, 512) 395.68 360.95
(1, 128, 4096) 2.99 5.64

Accurate kernels should be the default. Faster variants that trade accuracy or required batch consistency for speed must require explicit user opt-in and documented, validated error bounds. Kernels with severe numerical errors must never be selectable, even by opt-in.

The mismatch counts above measure batch-size drift, not error magnitude against a numerical reference.

@Qubitium Qubitium added the bug Something isn't working label Oct 27, 2026
@Qubitium Qubitium self-assigned this Oct 27, 2026
@github-actions

Copy link
Copy Markdown

🏷️ 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 6 --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.

Use single-split MFMA16 Triton configurations across the five validated families and ASM256 for large Qwen, GLM and decode batches. Keep every dispatched bucket in the same numerical family without optional backends.

Cover ceiling boundaries, permutations, padding, independent input copies, output canaries and graph replay across three seeds. Preserve normal reference tolerances and bound wide-exponent accumulation error against FP64. Also check direct Triton BF16 and FP16 calls.
Restore the validated decode tile only at M=256, preserving the M<=255 path. Use the screened 32x32x128 router tile for M=513..2048. Keep the numerical family, reference tolerances, and large-batch routes unchanged.
@Qubitium Qubitium closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant