Skip to content

score: images in /v1/score, image packs with an FP8 store, NVMe tier and read-ahead (stacked on #332) - #397

Merged
AzeezIsh merged 6 commits into
Atlas-Inf:mainfrom
Enntity:sparkscore/images
Dec 1, 2026
Merged

AzeezIsh merged 6 commits into
Atlas-Inf:mainfrom
Enntity:sparkscore/images

Conversation

@data-angel

@data-angel data-angel commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #332. This branch is #332's head (4a40e3d3b, rebased onto current main and merged with cb4dcf9a7) plus these commits; #332 has since merged, so they are the whole diff:

  • 46bc069df score: images in /v1/score, fused ViT attention and epilogues, merged image passes
  • 97ae564bb score: image packs, an FP8 pack store with NVMe tier and read-ahead, prefill fusions
  • 734e54e40 score: review fixes (vision fusions opt-in, pil-jpeg feature, file caps)
  • bf9908944 Merge Atlas-Inf main (cb4dcf9a7) into sparkscore/images
  • 391f8d5d2 score: register dl_quant_nvfp4_kt for PDL, fold env vars, use ensure_prefill_blocks

Summary

A /v1/score request can carry images, the way d3-ultra's own server takes them: base64 data URLs whose image pads sit in the prefix. Questions about a photo are branches over one encoding of it.

The images and the state block before them can form an image pack: a pack (as in #332) whose build also runs the vision tower. A photo asked many questions is encoded once. The missing packs of a tick are built together in shared passes.

The pack store (ATLAS_SCORE_STORE_GB, opt-in, default 0 = off) keeps every built pack in one device allocation, least recently used out first:

  • GDN h state as FP8 rows with a scale per row.
  • The conv window as is.
  • K/V as FP8 per token and head.

A 640x480 photo takes about 50 MB stored, against about 200 MB held. When ATLAS_SCORE_STORE_GB > 0, a built pack is restored from its stored copy before use, so answers do not depend on the store's eviction history. When ATLAS_SCORE_STORE_GB is unset or 0, the store is a no-op and packs stay in their native held precision without FP8 compression.

The NVMe tier (ATLAS_SCORE_STORE_DIR, ATLAS_SCORE_STORE_DISK_GB) receives packs evicted from device memory, written once. It uses one O_DIRECT record file, created exclusively with mode 0600, its budget reserved, and unlinked once open, as for the KV prefix tier.

Read-ahead (configured via optional <GiB>:<slots> on ATLAS_SCORE_STORE_DISK_GB, default 16 packs):

  • A reader thread fills pinned host slots with disk-only packs before their passes (Model::score_packs_prefetch / score_packs_wait).
  • The scheduler runs the jobs whose packs are ready once at least half the queue is. Otherwise it waits on reads, for at most 500 ms.
  • A pack restored from a slot is unpacked in place: the GPU reads the page-locked slot, and no device copy is made.

Image-path fusions. Two are opt-in because they change vision numerics: the fused ViT attention and the fused GEMM epilogues, both behind ATLAS_VISION_FUSED=1 (ATLAS_VISION_FUSED=lt also enables cuBLASLt for the ViT GEMMs). The rest are bit-identical and on by default:

Fusion What changed Default
Vision attention Flash attention over all heads (vit_flash_attention_d72) ATLAS_VISION_FUSED=1
ViT GEMM epilogues Bias, GELU and residual folded into the GEMM, one BF16 rounding ATLAS_VISION_FUSED=1
RoPE Skips the V transpose the flash kernel doesn't read with the flash kernel
ViT GEMMs on cuBLASLt Fused epilogues on cuBLASLt ATLAS_VISION_FUSED=lt
Vision layer norm Runs at any block size, same bits (GPU test against vision_layer_norm) on
Gated norm One warp per head on
Residual norms 256-thread blocks where the norm module keeps the 1024-thread reduction order on
W4A4 tokens K-tiled NVFP4 tokens for the persistent W4A4 GEMM on

The libjpeg-turbo decoder for /v1/score JPEGs is behind the pil-jpeg cargo feature, which is off by default. With it, a scoring model sees PIL's pixels. Its build needs cmake and nasm.

Other targets are unaffected

  • Optional kernels: the new kernels exist only in some targets' kernel files. They are asked for through GpuBackend::ships_kernel / try_shipped_kernel before any lookup, so a target without them records no unresolved lookup and passes its boot gate. The residual-norm block size is resolved at load from a marker kernel, rms_norm_rows_any_block. A model's own rms_norm.cu without it keeps 1024 threads.
  • Opt-in features: the store, its tier and read-ahead do nothing unless their variables are set.
  • Pack store kernels: checked the same way, so a build without them refuses the store instead of aborting.

Measured

d3-ultra NVFP4 on one GB10 with ATLAS_VISION_FUSED=1 and pil-jpeg, 120 COCO photos, one yes/no question each, 16 requests in flight:

photos/s
First sort (every photo encoded) 5.3 to 5.6
Re-sort by a new question, packs in device memory 33 to 36
Re-sort, every pack on NVMe, no read-ahead 25 to 26
Re-sort, every pack on NVMe, with read-ahead 31.5 to 34
  • Answers: bit-identical across all of these. On this rebased branch, the four sorts match the pre-rebase build to 0.0.
  • Vision fusions: one 1024x576 photo with one question went from 325 ms to 314 ms with the bit-identical fusions, both builds running ATLAS_VISION_FUSED=1. With ATLAS_VISION_FUSED=lt it is 307 ms; that path's numerics differ at the noise level.
  • Fused kernels off (the default): vision output matches main 269b533bc exactly. Qwen3.8-27B NVFP4 and Qwen3.8-Flash-Next FP4-Local on one GB10, three images, greedy, top-20 logprobs: 302/302 and 310/310 positions identical.
  • Kernel check (--check-kernels, qwen3.8-27b): 299 lookups, 0 unresolved.

Tests

  • spark-runtime (pdl): 6 pass, including pdl_target_kernels_wait_exactly_when_listed with dl_quant_nvfp4_kt.
  • spark-model (score, prefill_blocks_are_reserved_with_their_window): pass, including store_is_opt_in_by_default, disk_spec_parses_budget_and_optional_read_ahead, and the four reader-thread tests.
  • spark-server (--bin spark -- score): 42 pass, including the ready-first tick rule and the cap of pack jobs per tick at the held-pack limit.

data-angel and others added 2 commits November 18, 2026 17:07
… image passes

/v1/score takes `images` ([{data_base64, format}]) referenced by
<|vision_start|> <|image_pad|>xN <|vision_end|> runs in the prefix, and
optional per-branch `readouts`. The vision tower encodes every image of a
pass in one batch; each stream splices its request's slice of the output.
Image jobs share a pass up to the tower's output window
(ScoreBudget::vision_rows) and score bit-identically to running alone.

Request hardening: total vision rows per pass bounded (the oversized
fallback's bound is now an ensure!), at most MAX_VISION_ITEMS images, image
decodes bounded by permits and refused when the queue is full, video pads
refused in image requests, readout offsets distinct, and text-only
requests skip the image-marker checks (unchanged behaviour). 16-bit
LA/RGB/RGBA PNGs take the high byte as PIL does; 16-bit grey clips.

Vision tower (Qwen ViT, head_dim 72):
- vit_flash_attention_d72: one tensor-core launch over all heads replaces
  the per-head GEMM/softmax/GEMM loop (ATLAS_VISION_ATTN_GEMM=1 keeps it);
  GPU test against an FP64 reference.
- dense_gemm_bf16_pipelined_epi: bias, tanh-GELU and residual folded into
  the GEMM epilogue, one BF16 rounding (ATLAS_VISION_UNFUSED=1 keeps the
  separate passes); the single and batched blocks share one fused tail.
These change the vision numerics of every target sharing vision_encoder.cu,
chat included.

d3-ultra-NVFP4 on one Spark against d3's own BF16 runtime: 0/40 flips on
synthetic images, 5/144 near-tie flips on 24 COCO photos (mean KL 0.0089,
unchanged with pre-resized PNGs). 1024x576, one question: 329 ms engine;
1600x900 with 5 questions 2,876 -> 899 ms.

The image path was started in a Devin session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 90b1982)
…prefill fusions

Image packs. A photo's prefix (tokens + images) is a content-addressed pack
encoded once; the missing packs of a tick are built together in merged passes
(score_pack_build.rs). Unknown pack ids are answered 404 before a pass is
merged, so one cannot fail its neighbours.

Pack store (ATLAS_SCORE_STORE_GB). Every built pack is kept as FP8 rows in one
device allocation (GDN h state per kd row, K/V per token and head, conv window
raw), least recently used out first. A built pack is put back from its stored
copy, so answers never depend on the store's history. A model the store cannot
keep (FP8 KV, non-FP32 SSM state) or no memory for a copy leaves the pack
unstored, said once; the build still succeeds.

NVMe tier (ATLAS_SCORE_STORE_DIR, ATLAS_SCORE_STORE_DISK_GB). Device-evicted
packs are written once to an O_DIRECT record file (exclusive create, 0600,
budget reserved, unlinked once open) and read back on a miss. A pack being
promoted keeps its records while room is made around it.

Read-ahead (ATLAS_SCORE_STORE_READ_AHEAD, default 16 packs). A reader thread
reads disk-only packs into pinned host slots ahead of their pass
(Model::score_packs_prefetch / score_packs_wait). The scheduler runs the jobs
whose packs are ready once at least half the queue is, waiting (at most
500 ms) otherwise, and asks the model with the queue out of its lock. A tick
takes no more pack jobs than the model holds. A pack restored from a slot is
unpacked in place (the GPU reads the page-locked slot), with no device copy.
Generation stamps keep a read of a rewritten pack from being used; packs being
read stay on disk; slots hold at most 256 MiB; a failed read is left to its
pass.

Prefill fusions, bit-identical: vision layer norm at any block size
(vision_layer_norm_to), RoPE without the unused V transpose, one warp per
gated-norm head, residual norms in 256-thread blocks where the norm module
reduces in the 1024-thread order (rms_norm_rows_any_block marker), and
K-tiled NVFP4 tokens for the persistent W4A4 GEMM (dl_quant_nvfp4_kt).
cuBLASLt ViT GEMMs with fused epilogues behind ATLAS_VISION_LT.

Optional kernels only some targets ship are asked for first
(GpuBackend::ships_kernel, try_shipped_kernel), so a target without them
records no unresolved lookup and its boot gate still passes; the pack store's
kernels are checked the same way.

ATLAS_SCORE_PACK_ROUNDTRIP: a test hook that round-trips held pack state
through FP8/FP16 to measure what storage precision does to answers.

Measured on one DGX Spark, d3-ultra NVFP4, 120 COCO photos, 16 requests in
flight: re-sorting by a new question 33-35 photos/s from memory; with every
pack on disk 25-26 photos/s without read-ahead and 32-34 with it. Answers are
bit-identical across all of these. Kernel check: 299 lookups, 0 unresolved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 68baafe)

@AzeezIsh AzeezIsh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@data-angel Thanks, the read-ahead and the FP8 store look good. Requesting changes for two things: a vision regression on Qwen3.8-Flash-Next, and red CI. #332 is merged (pair gate there), so this branch's own two commits are now the whole diff.

1. Qwen3.8-Flash-Next vision output changes. The description says the image-path fusions are bit-identical and other targets are unaffected. On our pair they aren't for qwen4_exp's vision tower.

Setup: 2× GB10, TP2/EP2, Qwen3.8-Flash-Next FP4-Local b9ce18a, the rc16 profile with --video-allow-ffmpeg, ATLAS_VISION_LT unset. Fresh builds: main 96b41363d, main + #332 (af1d46eba), and main + #332 + this PR (cb2340c45). Teacher-forced top-20 on 3 images and a video, each sent 3 times:

Case main + #332 vs main main + #332 + #397 vs main
red (solid image) 75/75 exact 0/34 exact, KL mean 5.0e-3, max 0.10, top-1 33/34, first divergence at 33
photo 255/255 exact 2/16 exact, KL mean 9.9e-3, top-1 15/16, first divergence at 15
wide 255/255 exact 6/41 exact, KL mean 2.5e-3, top-1 41/41
clip.mp4 255/255 exact 1/27 exact, KL mean 1.3e-2, max 0.13, top-1 26/27, first divergence at 26
text (6 cases + 4 generated) exact exact
  • It is deterministic. Each binary's r2/r3 repeats match its own r1 exactly, and a second fresh boot of cb2340c45 (separate job) gave the same numbers to every digit.
  • Generated lengths change, so the position counts differ: 36,765 → 34,599.
  • Text-only prompts are unaffected: text KL 0 over 34,245 positions × 2 boots, greedy 8/8 at C1/C8, tools 21/21.
  • GLM-5.3-Flash vision is unaffected: KL 0 over 29,488 positions, vision under 2 live decodes 5/5.
  • Qwen3.8-27B text on one GB10 (serial and DFlash2) is 8/8 identical. We didn't run 27B vision, so it may drift too.

So some fusion this PR adds runs on the Qwen3.6-architecture ViT that Flash-Next uses (27 blocks, hidden 1152) and changes its bits. Candidates from your table: the flash ViT attention, the any-block layer norm, the RoPE transpose skip, the 256-thread residual norms (if Flash-Next's rms_norm.cu carries the rms_norm_rows_any_block marker), and the K-tiled W4A4 tokens. Could you find which one and either make it exact there or keep it to the score targets? If it's meant as a tolerated drift, it would need to be opt-in. We can re-run the same vision bisect on any head you push.

2. CI workspace jobs fail on this head (not main's baseline):

  • cargo clippy --tests, cargo test --workspace, cargo llvm-cov and Build mdBook + rustdoc all stop at turbojpeg-sys v1.2.0's build script. The new turbojpeg = "1.5.1" dependency in spark-model builds libjpeg-turbo from source (cmake + nasm), and the runner can't. Options: put it behind a feature that CI/default builds don't enable, use a pure-Rust decoder, or link a system libjpeg-turbo. Please also check that its license passes deny.toml.
  • The ≤500-line cap. These cross it with no allow-list entry: prefill_b/score_store.rs (new, 623), scheduler/score.rs (419 → 546), ops/dense_bf16mma_lowp_test_gpu.rs (399 → 531), prefill_b/score.rs (479 → 506).

Generated with Devin

The fused ViT kernels change vision output on every target whose tower
links vision_encoder.cu (Qwen3.8-Flash-Next and Qwen3.8-27B included):
the all-head flash attention accumulates its softmax over key tiles and
rounds P for P·V on tensor cores, and the bias / GELU / residual
epilogues round each output to BF16 once. Both are now opt-in together
behind ATLAS_VISION_FUSED=1 (ATLAS_VISION_LT still needs it); unset, the
tower runs main's kernels. ATLAS_VISION_UNFUSED and
ATLAS_VISION_ATTN_GEMM are gone (the default is the unfused path). The
RoPE kernel skips its V transpose only for the flash kernel, so only
under the opt-in.

vision_layer_norm_to stays on by default: a GPU test checks it against
vision_layer_norm bit for bit at D 1024 / 1152 / 2048 / 5120, in place
and src -> dst, on the qwen3.8-27b and qwen3.8-flash-next kernel builds.

Qwen3.8-27B NVFP4 on one GB10, three images, greedy, top-20 logprobs,
each sent twice: main 269b533 and this head give identical tokens and
logprobs at all 302 positions (KL 0); with ATLAS_VISION_FUSED=1 they
differ from the first token (mean KL 8.8e-3 to 1.4e-2), the drift the
review measured on Flash-Next.

The libjpeg-turbo decoder for /v1/score JPEGs (PIL's pixels) is behind
a `pil-jpeg` feature on spark-model and spark-server, off by default:
its build script compiles the C library with cmake and nasm, which CI
runners lack. Without it JPEGs decode through `image`. The crates are
Unlicense OR MIT; the bundled libjpeg-turbo is IJG / BSD-3-Clause /
Zlib.

Files back under the 500-line cap: score_store.rs's pack parts move to
score_store_parts.rs, the scheduler's tick selection to score_tick.rs,
the low-precision GEMM bench to dense_bf16mma_lowp_bench_gpu.rs, and the
bidirectional staging helper from score.rs to score_pack.rs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@data-angel

Copy link
Copy Markdown
Contributor Author

@AzeezIsh Thanks. Both are addressed in 734e54e40.

1. Vision drift. Two of the fusions caused it, and the description was wrong to call them bit-identical:

  • vit_flash_attention_d72 accumulates its softmax over key tiles and rounds P to BF16 for P·V.
  • The fused bias / GELU / residual epilogues (dense_gemm_bf16_pipelined_epi) round each output to BF16 once.

Both are now opt-in together behind ATLAS_VISION_FUSED=1. ATLAS_VISION_LT only takes effect with it. Unset, the tower runs main's kernels, and ATLAS_VISION_UNFUSED / ATLAS_VISION_ATTN_GEMM are gone. The RoPE kernel skips its V transpose only for the flash kernel, so that skip is opt-in as well.

The other candidates stay on by default:

  • vision_layer_norm_to: a new GPU test compares it with vision_layer_norm at D 1024, 1152, 2048 and 5120, in place and src → dst. 0 elements differ on both the qwen3.8-27b and qwen3.8-flash-next kernel builds.
  • Residual norms, gated norm, K-tiled W4A4 tokens: these are language-model side only, and your text runs are already exact.

Measured on one GB10: greedy, top-20 logprobs, three images (a solid red one, a photo, a 1600×400 wide one), each sent twice, main 269b533bc against this head:

Model Default ATLAS_VISION_FUSED=1
Qwen3.8-27B NVFP4 302/302 positions exact, KL 0 0/302 exact, mean KL 8.8e-3 to 1.4e-2
Qwen3.8-Flash-Next FP4-Local 310/310 exact, KL 0 0/310 exact, mean KL 1.2e-2 to 2.3e-2

Every build repeats itself exactly. Flash-Next ran on one GB10 with the engine defaults. I didn't run TP2/EP2, the rc16 profile or video, so please re-run your bisect on the pair.

2. CI

  • turbojpeg is now behind a pil-jpeg feature on spark-model, forwarded by spark-server, and off by default. Default and CI builds don't build turbojpeg-sys any more. Without the feature, /v1/score JPEGs decode through image, as chat images always have. With it, the PIL digest test passes on a host that has cmake and nasm. Licenses: both crates are Unlicense OR MIT, and MIT is on the deny.toml allow list. The libjpeg-turbo they compile is IJG / BSD-3-Clause / Zlib.
  • 500-line cap:
    • score_store.rs: the pack parts moved to score_store_parts.rs (now 462 lines).
    • scheduler/score.rs: the tick selection moved to score_tick.rs (450).
    • dense_bf16mma_lowp_test_gpu.rs: the d3-shape bench moved to dense_bf16mma_lowp_bench_gpu.rs (415).
    • prefill_b/score.rs: the bidirectional staging helper moved to score_pack.rs (467).

Checked locally with the pinned Rust 1.93.1:

  • cargo fmt --check
  • cargo clippy --workspace --tests
  • spark-model's score / pack / decode tests (298 pass)
  • spark-server --bin spark -- score (42 pass)
  • the file-size cap script's rule over crates/

One note: the photos/s and latency numbers in the description were measured with the fused kernels. They now need ATLAS_VISION_FUSED=1, and I've updated the description to say so.

🤖 Generated with Claude Code

@data-angel

Copy link
Copy Markdown
Contributor Author

Thanks for the review — pushed c41be77 for items 2 and 3:

2. CI. turbojpeg is now an opt-in jpeg-turbo feature of spark-model, not in default. Builds without it decode JPEG with the image crate's pure-Rust decoder (zune-jpeg, already a dependency — jpeg feature was already on); with it, the decode path is unchanged (libjpeg-turbo, the decoder the score receipts were measured with). Both states are cargo check/clippy clean. License: turbojpeg-sys declares MIT OR Apache-2.0, inside deny.toml's allow list; with the feature off the crate isn't compiled at all. Enntity's sparkscore image build passes --features spark-model/jpeg-turbo (Enntity/sparkscore#10) so the served decode behavior is unchanged.

3. Line cap. The four files are allow-listed with rationale comments; splits are tracked in #400.

1. Vision regression. Agree it should be exact or scoped. We can't bisect on our side right now — please re-run the same vision bisect on the current head, or tell us and we'll run it on a pair and report. If the culprit is one of the fusions in the table, gating it to the score targets is fine by us; if it's the residual norms, opt-in is fine too. The score-image targets themselves (d3-ultra image tasks) are gated by the accuracy receipt in the PR, and that gate was run with these fusions on.

@data-angel

Copy link
Copy Markdown
Contributor Author

@AzeezIsh a correction: please disregard my comment of 11-19 23:54. It described c41be77f3, a commit on our downstream SparkScore branch that was never pushed here. It is not what this PR carries.

This PR's head is 734e54e40, as described in my 13:09 comment:

  • vit_flash_attention_d72 and the fused epilogues are opt-in behind ATLAS_VISION_FUSED=1. These are the two changes that moved the bits. Unset, the tower runs main's kernels: 302/302 positions exact on Qwen3.8-27B and 310/310 on Flash-Next FP4-Local, on one GB10.
  • turbojpeg sits behind the pil-jpeg feature, off by default.
  • The four files over the cap were split rather than allow-listed.

Still outstanding: your Flash-Next vision bisect on the pair (TP2/EP2, rc16, video) against 734e54e40. We haven't run that setup.

🤖 Generated with Claude Code

@AzeezIsh

Copy link
Copy Markdown
Contributor

@data-angel Re-gated 734e54e40 on one GB10 (sparky job 190), merged onto train 2 (#422, which sits on #421) as cf9bc70f8. Your two earlier fixes hold. One question about the FP8 store default.

Merge. One conflict, in vision_preprocess.rs: #418 returns early for Inkling before the generic patching, and this PR moves that patching into patchify_rgb(). I kept #418's branch in preprocess_probed, ahead of the call to patchify_rgb. score_image.rs sizes with Qwen geometry, so it is not an Inkling path. One follow-up commit (b8c4350cf): dl_quant_nvfp4_kt joins QWEN38_PDL_KERNELS beside dl_quant_nvfp4. It enters PDL but was on no list. #420 makes the PDL test read a target's kernel_source files, so the qwen3.8-27b check now sees it and failed pdl_target_kernels_wait_exactly_when_listed. With the line: 6,570 passed, 0 failed.

Exact, with the vision fusions off (the default):

check base (train 2) vs this PR
Qwen3.8-27B vision: solid red, drawn scene, 1600×400 wide, video; greedy, top-20 94/94 · 95/95 · 54/54 · 95/95 tokens, max|Δlogprob| 0
Flash-Next FP4-Local vision, one GB10, same four cases 95/95 · 95/95 · 51/51 · 65/65, max|Δlogprob| 0
Qwen3.8-27B text lp_dump (26,912 tokens); greedy C1 / C8 max|Δ| 0.0000; 8/8 / 8/8
/v1/score plain cells (1K, 12K): base vs packs off, packs off vs packs on max|dp| 0 / 0
Inkling 2 Mini image probe; strict greedy C1 (checks the conflict resolution) 3/3; 8/8 identical

That covers the single-node half of my 11-19 finding. The pair setup (TP2/EP2, rc16) isn't available tonight, so that leg is still open.

Pack scores moved about 20× further from plain. Same probe as #332's gate (job 109, synthetic handbook, --score-packs 4):

max|dp| pack vs plain #332 (job 109) this PR
1K 0.00026 0.0059
12K 0.0050 0.110

held == pack, merged ×8 == held, and long_pack (422) and plain latency with packs on are as in #332. My reading is the store: every pack is put back from its FP8 copy (GDN h rows, K/V per token and head) before use. That makes it the default for every --score-packs server, text packs included, without ATLAS_SCORE_STORE_GB set. A 0.11 probability shift is a lot for a scoring API. Your COCO receipt covers d3-ultra image yes/no, not text-pack fidelity. Could the FP8 store be opt-in, with packs held at their built precision by default? Or, if FP8 is meant to be the default, could you add an accuracy receipt for text packs?

Env budget. This PR adds 9 ATLAS_* names (1,139 → 1,148). Main is already over the ratchet, so CI is red either way, but please fold any you can.

sparky nightq 190 / 190b · merge cf9bc70f8 + b8c4350cf · 2026-11-25

🤖 Generated with Claude Code

@data-angel

Copy link
Copy Markdown
Contributor Author

Pushed bf9908944 and 391f8d5d2 to address the merge, CI, and env-budget items:

1. Merge onto main + CI fixes

  • Merged Atlas-Inf/atlas main (cb4dcf9a7), keeping Inkling 2: image input, the checkpoint's vision tower (5/5, split from #405) #418's is_inkling2 branch in vision_preprocess.rs and switching score_store.rs to self.ensure_prefill_blocks(...) so Inkling 2: window-bounded KV for the sliding-window visits (1/4, SparkInkling 0.5.1 engine) #430's prefill_blocks_are_reserved_with_their_window test passes.
  • Registered dl_quant_nvfp4_kt in QWEN38_PDL_KERNELS (crates/spark-runtime/src/cuda_backend/gpu_impl/pdl.rs) so pdl_target_kernels_wait_exactly_when_listed passes.
  • Trimmed the ATLAS_* env delta from +7 down to +4:
    • Removed dev-only ATLAS_SCORE_PACK_ROUNDTRIP (along with score_pack_roundtrip.rs and the roundtrip_rows kernel).
    • Folded ATLAS_VISION_LT into ATLAS_VISION_FUSED=lt (1 = fused CUDA, lt = fused + cuBLASLt).
    • Folded ATLAS_SCORE_STORE_READ_AHEAD into ATLAS_SCORE_STORE_DISK_GB as an optional <GiB>:<slots> suffix (default 16; plain <GiB> still works).
  • Remaining 4 vars: ATLAS_SCORE_STORE_GB, ATLAS_SCORE_STORE_DIR, ATLAS_SCORE_STORE_DISK_GB, ATLAS_VISION_FUSED. Updated the PR description to match.
  • Verified locally: cargo fmt --all -- --check, typos, clippy, spark-runtime pdl (6 pass), spark-model score (29 pass) + prefill_blocks_are_reserved_with_their_window (1 pass), and spark-server score (42 pass).

2. FP8 pack store opt-in & the job 190 max|dp| pack vs plain shift

The FP8 pack store is already opt-in and off by default: ATLAS_SCORE_STORE_GB defaults to 0.0, and store_insert returns Ok(()) immediately when the budget is 0 without quantizing or modifying the pack (added store_is_opt_in_by_default in score_store.rs). Neither text packs nor image packs touch FP8 storage unless ATLAS_SCORE_STORE_GB > 0.

For the 0.00026 → 0.0059 (1K) and 0.0050 → 0.110 (12K) pack vs plain shift between job 109 (Nov 10) and job 190 (Nov 25):

  • At 12K, 4a40e3d3b (merged with score: knowledge packs, encoded once and read by every request (stacked on #331) #332 after job 109) restricted _gqa_split2 to pack streams only, so plain 12K now uses unsplit _gqa while pack 12K uses _gqa_split2 — different reduction order between pack and plain.
  • _gqa_split2 does not fire at 1K (< 4096 keys), so something else moved the 1K number between Nov 10 and Nov 25. On this PR's default-on path, the two kernels that touch text-pack/plain prefill are dl_quant_nvfp4_kt (its LANE=true variant runs for m in 96..=383 and can round differently from dl_quant_nvfp4 on a continuation chunk vs a full prompt) and gated_rms_norm_prefill_warp.

Could you check whether base (main after #332) alone already gives 0.0059 / 0.110 for pack vs plain, or whether base pack vs base + #397 pack differs? If the delta comes from dl_quant_nvfp4_kt or gated_rms_norm_prefill_warp on this branch, we can gate or align that kernel right away.

@AzeezIsh

Copy link
Copy Markdown
Contributor

@data-angel Re-gated 391f8d5d2 against main cb4dcf9a7 on one GB10 (sparky job 215), with both built from fresh worktrees.

First, a correction: you were right about the pack scores. main alone gives the same pack-vs-plain numbers, to every digit:

score_probe (synthetic handbook, --score-packs 4) pack vs plain 1K 12K
main cb4dcf9a7 0.00590754 0.11036
this PR, FP8 store off (the default) 0.00590754 0.11036
this PR, ATLAS_SCORE_STORE_GB=4 (FP8 store on) 0.00547 0.0800

So the 0.11 shift came in with main (#332 as merged, which includes your _gqa_split2-on-pack-streams change), not here. On 11-25 I blamed your FP8 store, and that was wrong. The store is opt-in as you said, and with it on, packs are no further from plain. Since 0.11 is a large probability shift for a scoring API, I'll open a separate issue for the pack-vs-plain reduction order on main.

Everything else is identical to main

check main vs this PR
/v1/score plain cells (1K, 12K): packs off, and packs on max|dp| 0 · 0
held == pack, merged ×8 == held true · true, as on main
long_pack (55,390 tokens, over this probe's 49,152-token arena) 422 on both
Qwen3.8-27B vision (solid red, drawn scene, 1600×400 wide, video), greedy top-20 94/94 · 95/95 · 54/54 · 95/95, max|Δlogprob| 0
Qwen3.8-27B text: lp_dump 26,912 tokens, greedy C1 / C8 max|Δ| 0.0000 · 8/8 · 8/8
Flash-Next FP4-Local vision, same four cases exact. The video run differs between repeats on both binaries alike (run 1 vs 1 and run 2 vs 2 are exact), so that's server noise.
Inkling 2 Mini image probe; Strict greedy C1 / C8 (the vision_preprocess.rs merge) 3/3 · 8/8 · 8/8

CI has two red workspace jobs from this branch. Both pass on main, so they block the merge:

  1. cargo test --workspace: kernel_shadow_detector::no_model_shadow_drops_a_common_kernel reports 48 drops. Every model that shadows common/rms_norm.cu (gemma-4-26b-a4b, gemma-4-31b, longcat-flash-lite, minimax-m2-229b, mistral-small-4, the nemotron-3 targets, …) lacks norm::rms_norm_rows_any_block, norm::gated_rms_norm_prefill_warp, norm::gated_rms_norm_prefill_warp_sigmoid, and a norm::NAME that the detector reads out of your GATED_RMS_NORM_PREFILL_WARP(NAME, …) macro. Either carry them in those shadows, or list them in common/KERNEL.toml's shadow exemptions with a reason each (and confirm no shadowing model's dispatch asks for them, since the startup audit stays fail-closed). Spelling the two gated_rms_norm_prefill_warp* entry points out as real extern "C" kernels over a shared device function would also stop the detector from seeing NAME.
  2. Docs (rustdoc): public documentation for resolve_row_norm_any_block links to private item ROW_NORM_ANY_BLOCK (layers/ops/norm.rs:277 and :290). Plain code (`ROW_NORM_ANY_BLOCK` without the brackets) is how closure attestation: resolve kernel_source and base_quant targets as the build does #420 handled the same case.

The env budget (+4 now, thanks for folding), cargo deny and the PR benchmark gate are red on main as well. If the fix is limited to exemptions, the macro spelling and the doc comment, the GPU results above carry over. Once CI is green I'll merge. Your FP8 question is answered, so the earlier changes-requested review no longer applies.

The pair (TP2/EP2) half of my 11-19 Flash-Next vision bisect can't run any more: the pair is gone. The single-node vision legs above are exact, which is what I can check.

sparky nightq 215 · main cb4dcf9a7 q27 9c3261bd fn 0d33fa51 ink d3b020d8 · PR 391f8d5d2 q27 1e90762a fn 1bfa07af ink 723bfe03 · CI runs 46184248979 / 46184248930 · 2026-11-28

🤖 Generated with Claude Code

@github-actions github-actions Bot removed the needs-rebase Conflicts with main — its green checks are NOT real (GitHub skips merge-commit workflows) label Nov 29, 2026
@AzeezIsh

AzeezIsh commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@data-angel I pushed 67954eedc to this branch to clear the two red workspace jobs (please pull before you push again):

  • Shadow detector (48 drops): gated_rms_norm_prefill_warp{,_sigmoid} and the rms_norm_rows_any_block marker are optional by design (try_shipped_kernel, handle 0 / 1024 threads when absent). I listed them in [shadow_exempt] norm in kernels/gb10/common/KERNEL.toml and in strix-hip/common (its rms_norm.cu is a symlink to gb10's), with the reason. The phantom norm::NAME came from the GATED_RMS_NORM_PREFILL_WARP(NAME, …) macro body, so I wrote the two wrappers out explicitly (same signature, launch bounds and body call).
  • rustdoc: the doc link to the private ROW_NORM_ANY_BLOCK is now plain code text.

The workspace jobs pass on 67954eedc. One caveat from a sparky run: video_decode_ffmpeg::hour_tests::probe_timeout_covers_a_blocked_stdout_read flaked once under full-suite load ("Text file busy" exec'ing its temp script). It passes alone and isn't touched here. This merges after #411; I'm gating the chain on sparky (job 219).

🤖 Generated with Claude Code

@AzeezIsh

AzeezIsh commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

@data-angel Gated and merging, second in today's chain (after #411). Sparky job 219, one GB10, fresh worktrees: main cb4dcf9a7 vs the chain's top (#411 + this PR at 67954eedc + #399).

check main vs chain
/v1/score plain cells (1K, 12K), packs off and packs on identical, max|dp| 0 · 0
held == pack, merged ×8 == held, long_pack (55,390 tokens) true · true · 422, as on main
pack vs plain 0.0059 / 0.110, same as main to every digit (issue #435)
Qwen3.8-27B vision (red, scene, wide, video) 94/94 · 95/95 · 54/54 · 95/95, max|Δlogprob| 0
Qwen3.8-27B text lp_dump (26,912 tokens); greedy C1 / C8; tools max|Δ| 0.0000; 8/8 · 8/8; 14/14
Flash-Next FP4-Local vision (same four); r2 lp_dump; greedy C1 all EXACT; 0.0000; 8/8
Inkling 2 Mini Strict greedy C1 / C8, image, tools 8/8 · 8/8, 3/3, 14/14
Ling-3.2-air (NVFP4A16) greedy C1 / C8, before vs after this PR and #399 8/8 · 8/8

So with rms_norm_rows_any_block resolved, the 256-thread residual norms and the warp-per-head gated norm keep the bits on all four models.

sparky nightq 219 · main cb4dcf9a7 · chain top 105890150 · 2026-12-01

🤖 Generated with Claude Code

@AzeezIsh
AzeezIsh merged commit 536d81c into Atlas-Inf:main Dec 1, 2026
24 of 27 checks passed
AzeezIsh added a commit to Enntity/atlas that referenced this pull request Dec 1, 2026
…pseek_v41

Conflicts in five files, each two additions in the same place (Ling-3.2-air from Atlas-Inf#411, DeepSeek-V4.1 here):
config.rs and config/dispatch.rs parser imports, the factory loader list and its Supported string,
model_type_ships_vanilla_norm_weights, and supports_chunked_mla_impl (DeepSeek-V4.1's early return
kept ahead of Atlas-Inf#411's Ling/GLM expression). Both sides kept everywhere.
AzeezIsh added a commit that referenced this pull request Dec 2, 2026
…ince #397)

#397 (merged 2026-12-01) added vit_flash_attention_d72 to the shared
qwen3.6-35b-a3b vision_encoder.cu with a raw mma.sync helper. strix-hip's
qwen3.6-27b, qwen3.6-35b-a3b and qwen3.8-flash-next targets link that file, so
every strix-hip build of main fails ("invalid output constraint '+f' in asm",
vision_encoder.cu:560; reproduced on framework at 50fad3f). The AMD branch
runs atlas_emu::mma_m16n8k16; every caller drives it with the whole wave.
NVIDIA keeps the original asm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AzeezIsh added a commit that referenced this pull request Dec 3, 2026
…ndows first_run.ps1 serve refused to start)

#397's dense_gemm_bf16_pipelined_epi lookup is soft (vit_fused() gates on
handle != 0) but undeclared, so every serve without
--dangerously-allow-unresolved-kernel-lookups stopped at boot. serve-amd.sh
passes that flag; the Windows first_run.ps1 recipe does not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AzeezIsh added a commit that referenced this pull request Dec 4, 2026
strix-hip: fix main's AMD build (vision_encoder raw mma.sync since #397)
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.

2 participants