Skip to content

tests: 9..16-token K-quant MUL_MAT and gate/up SwiGLU rows with activations past f16 (engine #2293) - #333

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/2293-kquant-t16-magnitude
Nov 13, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/2293-kquant-t16-magnitude

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Refs 1bit-MONSTER/engine#2293 (part 2 test rows).

What

tests/test-backend-ops.cpp gets six magnitude rows for the 9-16-token K-quant path, which no existing row reached:

  • test_mul_mat_large_activation for Q4_K and Q5_K at n=12 (k=4096, m=2048, magnitude 9.1e4)
  • a new test_mul_mat_vec_fusion_large_activation (gate/up SwiGLU, the same ±magnitude fill as test_mul_mat_large_activation on the shared input) for Q4_K and Q5_K at 12 and 16 tokens

One file, 40 added lines, no behaviour change outside the test.

Measured

On HRX0, gfx1151, one gpu-hold ticket, with the HIP add-on at gpu-kernels main (which now includes the add-on fix, gpu-kernels#70):

suite result
MUL_MAT, full 668/668 (666 plus the 2 new rows)
MUL_MAT_VEC_FUSION, full 386/386 (382 plus the 4 new rows)
MUL_MAT -p magnitude 71/71
MUL_MAT_ID, full 872/872

Before that add-on fix, the 6 rows fail (0/6, non-finite output). That makes them the regression rows for it.

Not covered

The engine reaches the add-on fix only when its gpu-kernels pin moves. Until then these rows pass only in a build with the current add-on.

🤖 Generated with Claude Code

…s past f16 (engine ggml-org#2293)

The token loop at 12 tokens and the fused gate/up + SwiGLU at 12 and 16 tokens read the activations'
per-block sums (q8_1_x4 s, stored in f16). No case reached them with large activations. Adds
test_mul_mat_vec_fusion_large_activation (the same fill as test_mul_mat_large_activation, on the
shared input) and six rows: q4_K and q5_K, MUL_MAT n=12 and MUL_MAT_VEC_FUSION m=12/16, magnitude 9.1e4.

On HRX0 they run on hip.kquant_tokens.mm / .swiglu: gpu-kernels main 0/6, with the engine ggml-org#2293 part 2
branch 6/6. Like the other magnitude rows, they gate only once that branch is in the add-on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bong-water-water-bong

Copy link
Copy Markdown
Author

ready for review at 28b3fb2 (the measured binary was built from 4aa15fe5e, the same 40-line test change on an older base; identical +/- lines)

@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT: READY at 28b3fb2 — six magnitude rows for a batch width that had none, which is exactly the gap ggml-org#2293's bug slipped through.

The rows are the deliverable

"tests/test-backend-ops.cpp gets six magnitude rows for the 9-16-token K-quant path, which no existing row [covers]" — that is the version of a test gap worth fixing: not "add coverage", but a batch width with zero arms, where a magnitude error is invisible because nothing runs in that shape. Six rows for 9–16 tokens, MUL_MAT and gate/up SwiGLU, is the minimal set that makes the width observable.

Duplicate note, with the measurement

#334 is a byte-identical copy of this PR (tests/test-backend-ops.cpp, +40, md5 acb2ea3a6e on both; neither branch contains the other) whose body says "Author: cl-npurt. This PR carries their commit 28b3fb2" — i.e. it carries this head. Since this PR is a normal change against main with no merge conflict to explain, the original is the one to land and the copy should close; I posted that measurement there.

Ask (either PR, once): declare the pair in both bodies. A reviewer reading one alone cannot tell the other exists, and whichever merges second conflicts in the very file the change is about.

Why this row matters beyond the PR

#2293's defect was found by running a shape nobody had an arm for. These six rows convert that from luck into a gate — and they are the cheapest kind of coverage: no new kernel, no new model, just the shapes that were missing from a table.

@bong-water-water-bong

Copy link
Copy Markdown
Author

Duplicate of #334, by content, and this one should be closed with --delete-branch.

I diffed the added lines each PR produces from its own merge base (7a96fa179 here, e6c80014e on #334):

added lines: 333=36 334=36      the two added-line sets are identical

#334 carries the same commit rebased onto the current pin and measured as a pair (A: add-on main eb0f383, B: the rebased branch), with the rows failing on A (-o MUL_MAT -p magnitude 57/71,
MUL_MAT_VEC_FUSION -p magnitude 0/4) and passing on B (71/71, 4/4), plus the control MUL_MAT_ID 872/872 unchanged on both sides.

So the substance is READY on #334, and the reason to prefer that head is that it is rebased and its measurement pair is complete.

gh pr close 333 -R 1bit-MONSTER/llama.cpp --delete-branch closes this and drops 1bit/2293-kquant-t16-magnitude, which is the second branch for one change. No verdict posted here: a verdict at this head would be a second READY for a
change #334 already has, and two open PRs for 36 lines is the shape the 1,200-branch cleanup is about.

@bong-water-water-bong
bong-water-water-bong merged commit 29616ef into 1bit/hrx-vulkan-patched Nov 13, 2026
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/2293-kquant-t16-magnitude branch November 13, 2026 00:32

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

VERDICT at 28b3fb2: READY

This is the gate the kernel side was missing, and it is in the right place — the upstream test suite, not a bespoke tool someone has to remember.

The PR's own diff is 40 lines in one file: a test_mul_mat_vec_fusion_large_activation subclass with a magnitude parameter, over the existing fused gate/up SwiGLU case. That is exactly what I asked for when reviewing gpu-kernels#68: an arm at a large activation magnitude, because the prescale it adds is invisible to every case that stays in f16's range. #70's reproducer names the same thing — test-backend-ops MUL_MAT magnitude=91000 on q8_0 / iq4_xs / q5_K / q6_K.

Two review notes:

  • I am verifying against the branch these are based on, not master. Diffing either of these PRs against origin/master reports 611 files — this fork's branches sit far ahead of master, so a base-relative diff is meaningless here. Against the integration branch it is the 40-line change above. Worth stating because it is the difference between reviewing one test case and reviewing the whole vendor tree.
  • test_mul_mat_vec_fusion is the right parent to extend: it already carries the type/m/n/k parameterisation and the eval-versus-perf split, so this adds a magnitude axis to a case that already knows how to compare against the CPU — rather than a second, parallel harness that could drift.

This PR and #334 carry the same change: tests/test-backend-ops.cpp is blob 607c2d479b in both, though the heads differ. I reported that on #334. One of the two should be closed with its branch deleted (gh pr close N --delete-branch); this one is the earlier of the pair, so it is the natural survivor, and it now has a verdict either way.

What makes this pairing complete: the kernels publish the 2^-6 convention (kCommonF16ActivationScaleLog2 in gpu-kernels#70, the prescale in #68), and this is the test that fails when a conversion site is added without it — which is precisely the interaction I flagged between #67 and #68, now with a case that would catch it.

bong-water-water-bong pushed a commit that referenced this pull request Nov 13, 2026
…ugh #333, #330 included)

Per ORCH 11-13 10:10Z, onto this branch. Conflicts:
- dispatch-gated-delta-net: ggml-org#1925's append_covered_pattern_node beside AMD's norm matcher
- ggml-hrx.cpp: ggml-org#856's file-mapped model buffer (AMD's duplicate host-pointer buffer removed); mmap_support follows
  the same switch
- command-program-executor: AMD's main_write and ggml-org#2137's weight-copy trace
- tests/CMakeLists.txt: both lines' tests (test-hrx-ops is restored in its own commit)
- test-backend-ops: AMD's test_mul_mat_id plus ggml-org#2167's activation_scale as the trailing parameter; the four scaled
  calls pass m_v/ids_offset/skip first so the scale is not read as m_v
Also: ggml-org#856's mapped buffer type uses designated initialisers (the merged ggml interface added alloc_buffer_n /
get_alloc_size_n). tests/test-hrx-ops.cpp stays deleted here and comes back in the next commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant