Repository navigation
Conversation
|
Thanks @jschmied, and thanks for splitting this out so cleanly. Reusing the affine-4 tiles for the MLX export as stored, and the float64 receipts listing every miss for both exports, are what we were hoping for. This one waits on #1508, which waits on #1492, #1503 and #1513, so we can't run it yet. When you rebase the stack onto main, note that main has since moved the shared attention helpers (texp, ldmatrix, the cp.async commit and wait) into common/qmm_frag.cuh and common/cp_async.cuh. prefill_attention.cu now conflicts with the move into prefill_attention.cuh, and the SASS receipt will need regenerating after that. One small thing in the new commits: in lfm3/cuda_weights.zig the load log Once it's on main, we'll serve both exports on a GB10: drafted against plain, concurrent against solo, prompts across the sliding window, and resumed against fresh. If you have time before then, those same checks for FP8 and MLX 4-bit (you listed them as not run) would speed things up. |
|
One commit added on top,
|
|
Thanks @ashhart, fixed in On the rebase: noted that main moved the shared attention helpers into |
|
Thanks @jschmied, the load log is right now: FP8, MLX 4-bit and NVFP4 each say what's served, and the MLX line says it's served as stored. The numpy path for This still waits on #1508, and that's on us: #1508 needs #1492 and #1503 first, and we owe their runs. When you rebase, please regenerate the SASS receipt after the move into |
|
/atc exchange 79fc1ac2936caca2ede559f5aa3603fb08bf85d2ae72e9b9534e31a700a86b66 |
|
(Optional: nothing new from the author since our last note.) Thanks @jschmied, a quick status note. Nothing is needed on this PR yet. #1492 is on main now, so the stack below this When you rebase this after #1508:
|
|
Thanks @jschmied, a status note. Nothing is needed on this PR yet: #1503 is queued to land, and #1508 follows it with the rebase you've taken on. We read this head against today's main so the rebase holds no surprises:
Then we serve both exports on a GB10: drafted against plain, concurrent against solo, prompts across the sliding window, and resumed against fresh.
|
…KV head prefill_attention.cu instantiates pattn_kernel<128, 8, 4, 8>: Nemotron's <128, 8, 8, 8> needs eight query heads a KV head, and LFM3's full-attention layers have four (16 over 4). Its launch record is measured on nvcc 13.0 and 13.2 from every SM's image (206 registers on sm_80/86/89, 231 on sm_120/121, no static shared memory). sassid on sm_80/86/89/120/121, both toolkits: 0 functions changed, 5 added.
LiquidAI/LFM3-1.7B-NVFP4 stores only the FFN as NVFP4: w1, w3 and w2 as e2m1 codes in groups of 16 with e4m3 block scales, an fp32 tensor scale and a static input scale. Every mixer projection, the embedding and the tied head are bf16, and the depthwise conv kernel is [channels, 1, taps]. - config.zig reads `quantization_config` with quant_method "modelopt" as Scheme.modelopt_nvfp4: quant_algo NVFP4, one Linear group of static FP4 g16 weights and inputs, and an ignore list that is exactly the head, the embedding and every layer's mixer. Anything else is UnsupportedLfm3Quantization. MLX configs parse as before (Scheme.mlx_affine), so a decoder that reads one scheme can refuse the other by name. - weights.zig's schema takes that layout for the bare namespace. tf-lfm3-check passes the published header (b30025bb): 502 text tensors, 1,829,689,408 bytes. The MLX-4bit header still passes (594 tensors, 973,008,384 bytes). Host tests 26/26.
…tract lfm3.cu instantiates liquid_conv<7,0> and liquid_commit<7,0>; contract_controls.cu adds their <7,1> controls. contract_lfm2_moe.zig's Conv and Commit take the tap count; contract_lfm3.zig checks the served 7-tap shapes. Records are identical on nvcc 13.0 and 13.2. contract_limits.zig now lists the lfm2_moe and lfm3 images.
Conv layers keep a 6-row state per slot; full attention runs on kv_pool pages with partial RoPE (32 of 64 pairs); sliding attention runs on a 1280-row per-slot ring through the shared window kernels at window 256. FFN w1|w3 is one FP4 lane weight (shared weight_scale_2), w2 FP4; q|k|v|gate, o, conv and the tied head are bf16. Adds --parallel lanes, drafted rows, and a copy-based prompt cache (conv states, rings, pages [0, at)).
…and LFM3 on CUDA zig/src/families/liquid/ holds what the two Liquid families shared as copies: the lane backend (cuda_lanes.zig), the kept states in the prompt cache's preallocated pages and the walk over a slot's state (cuda_snap.zig), and the native glue: open, admission, the pool and the prompt-cache hooks (cuda_native.zig). Each is generic over the family's model and forward, as liquid_conv.cuh is over the conv's taps. A model names its fixed regions (LFM2.5: the conv states; LFM3: the conv states and every sliding layer's rings) and its paged layers; each family keeps its config, weights, forward, refusals and model. lfm2_moe's backend, snap and native are now thin instances, and lfm3's no longer copy them.
…4, with a control LFM3's full-attention prompt rows (16 query heads over 4 of 128) join the head-64 paged attention's gates, held head by head to contract_attn's float64 bound over shuffled 512-key pages; tf_ctl_pattn_128 reads its values from the neighbouring 8 dims.
config.servedOn(config, backend) refuses modelopt_nvfp4 on Metal with Lfm3ModeloptNvfp4NotOnMetal; CUDA serves it, and both serve the MLX layouts. Metal's LFM3 open (ashhart#1514) calls it.
The export's static FP4 input scales are read, as the admission requires, and not applied: activations stay bf16. The load logs it and the loader's comment says so.
…gainst main, every function's hash
config.Backend gains .xpu; servedOn refuses modelopt_nvfp4 with Lfm3ModeloptNvfp4NotOnMetal or Lfm3ModeloptNvfp4NotOnXpu, and servedProblem words both for the problem line. Metal's open (native/lfm3.zig) calls it right after config.json, before any weight is read. XPU's openFamily asks the family's refuse() before the Level Zero driver opens, and the engine's init checks again before its stream. Tests through each real open: native/lfm3.zig (test-native, macOS) and draft_sources_xpu_test.zig (test-lfm3-xpu-refusal-host, any host).
contract_controls.cu is back at main's 600 lines: the 7-tap conv and commit controls (tf_ctl_liquid_conv_7, tf_ctl_liquid_commit_7) and the head-128 prompt rows' tf_ctl_pattn_128 move to contract_lfm3_controls.cuh, which contract_controls_set.cu includes beside the dense decoders' controls, as one image as before. tf_ctl_pattn_128 names main's P256, IDS and PN constants like tf_ctl_pattn_64.
…base docs/receipts/lfm-cuda-sass-fad7e142/ now compares today's main (shared CUDA headers, ashhart#1492 and ashhart#1503 on it) with the rebased head cde8257 on sm_80/86/89/120/121: prefill_attention 70 of 70 functions identical (+5, pattn_kernel<128, 8, 4, 8>), contract_controls 450 of 450 (+15, LFM3's three controls), nvcc 13.0 and 13.2. nemotron_attention is no longer reached. sass.tsv has every function's SASS sha256 on both sides.
docs/receipts/lfm-cuda-sass-fad7e142/ now compares main af9777b with the merge head 2fc30dd on sm_80/86/89/120/121, nvcc 13.0 and 13.2 (-j 1): prefill_attention 70 of 70 functions identical (+5, pattn_kernel<128, 8, 4, 8>), contract_controls 450 of 450 (+15, LFM3's three controls). Every digest equals the receipt before it; only the header names the new trees.
…ckend Carry main’s cutPoints planning, cut-point tap gating, and LFM2.5 request-start tests through the generic Liquid backend. LFM3 keeps its reviewed mark-only chunking because its sliding rings cannot tap within a chunk.
Keep one-line public comments, retain the detailed LFM3 note in gradient-serving.tsv, and keep the Metal registry at its existing 600-line cap. No execution behavior changes.
Replace the fixed eight-entry cache with the build allocator's list. The host build defines more than eight target/runtime combinations; reuse remains keyed by CUDA module and optimization mode.
The CUDA request-start device runner still named the pre-refactor Lfm declaration. Use the retained B.Liquid type exported by the new backend; its model, snapshots and test operations are unchanged.
…d and not applied
ashhart#1508's 7-tap conv commit adds controls to zig/kernels/cuda/contract_controls.cu and re-pins it; a later commit moves them into contract_lfm3_controls.cuh, which leaves the file byte for byte main's, but its gradient-serving row kept the interim hash. The row now has main's hash again; its note is main's.
LiquidAI/LFM3-1.7B-FP8 (compressed-tensors, FP8_BLOCK): e4m3 weights with a bf16 scale per 128 x 128 block on the FFN and q/k/v/o, dynamic FP8 inputs in groups of 128; the convs, the attention gate, the embedding and the head stay bf16. The recipe, the ignore list and the 402 tensors are checked as published. Metal refuses it by name (Lfm3Fp8BlockNotOnMetal).
…as stored - FP8: the FFN and q/k/v/o on the block-FP8 lane, activations bf16 (the export's dynamic input quantization is not applied). The bf16 attention gate is a projection of its own, written into the merge's sums buffer after the attention. - MLX 4-bit g64: every projection and the tied head as affine-4 tiles, prompt chunks on the affine prompt GEMM, decode rows on the verify tiles over their 64-value sums; the embedding rows read the same codes. Wrapped names (language_model.model.*) come from the admission. 6- and 8-bit MLX and VL are refused by name.
The receipts are main's tools/lfm3/REF64.md (ref64.py dequantizes block FP8 exactly, from ashhart#1696). FP8 agrees on 824 of 829 prompt rows and 128 of 128 reply rows, MLX 4-bit on 825 and 128; every miss is listed with its float64 margin (0.004 to 0.085). Concurrent == solo at 4 and 8 streams.
…, the NVFP4 line prints for NVFP4 only
…gh the open servedOn's .xpu case (from ashhart#1508) now names fp8_block too: Lfm3Fp8BlockNotOnXpu, beside Lfm3ModeloptNvfp4NotOnXpu. The XPU open asks before the Level Zero driver, as it does for NVFP4, and the engine's init asks again before its stream. The test writes only the export's config.json and opens it through xpu.zig; with the check removed it fails at the driver instead (LoaderUnavailable).
…1634 ashhart#1634 changes nothing under zig/kernels, so main against its code head 042028b reaches ashhart#1508's functions only: prefill_attention 70 of 70 identical (+5), contract_controls 450 of 450 (+15), nvcc 13.0 and 13.2, sm_80/86/89/120/121.
…d and not applied
f3d0fd7 to
31c576c
Compare
Current head
f3d0fd7051: ashhart's rebase onto main22d77f7839(6d91aa5cb) plus one docs commit. That commit says the contract indocs/recipes/lfm3-cuda.md: weight-only, with the stored FP8 and NVFP4 weights served as loaded with bf16 inputs. The release's input scales are read and not applied, the dynamic FP8 input step is not applied, and activations stay bf16. The served receipts (FP8, MLX 4-bit, LFM2.5 against main) and the 8-stream cache timing ran on6d91aa5cb, whose code this head keeps unchanged; they are in #1634 (comment).6d91aa5cbagainst2b748e000it is +0.10 % (noise floor 0.56 %), WITHIN NOISE. The "Don't land yet" rows below are history.--prompt-cache-gib 0(5 of 5 rounds), and decode is about 5 % faster.The sections below describe earlier heads.
Stacked on #1508 (head
0fa0fa122); every commit after it is this PR's own. The head is82cb493d8. Rebased onto#1508 after its rebase onto main
e7e24243d: ourref64.pycommit4ab6a44e6dropped out (main has the same filebyte for byte, from #1696), and so did the tools part of the docs commit.
What
LFM3-1.7B's other two text exports on CUDA, beside #1508's NVFP4:
503883283):LiquidAI/LFM3-1.7B-FP8(revision243955da, compressed-tensors FP8_BLOCK). Therecipe, the ignore list and all 402 tensors are checked as published.
503883283,042028b62):servedOnrefusesfp8_blockwithLfm3Fp8BlockNotOnMetalorLfm3Fp8BlockNotOnXpu, beside lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508's two NVFP4 refusals, andservedProblemwordsall four. Metal's and XPU's opens already ask
servedOn(lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508), before any weight is read and, on XPU, beforethe Level Zero driver. No new path: the FP8 case is one more arm of the same switch.
7c0fa775e,8faf23426):input quantization is not applied. The bf16 attention gate is a projection of its own.
LiquidAI/LFM3-1.7B-MLX-4bit(revisiond0ca73dc) as stored: every projection and the tied head asaffine-4 tiles, prompt chunks on the affine prompt GEMM, decode rows on the verify tiles.
d986410d1): the recipe's table of the three exports. The float64 receipts are main'stools/lfm3/REF64.md.82cb493d8):docs/receipts/lfm-cuda-sass-fad7e142/regenerated against maine7e24243d.No kernel changes, and no file outside
families/lfm3, the XPU refusal test and the docs. Liquid's shared backendand LFM2.5 are #1508's, unchanged.
Verification (GB10, sm_121, real weights, on this head)
test-lfm3-xpu-refusal-hostopens a folder holding only the FP8 export'sconfig.jsonthroughnative/xpu.zig'sopenand expectsLfm3Fp8BlockNotOnXpu. With the FP8 arm removed (.xpu => {}) it goes redwith "cannot open the Level Zero driver (LoaderUnavailable)", so nothing past the config is read or queued before
the refusal. The config test names all four refusals. The Metal open is lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508's, unchanged; its FP8 refusal is
covered at the config level, not re-run on a Mac.
3551fd822(neither main nor lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508 serves them onCUDA), 8 chats x 4 turns, full replies (reasoning and content):
(
TENSORFOLD_LFM3_KV_PAGES=0);window) == solo; drafted == plain; a restart gives the same hashes;
0fa0fa122, and LFM2.5 against maine7e24243d: the same checks, everyreply equal.
docs/receipts/lfm-cuda-sass-fad7e142/, maine7e24243dagainst this code head042028b62,nvcc 13.0 and 13.2, sm_80/86/89/120/121:
prefill_attention70 of 70 identical (+5, lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508'spattn_kernel<128, 8, 4, 8>),contract_controls450 of 450 (+15, lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508's three controls). A first nvcc 13.0 runsaw main's own
tf_ctl_moe_router_tiles_rowflap on sm_80, as lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508's runs did; the rerun and 13.2 show itidentical. The README says so.
above is this PR's planted check.
82cb493d8):zig build -Dfixed-cpu test-host(19578 passed, 132 skipped),test-gradient-serving test-qwen-serving-host,test test-golden test-kernel-contract test-server-security test-pull-security fuzz-cortheon check-release-paths,check-native-cuda-host compile-cuda-tests,zig fmt --check,git diff --checkandpr_check.pyall pass (run under umask 022: under the runner's umask 002,cli_config_testfails on main too). On the GB10:test-cuda-host,compile-cuda-tests, the Liquid, LFM3,LFM2.5 and XPU refusal host tests. No pinned file changes (
gradient-serving.tsv,dense_serving_test.zig).Speed (GB10)
A-B-B-A, 4 servers an arm, the same 6 cold chats (10.4k tokens) on every server, paired medians.
3551fd822)3551fd822)0fa0fa122)e7e24243d)Two rows are paired losses, said plainly. Don't land yet until both are explained:
head's (589-592). NVFP4 against lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508 is level, so this most likely comes from the base this PR now sits on
(lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508's shared backend), not from the FP8 code, but it isn't isolated: lfm3: serve LFM3-1.7B on CUDA: NVFP4 and FP8 weight-only, MLX 4-bit (stacked on #1513, #1492 and #1503) #1508 can't serve FP8. Don't land yet
on this row's account if a served cell may not be slower.
code is byte-identical to this one's (this PR touches no Liquid or LFM2 file). Per-server medians overlap (head
1.323-1.354 s, main 1.318-1.353 s) and the arm medians are level (1.3305 against 1.3338 s), so we read it as noise
of this cell, but it showed in every run.
Proposed CHANGELOG line
- LFM3-1.7B FP8 (block, weight-only) and MLX 4-bit (as stored) served on CUDA; Metal and XPU refuse the FP8 export by name (#1634, after #1508)Licence
The weights are under Liquid AI's LFM Open License v1.0 (
license: other,lfm1.0), as the NVFP4 and MLX exportsare.