Skip to content

docs: the gemma3 NPU row names the packs checked on the host and each geometry's shapes (Refs #1786) - #2250

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cl-flm/gemma3-rows
Nov 12, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cl-flm/gemma3-rows

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

What

docs/npu.md's gemma3 rows said the device lacks one kernel shape, QKV K2560 N4096. That holds only for the 4B geometry. This PR rewrites the two rows to name which gemma3 packs answer on the host forward today and the shapes each geometry needs. It is docs only, with no behaviour change. Refs #1786.

Measured (2026-11-12, main at cd3054f, host GEMM, no device)

The known-answer prompt was run with each pack's own chat template, using greedy decode:

pack answer
Gemma3-270M-NPU2 Paris <end_of_turn> (the quarter tile, #2248)
Gemma3-1B-NPU2 Paris<end_of_turn>. A three-sentence sky prompt gets a correct Rayleigh-scattering answer.
Gemma3-4B-Text-NPU2 Paris <end_of_turn>
Medgemma-4B-NPU2 Paris <end_of_turn> (#2242/#2248)

Gemma3-1B and Gemma3-4B-Text needed no code change.

medgemma-1.5-4b-it, Gemma3-4B and Translategemma-4B-Instruct carry the same config.json text keys and the same model.q4nx size (3,768,226,744 B) as Medgemma-4B. They were not run.

tests/census_watch_test.py (it reads these rows): all checks passed.

🤖 Generated with Claude Code

… geometry's shapes (Refs #1786)

Gemma3-1B-NPU2 and Gemma3-4B-Text-NPU2 answer the known-answer prompt on the host
forward at main (cd3054f) with no code change, beside Gemma3-270M and Medgemma-4B.
The row said one shape (QKV K2560 N4096) was missing; that is the 4B geometry only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

ready for review at f2cdae4

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

1786 - Partially compliant

Compliant requirements:

  • Every FastFlowLM/*-NPU2 model source imports and serves on --device npu
  • Each repo must import with zero gaps and pass self-check against a named reference
  • Each repo must serve on --device npu
  • Each repo must answer a known-answer prompt with the model's own chat template, 3 identical requests returning identical text
  • Decode tok/s and time-to-first-token must be measured under npu-hold

Non-compliant requirements:

  • The row names the kernel set and the engine commit that produced it

Requires further human verification:

  • Verification that the kernel set and engine commit are correctly named in the documentation
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incomplete Kernel Set Documentation

The documentation updates mention that specific kernel shapes are needed for different Gemma3 geometries, but do not explicitly state the engine commit that produced the kernel set. This is required for full compliance with the ticket's DoD.

| `gemma3` | `FastFlowLM/medgemma-1.5-4b-it-NPU2` | hrx | not served on the device by a stock install: no kernel set for a gemma3 geometry ships. The forward reads the family and answers the known-answer prompt on the host ("Gemma3 text decoders" above) for four of its packs, checked 2026-11-12: `Gemma3-270M-NPU2`, `Gemma3-1B-NPU2`, `Gemma3-4B-Text-NPU2` and `Medgemma-4B-NPU2` each answer `Paris` and then stop. `medgemma-1.5-4b-it`, `Gemma3-4B` and `Translategemma-4B-Instruct` have the same `config.json` text keys and `model.q4nx` size as `Medgemma-4B`. The shapes each geometry needs: 4B `QKV K2560 N4096`, `O K2048 N2560`, `GU K2560 N20480`, `D K10240 N2560`; 1B `QKV K1280 N1536`, `O K1024 N1536`, `GU K1280 N13824`, `D K6912 N1536` |

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at f2cdae4: READY

Docs only: two rows in docs/npu.md. It merges cleanly onto main. CI build at f2cdae4 is green: 100% tests passed, 0 tests failed out of 262. tests/census_watch_test.py, which reads these rows: all checks passed.

The shape lists are right, and they are the padded design shapes (K on the 256 grid, N on the 512 grid; Q4NX_K_GRID/Q4NX_N_GRID in q4nx_pack.c), which is how the kernel names are spelled:

  • 4B, from Medgemma-4B-NPU2's config (H 2560, intermediate 10240, 8 heads, 4 KV, head_dim 256): QKV K2560 N4096, O K2048 N2560, GU K2560 N20480, D K10240 N2560. All are on the grid, and they match the row. They also match what I found on #2210/#2190: QKV K2560 N4096 is the one shape not built.
  • 1B, from Gemma3-1B-NPU2's config (H 1152, intermediate 6912, 4 heads, 1 KV, head_dim 256): the raw shapes QKV K1152 N1536, O K1024 N1152, GU K1152 N13824, D K6912 N1152 pad to QKV K1280 N1536, O K1024 N1536, GU K1280 N13824, D K6912 N1536, exactly the row's.

The 270M row's prerequisite is on main. It answers via the 1,280-byte quarter tile, #2248, merged 04:01Z.

Not checkable here, and worded accordingly in the row:

  • The size and config-key claim for medgemma-1.5-4b-it, Gemma3-4B and Translategemma-4B-Instruct: those packs are not on this box. Only Medgemma-4B (3,768,226,744 B, matching) and Gemma3-1B are.
  • The four host-forward Paris answers: not re-run.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant