cuda: reject fmt=4 at the per-row-only entry points (#334 follow-up to #298)#464
Conversation
main shipped v1.0.0 with prebuilt Windows binaries but no docs on main explaining what the .exe is or how to run it (JustVugg#450) — the quickstart lived only on dev. Bring docs/quickstart.md to main and add a Windows-prebuilt pointer to the README's Get started section, so users on the default branch find the steps. Docs-only. Refs JustVugg#450 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
docs: Quick Start guide + Windows prebuilt steps on main (JustVugg#450)
…tVugg#424) The site.yml workflow deploys on push to main, so the site only goes live once site/ is on main. Bring site/index.html + icons + the workflow so a GitHub Pages deploy (Settings -> Pages -> Source: GitHub Actions) publishes it at justvugg.github.io/colibri. Refs JustVugg#424 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
site: official website + Pages deploy on main (JustVugg#424)
Site (justvugg.github.io/colibri) is live but linked nowhere. Add website + latest-release badges and a Website header link. README-only, no code change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…low-up to JustVugg#298) JustVugg#298 fixed the dense-resident path's callers after they fed grouped-scale tensors to kernels that read scales per row (CUDA_DENSE=1 produced garbage). The entry points themselves still accept them: coli_cuda_matmul uploads via coli_cuda_tensor_upload (no gs), so scale_count collapses to O and the [O, ceil(I/gs)] buffer is silently truncated, then quant_matmul reads scales[o] per row. coli_cuda_expert_mlp same kernels, same assumption. Return 0 for fmt=4 at both, so a grouped tensor takes the expert-group path (JustVugg#451, which carries per-group scales) or stays on the CPU — a fallback, never a wrong answer. The caller-side guard in colibri.c already excludes fmt=5 the same way; this makes the ABI safe regardless of who calls it next. make check 105/105, zero warnings.
|
Good instinct, but the conflict is telling you something: #298's merged form changed the entry-point semantics your patch was written against, and as-is this would break the path #298 fixed. Current
What survives of your point — and is worth landing: a fmt=4 tensor arriving without a group size is still the unguarded door. if (fmt == 4 && gs <= 0) return 0; /* grouped scales need an explicit gs — see #298 */(plus, if you want belt-and-braces, the same check against a cached tensor: |
Footer said 'MIT license'; repo is Apache 2.0 (see LICENSE). Fix + link. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts: # README.md # site/index.html
# Conflicts: # c/backend_cuda.cu
|
Rebased onto dev. Since dev's quant_matmul now handles grouped fmt=4 natively (gs/ng recorded at upload via upload_g), the blanket fmt==4 rejection is narrowed to fmt==4 with no group size — that case still truncates the scale buffer and divides by gs==0 in the kernel; the gs>0 path goes through normally. |
|
Corroborating the gs>0 half on Blackwell: dev |
Spotted while reading #298's merge notes on #108/#326.
The residue
#298 fixed the callers of the dense-resident path after they fed grouped-scale tensors to kernels that read scales per row (
CUDA_DENSE=1produced garbage). The entry points still accept them:coli_cuda_matmuluploads viacoli_cuda_tensor_upload(the non-_gvariant, no group size), soscale_countcollapses toO, the[O, ceil(I/gs)]scale buffer is silently truncated, andquant_matmulthen readsscales[o]per row.coli_cuda_expert_mlpshares those kernels and the same assumption.Today nothing reaches them with fmt=4 (the
colibri.ccall site excludes fmt=5 already, and #451 routes grouped experts through the group path), so this is not a live bug — it is an unguarded door of exactly the kind #334's prevention note warns about, one call site away from reproducing #298.The fix
Return 0 for fmt=4 at both entries. A grouped tensor then takes the expert-group path (#451, which carries per-group scales) or stays on the CPU — a fallback, never a wrong answer. Three lines, no behaviour change for anything that works today.
make check105/105, zero warnings.(Related: the g64/E8 line — #452, #453 merged, #458 open — will put many more fmt=4/fmt=5 tensors in front of these entries, which is why closing the door now seemed worth a small PR.)