Repository navigation
gguf, placement, gpu: a type's card columns in its QROWS row, read by every card operation and layout - #588
Conversation
…y card operation and layout The card operations (gate_up, down, gemm, dense, head, embed) and CardFormat::of and of_routed each held their own exhaustive match over GgmlType, so a new type was decided in eight places. Each type's QRow now carries its card columns (gguf::card::Card): its card layout, its routed layout and its entry in each operation, written beside the row's other facts by card!. QRow has no Default, so a row without its card columns does not compile. placement::kernels reads the columns by operation, and CardFormat::holds takes the file's blocks for the types whose routed gate·up or down entry reads them (GateUpEntry::layout, DownEntry::layout) in place of its own list. SiteEntry::ty gives a dense entry's file type from the row that names it, and the build refuses a dense entry that no row or two rows name. The column types move to gguf::card with the rows that hold them: the entry enums, which placement::kernels re-exports, and CardFormat with its byte arithmetic, which placement re-exports. CardFormat::of_role reads a placement Role, so it stays in placement as card_format_of_role. The GEMM column gains IQ2_XXS (gemm_iq2xxs): GemmWeight::from_ggml decodes it and the latent MoE body launches it, but its row had no GEMM entry. The card leg's route test moves IQ2_XXS's words to the grouped routes. Every other pinned pair is unchanged; two new pins hold the card and routed layouts, and the types each layout holds, to what the matches gave.
SiteTy kept its own type list in of_ggml, gemm_weight, reads and Display, and the qwen3moe body a second pair of maps (site_ty, ggml_ty). The family now maps to its dense entry once (SiteTy::entry); of_ggml reads kernels::dense, SiteTy::ggml the file type of the row that names the entry, gemm_weight the row's GEMM entry, and Display the file type's name. site_ty and ggml_ty are gone, their callers on SiteTy::of_entry and SiteTy::ggml. GemmWeight::from_ggml and the card leg's route read the GEMM entry through GemmWeight::of_entry, and the lm_head picks its gemv by kernels::head. The quant_sel invocation keeps its lines, which name its PTX entries, and a const assert per line holds its gate·up and down entries to the row of its type. IqFormat::of, which no caller used, is gone. No launch changes: every entry is chosen as before, which the site test pins over every type (family, file type, name, GEMM and kgemv layout).
There was a problem hiding this comment.
Verdict: CLEAN: No must-fix finding remains; the move proof needs an update.
Non-blocking
⚠ Refresh the move proof: crates/gpu/src/site.rs:172 replaces the GEMM dispatch match with table lookups used by site::gemm.
The reported canon-check uses earlier commits. Attach just canon-check ea128adff06f352c445e27ed05ef46df15235878 at the current head, plus graph node counts, eager/replay equality, and e2e set equality required by the move class in AGENTS.md.
Checked
Duplicates: Both dryer pairs compare labels from different domains and share only a match shape.
Complexity: Diagnostics report 22 for CardFormat::buffer_bytes; its definition is identical to the base.
Silent failure: Site admission refuses unsupported types; constant evaluation rejects missing or duplicate dense entries.
Tests: The site test asserts family/type mappings, labels, GEMM weights, and activation/layout relationships. Mutation results were not independently rerun.
Gates: The IQ2_XXS GEMM pin and merged site pins have dated reasons.
Escape catalog: C1–C4 do not match the retained finding.
Notes
Validation used source inspection and a definition comparison. Rust builds, hardware gates, and Python mutation checks were not run during validation.
Card check: gpu-evidence. This pull request changes crates/gpu-gates/src/act_rule.rs, crates/gpu-gates/src/bin/gate_deepseek41_chain_glue.rs, crates/gpu/src/arch/qwen3moe/body.rs … and carries a gate run on the author's card, which counts as verified.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
카드 커널 표를 타입별
QROWS행의 열로 옮겨, 호스트와 카드가 한 행을 읽도록 합니다. 동작은 바뀌지 않습니다.Follows #570, its card type table item, and #565 round 1.
What and why
This PR puts each type's card-side facts in that type's row of
QROWS(crates/gguf/src/qtype.rs), the direction the maintainer suggested in #565. A type now has one row for its host path and its card path. Behavior stays the same: the card kernel choices, layouts and admission answers stay the same, and one test pin moves for IQ2_XXS (see "What I ran into"). It makes no speed claim.Before, the card facts lived in several matches over
GgmlType: six inplacement/src/kernels.rs, theCardFormatconstructors and itsholdslist, and seven copies ingpu(site.rs,qwen3moe/body.rs,gemm/grouped.rs,card_leg.rs,head.rs,iq.rs,quant_sel.rs). Adding a type meant finding and editing every one of them.Now a row carries a
Cardvalue with eight columns:layout,routed,gate_up,down,gemm,dense,headandembed. The operations inplacement::kernelsreadty.card().<column>, so their names and signatures stay as they were. Thegpucopies read those same functions.Release notes: Under the hood: the card kernel table is a column set on the
QROWSrows, and the per-type matches in placement and gpu read it.Code shape
QROWSis the one owner of a type's card columns. Thegpucopies of the table now readplacement::kernels.SiteTy::entry()is the one map from a site type to its entry.qwen3moe/body.rslost itssite_tyandggml_tyhelpers.IqFormat::ofhad no caller and is removed. The placementcard_types!table from the earlier design is not part of this PR.cardcolumn does not compile, becauseQRowhas noDefault. Two rows naming one dense entry, or no row naming one, fail the build.GemmWeight::from_ggmlandhead_out_wstill reject unsupported types by name.gemm_admits_exactly_the_pinned_pairsgained the IQ2_XXS row, with aPIN(2026-10-21)line and the reason.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up. I did not runjust linthere, so the clippy count is unchecked.Duplication found or removed (
path:line): the per-type matches incrates/placement/src/kernels.rs,CardFormat::of,of_routedandholds(nowcrates/gguf/src/card.rs), and the gpu copies incrates/gpu/src/site.rs,crates/gpu/src/arch/qwen3moe/body.rs,crates/gpu/src/gemm/grouped.rs,crates/gpu/src/card_leg.rs,crates/gpu/src/head.rsandcrates/gpu/src/quant_sel.rs.What changed
crates/gguf/src/card.rs(new): theCardcolumn type,Card::NONE, thecard!row macro andGgmlType::card(). The entry enums (GateUpEntry,DownEntry,DownAct,GemmEntry,SiteEntry,SiteAct,HeadEntry,EmbedEntry) andCardFormatmoved here from placement, becauseQROWSis ingguf, a crate below placement, and Rust does not allow an inherent impl on another crate's type.placement::kernelsre-exports the enums, so existing paths still work.SiteEntry::tyanswers from a const table in constant time, and the build refuses a table where two rows or no row name a dense entry.crates/gguf/src/qtype.rs:QRowhas acardfield. All 39 rows set it.crates/placement/src/kernels.rsandplacement.rs: the operations read the row.CardFormat::of_rolestays in placement ascard_format_of_role(ty, role)becauseRolelives in the models crate.crates/gpu/src/*(commit 2):site.rs,qwen3moe/body.rs,gemm/grouped.rs,card_leg.rs,head.rs,iq.rsandquant_sel.rsread the table. Inquant_sel.rsa const assert per line ties its gate/up and down entries to the type's columns.docs/contrib/new-model.mdandtools/gate-paths.tsv: the "Kernel table" row points at theQROWScolumns, andcrates/gguf/src/card.rshas a gate path row.crates/gpu/src/site.rs(tests only): the separate Q5_0, NVFP4 and MXFP8 site pin tests are folded intoevery_family_is_the_tables_dense_row_of_one_type, with aPIN(2026-10-21)line. All 21 assertions of the old tests are kept. I broke the product behavior behind each one in turn, 21 mutants, and the merged test failed on every one.SiteTy::kgemv_orderstays an exhaustive match. Whether the kgemv launcher reads rows or tokens is a launcher fact, not a card column, and a_arm would let a new type default silently. A test ties its answer to the table's activation column.What I ran
The commands in this section ran on one machine at the earlier head
67e660d62c4d596a032069b4e8b86cfa8838c13e, basea0f1b62fbd6dcb72bf7ff603e29a801f3651c53c. The site pin merge and the GPU gate in "GPU Evidence" ran at head79bdeb50834c43b690ea83cb93b4f70ec480ff16.BLOOMERY_ARCHwas unset, so the build targeted sm_86.Behavior is unchanged where it matters for the card's kernels:
BLOOMERY_BOX_LOCAL=1 bash tools/canon-check.sh a0f1b62fbreportsTwo pin tests,
the_card_layouts_are_the_pinned_pairsandeach_layout_holds_exactly_the_pinned_types, already held on the base code before the change and still hold on the head. They show that the planner's inputs (CardFormat::of,of_routed,holds,buffer_bytes,kernels::*) answer the same for everyGgmlTypeand for an unknown tag. I did not dump a plan per fixture to compare bytes.I also planted nine mutants, one at a time, and restored the tree after each. Each one makes a test or the build fail: a wrong
routedcolumn for Q5_K, a deletedholdsline, the IQ2_XXSgemmcolumn removed, two rows sharing a dense entry, a dense entry no row names, a row without acardcolumn, a deleted IQ2_XS gate/up column (thequant_sel.rsassert), a wrongSiteTy::Q4Kentry, andGemmEntry::Iq2xxsmapped toNone(the card hardware test above catches it).Not run:
just lint(clippy),check-comments, and the other workstation gates.tools/owners_check.py checkreports 7 findings, and the base reports the same 7. On a second machine with fewer than 8 hardware threads, twoccdtests inbloomery-model --libfail on the base and on the head alike.GPU Evidence
The card is an RTX 5090.
nvidia-smion that machine, before the run, reports:The gate that covers the card table's consumers (MXFP8, FP8_B128, Q8_0 and F32 loads and site runs on synthetic tensors) ran at head
79bdeb50834c43b690ea83cb93b4f70ec480ff16:The output has 236 PASS lines and no FAIL line.
Hardware (if the change is for a machine)
NVIDIA GeForce RTX 5090, driver 595.99.02, Linux, sm_86 build (
BLOOMERY_ARCHunset). The card checks above ran there. No timing was measured.What I ran into
This does not block the PR. The IQ2_XXS
gemmrow exists to keep the old behavior. Before this PR,GemmWeight::from_ggmlaccepted IQ2_XXS, and the NemotronH prefill path calls it. Oncefrom_ggmlreads the table, a missing IQ2_XXS row would change that answer, so the row stays. The otherkernels::gemmcallers answer the same for IQ2_XXS, becauseaccepts.rsalso needs gate/up and down entries, which IQ2_XXS does not have, and the shared leg'scard_gate_up_runs(IQ2_XXS)is false. The only test change isIQ2_XXSmoving to the grouped-path list incard_leg.rsand in thegemm_admits_exactly_the_pinned_pairspin.This PR does not move the GLM tile match in
ffn.rsor the leg columns. The line count is nearly flat across the 17 changed files, because the moved docs and theCardFormatarithmetic make up most of it, so I do not claim a smaller change.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.