Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
257 commits
Select commit Hold shift + click to select a range
60f4bbf
[DeepSeek-V4.1] Minimal prefill prototype (§4)
mvasilijevicTT Sep 28, 2026
7349bbe
[DeepSeek-V4.1] Attention error-budget experiment
mvasilijevicTT Sep 29, 2026
89187d4
[DeepSeek-V4.1] Lagged hyper-connection residual and final collapse (F8)
mvasilijevicTT Sep 29, 2026
e748aa7
[DeepSeek-V4.1] Prefill cache layout and state (F6.3)
mvasilijevicTT Sep 29, 2026
2de4adf
[DeepSeek-V4.1] F0 checkpoint weight preparation
mvasilijevicTT Sep 29, 2026
c179553
[DeepSeek-V4.1] Device KV compressor, ratio 2 and 1 (F2)
mvasilijevicTT Sep 29, 2026
79e8d95
[DeepSeek-V4.1] Reference oracle package: cached captures, state and …
mvasilijevicTT Sep 29, 2026
ed38bf6
[DeepSeek-V4.1] Device QDQ ops matching the reference bit for bit
mvasilijevicTT Sep 29, 2026
27a66e9
[DeepSeek-V4.1] Index keys, indexer, candidates and top-k on device (F4)
mvasilijevicTT Sep 29, 2026
d22ff8e
[DeepSeek-V4.1] CPU reference: one fp32 matmul per block-scaled GEMM
mvasilijevicTT Sep 29, 2026
def3b31
[DeepSeek-V4.1] ViT x32 + aligner on device (10.1)
mvasilijevicTT Sep 29, 2026
b6a6c4a
[DeepSeek-V4.1] Tuned gate matmul entry for the V4.1 shape (640, 1280…
mvasilijevicTT Sep 29, 2026
81ce15b
[DeepSeek-V4.1] DSpark prefill seeding on device: taps, main_proj, wi…
mvasilijevicTT Sep 29, 2026
72ffe23
[DeepSeek-V4.1] MoE at V4.1 dims: TtV41Moe, expert-input FP8 QDQ, op …
mvasilijevicTT Sep 29, 2026
76a29aa
[DeepSeek-V4.1] Embedding and last-token head on device (F1)
mvasilijevicTT Sep 29, 2026
3542cb0
[DeepSeek-V4.1] Device-only attention on shared prefill state (F3/F7/…
mvasilijevicTT Sep 29, 2026
1431d72
[DeepSeek-V4.1] Checkpoint-calibrated synthetic weights; small-dims b…
mvasilijevicTT Sep 29, 2026
052f327
[DeepSeek-V4.1] Prompt-length edge cases: padded last chunk, prompts …
mvasilijevicTT Sep 29, 2026
763647c
[DeepSeek-V4.1] Engram host hash + lookup, device wkv and gated updat…
mvasilijevicTT Sep 29, 2026
d8856fe
[DeepSeek-V4.1] Prefill transformer and chunk driver (F9)
mvasilijevicTT Sep 29, 2026
788832b
[DeepSeek-V4.1] Wire Engram into the prefill transformer
mvasilijevicTT Sep 29, 2026
7d2e3fc
[DeepSeek-V4.1] Block acceptance bars by data source
mvasilijevicTT Sep 29, 2026
41683fd
[DeepSeek-V4.1] Block test checks window-KV contents
mvasilijevicTT Sep 29, 2026
c337955
[DeepSeek-V4.1] Engram device table lookup and packed host upload (F5)
mvasilijevicTT Sep 29, 2026
31f2585
[DeepSeek-V4.1] SCALED_FP8 KV rows without a BF16 RoPE tail
mvasilijevicTT Sep 29, 2026
276d390
[DeepSeek-V4.1] SCALED_FP8 prefill KV caches behind a construction-ti…
mvasilijevicTT Sep 29, 2026
5d50016
[DeepSeek-V4.1] MoE dispatch capacity = top-k: never drop tokens
mvasilijevicTT Sep 29, 2026
efd6b3a
[DeepSeek-V4.1] Stack gate: teacher-forced real-text agreement vs a r…
mvasilijevicTT Sep 29, 2026
f16195d
[DeepSeek-V4.1] Mesh layout checks: Galaxy 8x4 / 4x8 accepted, unsupp…
mvasilijevicTT Sep 29, 2026
2aceb5f
[DeepSeek-V4.1] Oracle package: cached ViT + aligner oracle; retire t…
mvasilijevicTT Sep 29, 2026
d0f9727
[DeepSeek-V4.1] Stack floor noise on MoE inputs too; tests use refere…
mvasilijevicTT Sep 29, 2026
ab314b7
[DeepSeek-V4.1] Perf/capacity model follows the implemented dataflow;…
mvasilijevicTT Sep 29, 2026
33ce61e
[DeepSeek-V4.1] Stack gate: per-layer free-running drift vs the refer…
mvasilijevicTT Sep 29, 2026
fc79d14
[DeepSeek-V4.1] §8 measurements: expert dtype study, trace mode, perf…
mvasilijevicTT Sep 29, 2026
3f48353
[DeepSeek-V4.1] Device weight caches keyed by mesh shape
mvasilijevicTT Sep 29, 2026
c131d25
[DeepSeek-V4.1] Image span merge, VL routing bias, Engram image mask …
mvasilijevicTT Sep 29, 2026
e2ac74e
[DeepSeek-V4.1] Long-context indexer baseline benchmark (F10 phase 1)
mvasilijevicTT Sep 29, 2026
476ca7a
[DeepSeek-V4.1] Collectives take each mesh axis's topology from the f…
mvasilijevicTT Sep 29, 2026
8aff3bd
[DeepSeek-V4.1] 4x2: route the TP=2 attention reshard around all_to_a…
mvasilijevicTT Sep 29, 2026
adbeb78
[DeepSeek-V4.1] Prefill forward without host writes: device position …
mvasilijevicTT Sep 29, 2026
909310d
[DeepSeek-V4.1] Trace mode captures the prefill forward as is: block …
mvasilijevicTT Sep 29, 2026
78d3d82
[DeepSeek-V4.1] Device-weight cache keyed by source + conversion + me…
mvasilijevicTT Sep 29, 2026
5b56cdd
[DeepSeek-V4.1] Device-profiler harness for the G2 per-op table (8y7.…
mvasilijevicTT Sep 29, 2026
ef57559
[DeepSeek-V4.1] Reference only on a cache miss; CPU-only cache prepar…
mvasilijevicTT Sep 29, 2026
3cd6d48
[DeepSeek-V4.1] Transformer trace perf mode: V41PrefillTrace over the…
mvasilijevicTT Sep 29, 2026
35188c0
[DeepSeek-V4.1] Fused activation QDQ op (8y7.9.4)
mvasilijevicTT Sep 29, 2026
3d668f2
[DeepSeek-V4.1] Prefill trace perf cases at chunk 2048 / 5120 and wit…
mvasilijevicTT Sep 29, 2026
1ca5419
[DeepSeek-V4.1] Fused mHC collapse / hc_post stream-mix op (8y7.9.5)
mvasilijevicTT Sep 29, 2026
836de33
[DeepSeek-V4.1] Timing events for device tests: device, phase and cac…
mvasilijevicTT Sep 29, 2026
771d0c1
[DeepSeek-V4.1] Route V4.1 mHC collapse / hc_post through the fused o…
mvasilijevicTT Sep 29, 2026
f9460f2
[DeepSeek-V4.1] CCL link-rate calibration test for the V4.1 perf mode…
mvasilijevicTT Sep 29, 2026
9a08942
[DeepSeek-V4.1] MoE and block norms on the fabric's link count (8y7.9.6)
mvasilijevicTT Sep 29, 2026
fc26940
[DeepSeek-V4.1] Attention glue: RoPE tail in place, first-chunk-only …
mvasilijevicTT Sep 29, 2026
bc089c3
[DeepSeek-V4.1] Fused mHC split projection: one pass, one TP all-redu…
mvasilijevicTT Sep 29, 2026
752a17e
[DeepSeek-V4.1] LM head and cache collectives use the fabric link count
mvasilijevicTT Sep 29, 2026
2fcc3a0
[DeepSeek-V4.1] Attention dense projections on 2D-multicast program c…
mvasilijevicTT Sep 29, 2026
52822ad
[DeepSeek-V4.1] DSpark seeding on checkpoint DSpark weights (8y7.10.3)
mvasilijevicTT Sep 29, 2026
7412417
[DeepSeek-V4.1] Perf model CCL terms from the measured link calibrati…
mvasilijevicTT Sep 29, 2026
b191e84
[DeepSeek-V4.1] Weight-cache key: mixed checkpoint/synthetic specs ge…
mvasilijevicTT Sep 29, 2026
15abbe1
[DeepSeek-V4.1] bf16 sublayer I/O of the fused mHC collapse and hc_po…
mvasilijevicTT Sep 30, 2026
623f8f9
[DeepSeek-V4.1] Fused attention head layout around sparse_sdpa (8y7.9.9)
mvasilijevicTT Sep 30, 2026
7c3e8ca
[DeepSeek-V4.1] Indexer: block-id candidates, exact subset selection …
mvasilijevicTT Sep 30, 2026
b9e9040
[DeepSeek-V4.1] Routed-expert load profile and cost-balanced expert p…
mvasilijevicTT Sep 30, 2026
a9f0443
[DeepSeek-V4.1] Indexer glue: ratio-2 mask in place, source top-k in …
mvasilijevicTT Sep 30, 2026
0021f10
[DeepSeek-V4.1] MoE on the cost-balanced expert placement (8y7.9.8)
mvasilijevicTT Sep 30, 2026
dd509ad
[DeepSeek-V4.1] Candidate index sources mask their row below 2^17 col…
mvasilijevicTT Sep 30, 2026
c8347bf
[DeepSeek-V4.1] G2 profile and perf harness on real text through the …
mvasilijevicTT Sep 30, 2026
39ba046
[DeepSeek-V4.1] Prefill trace harness: per-phase replay breakdown (8y…
mvasilijevicTT Sep 30, 2026
ddf37ce
[DeepSeek-V4.1] Read back only the scored logits rows of a partly sco…
mvasilijevicTT Sep 30, 2026
be6e359
[DeepSeek-V4.1] Mark the accepted fp4_ue8m0 tiny-amax QDQ deviation a…
mvasilijevicTT Sep 30, 2026
1320a17
[DeepSeek-V4.1] Block op-overlap experiments E0, E1, E3, E3b (8y7.9.11)
mvasilijevicTT Sep 30, 2026
a4d0857
[DeepSeek-V4.1] MoE placement A/B on real text: checkpoint order vs p…
mvasilijevicTT Sep 30, 2026
3b9ae28
[DeepSeek-V4.1] Perf model: prefill scenarios, timed indexer top-k, s…
mvasilijevicTT Sep 30, 2026
fa29837
[DeepSeek-V4.1] Profile harness: prefill scenarios with filled caches…
mvasilijevicTT Sep 30, 2026
56011b0
[DeepSeek-V4.1] Oracle: indexer scored in query blocks; last-chunk dr…
mvasilijevicTT Sep 30, 2026
7b52faa
[DeepSeek-V4.1] Long-context prefill gate: N x 5120 real-text chunks …
mvasilijevicTT Sep 30, 2026
9fb0258
[DeepSeek-V4.1] Expert placement: per-chip objective from the text A/…
mvasilijevicTT Sep 30, 2026
c0a05f9
[DeepSeek-V4.1] Profile harness: one-chunk tiled fill for profiled sc…
mvasilijevicTT Sep 30, 2026
c253076
[DeepSeek-V4.1] all_to_all_async_generic: multicast init only on axes…
mvasilijevicTT Sep 30, 2026
34f3b65
[DeepSeek-V4.1] TP reshard: drop the TP=2 all-gather + mesh_partition…
mvasilijevicTT Sep 30, 2026
1655fae
[DeepSeek-V4.1] Galaxy 8x4 / 4x8 parametrization of the V4.1 device t…
mvasilijevicTT Sep 30, 2026
5d7377a
[DeepSeek-V4.1] Galaxy CI jobs for the V4.1 prefill gates (8y7.13.4)
mvasilijevicTT Sep 30, 2026
9724036
[DeepSeek-V4.1] V41PrefillState: zero large caches on device (8y7.8.11)
mvasilijevicTT Sep 30, 2026
6cf04d7
[DeepSeek-V4.1] Indexer selection on row-major kernels: segment max +…
mvasilijevicTT Sep 30, 2026
4165816
[DeepSeek-V4.1] Perf model: indexer selection terms from the selectio…
mvasilijevicTT Sep 30, 2026
da2e2f9
[DeepSeek-V4.1] Perf model: candidate index source scores only its ca…
mvasilijevicTT Sep 30, 2026
4e2ba93
[DeepSeek-V4.1] Indexer: candidate scoring for L24 on long rows, L20 …
mvasilijevicTT Sep 30, 2026
7710fee
[DeepSeek-V4.1] Profile harness: Galaxy 8x4 / 4x8 scenario ids (8y7.1…
mvasilijevicTT Sep 30, 2026
51ad261
[DeepSeek-V4.1] Attention: first-chunk index-row compaction as one in…
mvasilijevicTT Sep 30, 2026
8ae136f
[DeepSeek-V4.1] mHC stream mix: coefficient tiles from half the store…
mvasilijevicTT Sep 30, 2026
ffe85b9
[DeepSeek-V4.1] Profile + production gates: LoudBox 4x2 ids (8y7.20.1.2)
mvasilijevicTT Sep 30, 2026
eccdc23
[DeepSeek-V4.1] Transformer gate: env-gated dump for cross-process de…
mvasilijevicTT Sep 30, 2026
6e39fe4
[DeepSeek-V4.1] Transformer gate: SCALED_FP8 KV block acceptance at 4…
mvasilijevicTT Sep 30, 2026
b7ab6db
[DeepSeek-V4.1] Transformer gate: padded last chunk at production dims
mvasilijevicTT Sep 30, 2026
9aa26d7
[DeepSeek-V4.1] Load the checkpoint Engram tables as host tables
Oct 5, 2026
4ecf44b
[DeepSeek-V4.1] Depth test: any layer schedule, real weights, timed
Oct 5, 2026
4f18077
[DeepSeek-V4.1] Single-token decode on the prefill state
Oct 6, 2026
570ad48
[DeepSeek-V4.1] vLLM generator over the prefill and the decode step
Oct 6, 2026
9fd3187
[DeepSeek-V4.1] Traced prefill in the vLLM generator
Oct 7, 2026
50ea7a9
[DeepSeek-V4.1] Time the phases of a replayed prefill
Oct 8, 2026
e492e79
[DeepSeek-V4.1] Padding-aware MoE in the prefill
Oct 9, 2026
b4f6146
[DeepSeek-V4.1] KV row format of the model's states from the environment
Oct 9, 2026
00aafda
[DeepSeek-V4.1] Device-profiler mode of the decode test
Oct 9, 2026
38e476d
[DeepSeek-V4.1] Batched decode: every slot of the mesh in one step
Oct 9, 2026
20683f4
[DeepSeek-V4.1] Serve the batched decode step
Oct 9, 2026
b211ee0
[DeepSeek-V4.1] Traced join of a prefill state into a decode slot
Oct 10, 2026
81daed6
[DeepSeek-V4.1] Device sampling of the batched decode step
Oct 10, 2026
4e3109a
[DeepSeek-V4.1] Decode-shaped grids for the mHC kernels and projections
Oct 12, 2026
27fe4ef
[DeepSeek-V4.1] Routed-expert dtype from the environment
Oct 12, 2026
4f49485
[DeepSeek-V4.1] Tiled and block-page destinations for scatter_rows
Oct 15, 2026
d235e7a
[DeepSeek-V4.1] Persistent tiled index-K pools and block pages
Oct 15, 2026
bd7ddf6
[DeepSeek-V4.1] Per-row pins for segment_max and candidate_scores
Oct 15, 2026
f27cc5c
[DeepSeek-V4.1] Candidate-block selection in the batched decode step
Oct 15, 2026
333de0e
[DeepSeek-V4.1] Decode scores the candidate rows from the block pages
Oct 15, 2026
3618249
[DeepSeek-V4.1] The batched step at long pool capacities
Oct 15, 2026
0efd090
[DeepSeek-V4.1] Per-chunk prefill timing and 1M prompts in the genera…
Oct 15, 2026
6a24163
[DeepSeek-V4.1] Position-generic traced prefill chunks
Oct 17, 2026
599ef7f
[DeepSeek-V4.1] Resume a prefill at a chunk boundary; prefetch the ho…
Oct 18, 2026
6803e58
[DeepSeek-V4.1] Capture the final partial chunk of the listed prompt …
Oct 18, 2026
a353897
[DeepSeek-V4.1] Prepare the next chunk's host inputs across chunked p…
Oct 18, 2026
e118952
[DeepSeek-V4.1] Capture each listed prompt length with its neighbours
Oct 19, 2026
7d81054
[DeepSeek-V4.1] Decode-shaped gate selection and routing setup
Oct 19, 2026
805e77a
[DeepSeek-V4.1] Decode MoE tail; gather and barrier guards for the hang
Oct 21, 2026
2338747
[DeepSeek-V4.1] Drain writes at the routed expert FFN reader's exit
Oct 22, 2026
1489f2e
[DeepSeek-V4.1] Drop the decode tail's start barrier and the gather r…
Oct 22, 2026
d588de3
[DeepSeek-V4.1] Do not drain the device after an intermediate prefill…
Oct 22, 2026
f0f0155
[DeepSeek-V4.1] Size a decode join's index by the prompt, not the pool
Oct 22, 2026
7133c16
[DeepSeek-V4.1] Read the Engram tables with O_DIRECT on threads
Oct 22, 2026
3b49cdf
[DeepSeek-V4.1] Shard an Engram chunk's packed rows per chip, valid c…
Oct 22, 2026
2cdad38
[DeepSeek-V4.1] Keep the generic chunk tables' host tensors per chunk…
Oct 22, 2026
4ffc598
[DeepSeek-V4.1] Build the MoE padding configs before any capture
Oct 23, 2026
9fca4fb
[DeepSeek-V4.1] Device-profiler run of the prefill chunk at chosen sh…
Oct 23, 2026
db9fa6b
[DeepSeek-V4.1] A start-position margin for the capacity harness
Oct 24, 2026
987d450
[DeepSeek-V4.1] Single-query scorer for the decode step's dense index…
Oct 24, 2026
fd39f2b
[DeepSeek-V4.1] Packed host inputs for the batched decode step
Oct 24, 2026
a4f294a
[DeepSeek-V4.1] A short-chunk prefill geometry for the short prompts
Oct 24, 2026
6015757
[DeepSeek-V4.1] Per-program floor of a traced step on the Galaxy
Oct 24, 2026
2c84baa
[DeepSeek-V4.1] A c1 MoE broadcast path for the batched decode step
Oct 24, 2026
9c4240d
[DeepSeek-V4.1] The mHC Sinkhorn lane-wise on the SFPU
Oct 24, 2026
cba4ad3
[DeepSeek-V4.1] Fold the decode shared expert into the MoE tail
Oct 24, 2026
c731569
[DeepSeek-V4.1] Diagnose the short-chunk decode L1 clash
Oct 24, 2026
c45936a
[DeepSeek-V4.1] Build the prefill index mask once per chunk
Oct 24, 2026
b8f02f3
[DeepSeek-V4.1] Live-row phases in the decode capacity harness
Oct 26, 2026
105de48
[DeepSeek-V4.1] Fold the shared expert into the c1 MoE under V41_SHAR…
Oct 27, 2026
d31f01c
[DeepSeek-V4.1] Profiler drains in the decode capacity harness
Oct 27, 2026
305c25d
[DeepSeek-V4.1] Drain the profiler once after the harness joins
Oct 27, 2026
920aa0d
[DeepSeek-V4.1] Decode sublayer norms on a core grid
Oct 27, 2026
910d773
[DeepSeek-V4.1] Index selection for the live user in the c1 capture
Oct 27, 2026
3abcd35
[DeepSeek-V4.1] The c1 MoE's shared expert split over the 32 chips
Oct 27, 2026
da08c8a
[DeepSeek-V4.1] The decode mHC TP sum as one gather and a sum
Oct 27, 2026
2ab7936
[DeepSeek-V4.1] The decode output projection's head concat in the QDQ
Oct 27, 2026
001f735
[DeepSeek-V4.1] c1_select writes a persistent weight tile
Oct 27, 2026
4f11680
[DeepSeek-V4.1] The decode step's host inputs as one page, one Engram…
Oct 27, 2026
d1bd4bc
[DeepSeek-V4.1] Swap the Engram tables back in after the build; a cop…
Oct 27, 2026
c6fad3f
[DeepSeek-V4.1] A decode-shaped routed expert FFN for the c1 MoE
Oct 28, 2026
b6d98e8
[DeepSeek-V4.1] A DRAM probe at the served trace region
Oct 28, 2026
61a6bf6
[DeepSeek-V4.1] The decode SDPA on the chip's own heads
Oct 28, 2026
f2884ba
[DeepSeek-V4.1] The mHC projection on the decode tile with two ops fewer
Oct 28, 2026
d414ec6
[DeepSeek-V4.1] The mHC DRAM weight read for the decode tile only
Oct 28, 2026
f2b5de3
A bounded post-task spin for the device-bound thread pool workers
Oct 28, 2026
0d4d803
[DeepSeek-V4.1] The decode step's host copies in one dispatch round
Oct 28, 2026
c7861cb
[DeepSeek-V4.1] A quarter-geometry timing probe for the c1 expert reader
Oct 28, 2026
d54c84a
[DeepSeek-V4.1] A DRAM-rate program for the decode tile's projections
Oct 28, 2026
40ac8f7
[DeepSeek-V4.1] The decode step's inverse-RoPE neg once a step
Oct 28, 2026
9e319b9
[DeepSeek-V4.1] A flash-decode SDPA for the decode step (V41_DECODE_S…
Oct 28, 2026
e773a15
[DeepSeek-V4.1] The flash SDPA merge without FPU-after-SFPU DST hazards
Oct 28, 2026
a0ac7f6
[DeepSeek-V4.1] The flash SDPA test per live row; the fp8 unpack mode…
Oct 28, 2026
dce3b60
[DeepSeek-V4.1] The flash SDPA partials through the merge cores L1
Oct 28, 2026
8b592dc
[DeepSeek-V4.1] Batched mesh writes on the calling thread by env
Oct 28, 2026
33bd88f
[DeepSeek-V4.1] The flash SDPA test timing calls; the one-key unit di…
Oct 29, 2026
3e31c4a
[DeepSeek-V4.1] DSpark drafter weight loader and its CPU test
Oct 27, 2026
230b74f
[DeepSeek-V4.1] DSpark drafter on the mesh and its reference test
Oct 27, 2026
103c263
[DeepSeek-V4.1] Seed the DSpark rings from the generic prefill
Oct 27, 2026
b9eabdd
[DeepSeek-V4.1] Drafter test: measured bars, free-DRAM readout, cheap…
Oct 27, 2026
b2b50cd
[DeepSeek-V4.1] Verify rows: K drafts as 1 + K rows of the decode step
Oct 27, 2026
d43b1c1
[DeepSeek-V4.1] Generic prefill captures seed the DSpark rings too
Oct 27, 2026
d4f267f
[DeepSeek-V4.1] DSpark drafter: the Markov loop in the graph
Oct 27, 2026
2142de2
[DeepSeek-V4.1] Decode a model that carries DSpark seeding
Oct 27, 2026
16bf794
[DeepSeek-V4.1] Verify step computes the drafter's taps in its graph
Oct 28, 2026
747ae8f
[DeepSeek-V4.1] The drafter inside the verify step's capture, one rep…
Oct 28, 2026
57d2d39
[DeepSeek-V4.1] The c1 MoE on the verify rows: 1 + K rows of one user
Oct 28, 2026
f6be68a
[DeepSeek-V4.1] c1 MoE test: V41_C1_ROWS live rows, replayed against …
Oct 28, 2026
5004bdf
[DeepSeek-V4.1] c1 MoE test: per-row readout and a determinism check
Oct 28, 2026
03fe59a
[DeepSeek-V4.1] c1 MoE test: the fp64 oracle per live row
Oct 28, 2026
b1932db
[DeepSeek-V4.1] c1 MoE test: W, y per row on chip 0
Oct 28, 2026
6409160
[DeepSeek-V4.1] c1 MoE test: the local sum and the shared piece per row
Oct 28, 2026
c311db4
[DeepSeek-V4.1] c1 MoE test: the collectives per row on every chip
Oct 28, 2026
0b7286a
[DeepSeek-V4.1] c1 MoE test: every chip's total against the host per row
Oct 28, 2026
a1abd1b
[DeepSeek-V4.1] Verify rows harness: the prefill state sized to the r…
Oct 28, 2026
fa062d9
[DeepSeek-V4.1] c1_select: row t's weight at column 32 l + t
Oct 28, 2026
caa37d1
[DeepSeek-V4.1] The served speculative round behind the plugin's cont…
Oct 28, 2026
7a48b2a
[DeepSeek-V4.1] Verify rows: a c1 block's draft rows past the users' …
Oct 28, 2026
dfd7870
[DeepSeek-V4.1] The plain one-slot variant captured at the spec warm-up
Oct 28, 2026
c4f58ff
[DeepSeek-V4.1] The ragged contract of the served speculative round
Oct 28, 2026
82f38d2
[DeepSeek-V4.1] The verify rows' index selections merged in one chain
Oct 28, 2026
89899dd
[DeepSeek-V4.1] The verify rows' SDPA on the chip's own heads
Oct 28, 2026
5c4c93c
[DeepSeek-V4.1] Verify rows harness: n live slots in lockstep
Oct 28, 2026
047775a
[DeepSeek-V4.1] The sampled speculative round: the match rule on device
Oct 28, 2026
b7ebffd
[DeepSeek-V4.1] Verify rows harness: the host inputs per item
Oct 28, 2026
63bcdef
[DeepSeek-V4.1] Sampling test: the kernel's law to 0.02, the exp probe
Oct 28, 2026
df0381b
[DeepSeek-V4.1] Verify rows: the MoE's real rows decoupled from the s…
Oct 28, 2026
bae724c
[DeepSeek-V4.1] Verify rows: the row entries filled at once
Oct 28, 2026
668dcd1
[DeepSeek-V4.1] The drafter's rings per slot, the multi-block draft call
Oct 28, 2026
a67cf6a
[DeepSeek-V4.1] The generator releases a finished request's slot
Oct 29, 2026
919d725
[DeepSeek-V4.1] Park and restore a prefix between a decode slot and t…
Oct 29, 2026
8792e0e
[DeepSeek-V4.1] The park / restore / final / decode harness
Oct 29, 2026
d47fc8a
[DeepSeek-V4.1] Capture the restore per slot and width; its own CCL s…
Oct 29, 2026
54f8741
[DeepSeek-V4.1] Create the restore's collective workloads before any …
Oct 29, 2026
3710dfd
[DeepSeek-V4.1] The deferred-final harness compares rings in a canoni…
Oct 29, 2026
a0f5d7c
[DeepSeek-V4.1] The deferred-final harness gates on the prefill-writt…
Oct 30, 2026
500fe1d
[DeepSeek-V4.1] The deferred-final harness gates against the serial p…
Oct 30, 2026
8c43aee
[DeepSeek-V4.1] The deferred-final harness gates only the prompts the…
Oct 30, 2026
ce6336a
[DeepSeek-V4.1] The deferred-final harness probes the serial path in …
Oct 30, 2026
6368173
[DeepSeek-V4.1] Time the standalone draft call per item
Oct 31, 2026
574fefe
[DeepSeek-V4.1] Upload the drafter's zero tap once
Oct 31, 2026
edd7605
[DeepSeek-V4.1] Pack the draft call's inputs into one page
Oct 31, 2026
d7699c1
[DeepSeek-V4.1] Trim the verify step's host inputs
Oct 31, 2026
343ed0f
[DeepSeek-V4.1] Read the draft call's drafts in one readback
Oct 31, 2026
5961a68
[DeepSeek-V4.1] The c32 harness reads the draft call gathered
Oct 31, 2026
bb3b172
[DeepSeek-V4.1] No device sync before the draft replay
Oct 31, 2026
f42922d
[DeepSeek-V4.1] Read the decode rows' scalars as lists once
Oct 31, 2026
c54f008
[DeepSeek-V4.1] Build the next step's inputs during the draft replay
Oct 31, 2026
4e27ca3
[DeepSeek-V4.1] The Engram row gathers back in sequence
Oct 31, 2026
928a0c3
[DeepSeek-V4.1] The draft call's tap copy before its page write
Oct 31, 2026
f486e2e
[DeepSeek-V4.1] The draft call's main RoPE pair out of the page
Nov 1, 2026
e30459b
[DeepSeek-V4.1] The prefill call's host copies in one round each
Oct 29, 2026
0ce225c
[DeepSeek-V4.1] Bound the candidate source's selection at the pin
Oct 30, 2026
23e01de
[DeepSeek-V4.1] Production cases for the 10,240-row prefill chunk
Oct 30, 2026
023306c
[DeepSeek-V4.1] Zero the prefill state's carries on device by env
Oct 31, 2026
f0e0e59
Add an eager packed prefill chunk behind TT_V41_PACK
Oct 27, 2026
660335c
Make the pack test assert the isolation contract
Oct 27, 2026
bf1add7
Join a packed segment into its decode slot
Oct 29, 2026
b0f79b2
Capture the packed chunk per layout
Oct 29, 2026
c3f2950
Prebuild the padding configs of a pack's segment lengths
Oct 29, 2026
3525b82
Compare a joined slot's block pages over its written rows (test)
Oct 29, 2026
987c18c
Stage a packed chunk's table fills with its upload
Nov 3, 2026
928c8e5
Build the packed state on a short-chunk view (TT_V41_PACK_CHUNK)
Nov 3, 2026
c3332f2
Seed the DSpark drafter's rings per packed segment
Nov 3, 2026
989fcbd
Pass a packed segment through the verify decoder's join
Nov 3, 2026
8bd5d21
Read the pack-join test's rings by position and the reference's chunk
Nov 3, 2026
c81ad1d
[DeepSeek-V4.1] The served round through the generator, for the profiler
Nov 10, 2026
afb52db
[DeepSeek-V4.1] Let the round harness leave profiler reads out
Nov 11, 2026
dfd6811
[DeepSeek-V4.1] The live rows' selection in their candidate blocks in…
Nov 11, 2026
88f587e
[DeepSeek-V4.1] Record the round harness's emitted tokens
Nov 11, 2026
f1aa487
[DeepSeek-V4.1] The live rows' range scores in one launch
Nov 11, 2026
108a234
[DeepSeek-V4.1] Let candidate_scores skip the reads of sentinel blocks
Nov 11, 2026
6cce59f
[DeepSeek-V4.1] Test the live rows' range scores at the pool's width
Nov 11, 2026
fa9d626
[DeepSeek-V4.1] Test range_scores(live=) across a program-cache hit
Nov 12, 2026
128dea8
[DeepSeek-V4.1] Pad range_scores(live=)'s runtime arguments to one le…
Nov 12, 2026
ce7926a
[DeepSeek-V4.1] Default the verify step's index batching on
Nov 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/time_budget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ models:
bh_quietbox_2: 80
demo:
bh_galaxy: 470
bh_sc1: 1750
bh_sc1_high_power: 388
bh_sc1: 1865
bh_sc1_high_power: 403
bh_sc4: 60
wh_n150: 500
wh_n150_civ2: 300
Expand Down
5 changes: 5 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import torch
from loguru import logger

from models.common import timing_events
from models.demos.utils.trace_region_sizes import TRACE_MODEL_KEY_PARAM, resolve_trace_region_size
from models.tt_transformers.demo.trace_region_config import get_logical_sku, get_supported_trace_region_size
from tests.scripts.common import get_updated_device_params, run_process_and_get_result
Expand Down Expand Up @@ -472,11 +473,13 @@ def device(request, device_params):

device.cache_entries_counter = CacheEntriesCounter(device)

timing_events.emit("device.open", fixture="device", device_id=device_id, test=request.node.nodeid)
yield device

# Restore the original default device BEFORE closing the test-specific one
ttnn.SetDefaultDevice(original_default_device)
ttnn.close_device(device)
timing_events.emit("device.close", fixture="device", test=request.node.nodeid)


# Reset fabric config to DISABLED if not None, and do nothing otherwise
Expand Down Expand Up @@ -666,13 +669,15 @@ def mesh_device(request, silicon_arch_name, device_params):
mesh_device.cache_entries_counter = CacheEntriesCounter(mesh_device)

logger.debug(f"multidevice with {mesh_device.get_num_devices()} devices is created")
timing_events.emit("device.open", fixture="mesh_device", shape=list(mesh_device.shape), test=request.node.nodeid)
yield mesh_device

for submesh in mesh_device.get_submeshes():
ttnn.close_mesh_device(submesh)

ttnn.close_mesh_device(mesh_device)
reset_fabric(fabric_config)
timing_events.emit("device.close", fixture="mesh_device", test=request.node.nodeid)
del mesh_device


Expand Down
38 changes: 38 additions & 0 deletions models/common/timing_events.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-FileCopyrightText: © 2026 Tenstorrent USA, Inc.

# SPDX-License-Identifier: Apache-2.0

"""Grep-able timing events for device tests: one line per event, ``TT_EVENT {json}``, with a wall-clock UTC
timestamp, so a run's phases can be reconstructed from its log even though pytest prints captured output after
each test (not chronologically). Events: ``device.open`` / ``device.close`` (device fixtures),
``phase.begin`` / ``phase.end`` (test bodies: reference, oracle, weights, compute), ``cache.hit`` /
``cache.miss`` (result and weight caches, with key and bytes). Printing only: no behavior change for callers.
"""

import json
import time
from contextlib import contextmanager
from datetime import datetime, timezone

PREFIX = "TT_EVENT "


def emit(event: str, **fields) -> None:
record = {"ts": datetime.now(timezone.utc).isoformat(timespec="milliseconds"), "event": event, **fields}
print(PREFIX + json.dumps(record, default=str), flush=True)


@contextmanager
def phase(kind: str, **fields):
"""``phase.begin`` / ``phase.end`` (with seconds) of a ``kind`` phase (reference / oracle / weights / compute)
around a block; ``phase.end`` is emitted on failure too."""
emit("phase.begin", phase=kind, **fields)
start = time.perf_counter()
try:
yield
finally:
emit("phase.end", phase=kind, seconds=round(time.perf_counter() - start, 3), **fields)


def cache(hit: bool, cache_name: str, key: str, nbytes: int | None = None) -> None:
emit("cache.hit" if hit else "cache.miss", cache=cache_name, key=key, bytes=nbytes)
75 changes: 75 additions & 0 deletions models/demos/deepseek_v3_d_p/reference/deepseek_v41/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# DeepSeek-V4.1-Flash reference: CPU-runnable

This directory holds a vendored copy of the DeepSeek-V4.1-Flash reference inference code. The upstream tilelang/CUDA kernels are replaced by torch ports, so the model runs on CPU with `world_size=1` and without initializing `torch.distributed`.

## Provenance

- Upstream: <https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash>, revision
`dba1be0a40aa45a94ad051997016db3960a90277`, directory `inference/`.
- License: MIT (upstream `LICENSE`: "Copyright (c) 2023 DeepSeek"). The vendored files carry that notice as an SPDX header.

| File | Origin |
|---|---|
| `model.py` | upstream `inference/model.py` (deviations below) |
| `engram.py` | upstream `inference/engram.py` (provenance comment only) |
| `vision.py` | upstream `inference/vision.py` (provenance comment only) |
| `image_processor.py` | upstream `inference/image_processor.py` (provenance comment only) |
| `config.json` | upstream `inference/config.json`, unchanged (the released model config) |
| `kernel_cpu.py` | new (Tenstorrent, Apache-2.0): torch ports of upstream `inference/kernel.py` |
| `testing.py` | new (Tenstorrent, Apache-2.0): small config, stub tokenizer, seeded weight init, prefill helper |
| `oracle.py` | new (Tenstorrent, Apache-2.0): cached expected results (block captures, shared and final state, chunk contract) for real-dims layer subsets, synthetic or checkpoint weights |
| `__init__.py` | new, empty |

Upstream files that are not vendored: `kernel.py` (tilelang, replaced by `kernel_cpu.py`), `generate.py`, `convert.py`, `run.sh`, `requirements.txt`, and `examples/`.

## Deviations from upstream (complete list)

1. Each vendored `.py` file begins with a 2-line SPDX header naming the upstream copyright and MIT license, then a provenance comment block (3 lines, plus a blank line) that points to this README. `model.py` also carries `# isort: skip_file` and `# fmt: off` (9 header lines in total), because the repository's black and isort pre-commit hooks would otherwise reflow upstream code (assert wrapping, import order). The other vendored files are already stable under those hooks.
2. `model.py`: four import statements are changed. Everything else is byte-identical to upstream. Check with `diff <(tail -n +10 model.py) <upstream>/inference/model.py`; for the other files, use `tail -n +7`.
- `from engram import ...` becomes `from .engram import ...`. The same change applies to `image_processor` and `vision`. Rationale: package-relative imports.
- `from kernel import (...)` becomes `from .kernel_cpu import (...)`. Rationale: CPU kernels. The imported names and signatures are the same.

No other change was needed to run on CPU. `Transformer.__init__` already sets `world_size = 1` when `torch.distributed` is not initialized, and every `dist.*` call is guarded by `world_size > 1`.

## Running it

Follow upstream `generate.py`: construct the model and run it under `torch.set_default_dtype(torch.bfloat16)`, or use the `set_dtype(torch.bfloat16)` context manager from `model.py`. Two contracts depend on this:
- `fp8_gemm` and `fp4_gemm` return the default dtype.
- `act_quant` and `fp4_act_quant` take bf16 input only, like the tilelang kernels (`in_dtype=BF16`).

`testing.py` wraps this in the following helpers:

```python
from models.demos.deepseek_v3_d_p.reference.deepseek_v41.testing import build_small_model, prefill
model = build_small_model(seed=0) # 6 backbone layers (all six block types) + 1 DSpark layer
logits, main_hidden = prefill(model, input_ids) # start_pos 0 forward + DSpark window-cache seeding
```

`SmallScheduleConfig` puts one layer of each block type on the schedule, in this order: SWA_ONLY, KV_INDEX_SOURCE (ratio 2), CONSUMER_RATIO2, CANDIDATE_SOURCE (ratio 1), CONSUMER_RATIO1, CANDIDATE_INDEX_SOURCE. The block types are the canonical ones from `DeepSeekV41FlashConfig.block_type`. Engram runs on layers 0 (SWA) and 1 (KV source).

Weights are stored in checkpoint dtypes:
- dense weights: FP8 e4m3 with E8M0 32x32 block scales
- routed experts: FP4 `float4_e2m1fn_x2` with E8M0 per-32 scales
- Engram tables: FP8 with E8M0 per-32 row scales

The Engram hash needs a compressed token map. `StubTokenizer` supplies one without a real tokenizer.

The upstream code has module-level state: `world_size`, `default_dtype`, and the `shared_attn` runtime. So, as upstream says, run one model at a time per process. Layers run in order, and each prefill at start_pos 0 rewrites every shared slot before it is read.

## Kernel port fidelity (`kernel_cpu.py`)

| Function | Fidelity to tilelang | Notes |
|---|---|---|
| `act_quant` | bit-exact | per-block amax floored at 1e-4. With `scale_fmt`, the scale is `2^ceil(log2(amax * fp32(1/448)))` via the same exponent-bit trick; otherwise it is `amax * fp32(1/448)`. Values are clamped to ±448, then cast with RNE to e4m3. Inplace mode does QDQ back to bf16 |
| `fp4_act_quant` | bit-exact | E8M0 path: per-32 groups, amax floored at 6·2^-126, power-of-2 scale. E4M3 path: groups of 16, amax floored at 6·2^-9, scale is `e4m3(amax/6)`. E2M1 cast is RNE with ties to the even code. Packing puts the even element in the low nibble, matching upstream `convert.py` |
| `fp8_gemm`, `fp4_gemm` | exact block products; summation order within a block differs | Each K block (32) is summed in fp32, scaled by `a_s * b_s`, then accumulated in K order, as the kernel does. Only the order within a block differs from the tensor-core MMA, so rare 1 bf16-ulp output differences are possible |
| `sparse_attn` | same algorithm; GEMM order and `exp` differ | Online softmax over blocks of 64 indices. The running max starts at -1e30, so rows where every index is -1 give zeros. Index -1 gets logit -inf and a zeroed row. The fp32 sum of probabilities feeds the denominator; probabilities are cast to bf16 before PV. The sink is added unscaled. Output is bf16. Expected difference: about 1 bf16 ulp of the output |
| `hc_split_sinkhorn` | same fp32 operation order | Only `exp`/`sigmoid` may differ in the last fp32 ulp |

Tests: `models/demos/deepseek_v3_d_p/tests/v41/torch/test_v41_kernels_cpu.py` checks the kernels against hand cases and independent formulations. `test_v41_reference_cpu.py` runs the small-model prefill smoke test.

## Upstream behaviors worth knowing (not changed)

- `Indexer.forward` calls `topk(..., sorted=False)`. How it breaks ties among equal scores is implementation-defined, so CPU and CUDA can choose different positions when scores tie exactly (for example, all-zero relu scores).
- `image_processor.prepare_vl_inputs` imports `encoding` lazily. That module is not in upstream `inference/`, so tests build `ImageInput` directly.
- The `__main__` self-test in `model.py` targets CUDA and is not used here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: © 2026 Tenstorrent USA, Inc.

# SPDX-License-Identifier: Apache-2.0
66 changes: 66 additions & 0 deletions models/demos/deepseek_v3_d_p/reference/deepseek_v41/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"vocab_size": 129280,
"dim": 5120,
"moe_inter_dim": 2304,
"n_layers": 40,
"n_mtp_layers": 3,
"dspark_block_size": 5,
"dspark_noise_token_id": 128799,
"dspark_target_layer_ids": [37, 38, 39],
"dspark_markov_rank": 256,
"dspark_n_routed_experts": 128,
"dspark_n_activated_experts": 3,
"n_heads": 64,
"n_routed_experts": 384,
"n_shared_experts": 1,
"n_activated_experts": 6,
"score_func": "sqrtsoftplus",
"route_scale": 1.5,
"swiglu_limit": 10.0,
"q_lora_rank": 1280,
"head_dim": 512,
"rope_head_dim": 64,
"norm_eps": 1e-20,
"o_groups": 8,
"o_lora_rank": 1024,
"window_size": 128,
"kv_source_layers": [2, 8, 14, 20],
"index_source_layers": [2, 8, 14, 20, 24, 28, 32, 36],
"original_seq_len": 65536,
"rope_theta": 10000,
"rope_factor": 16,
"beta_fast": 32,
"beta_slow": 1,
"index_n_heads": 32,
"index_head_dim": 128,
"index_topk": 512,
"candidate_source_layer": 20,
"candidate_topk_blocks": 2048,
"candidate_block_size": 8,
"hc_mult": 4,
"hc_sinkhorn_iters": 20,
"hc_eps": 1e-06,
"engram_layer_ids": [1, 14],
"engram_vocab_size": 16000000,
"engram_num_embeddings": [384006168, 384016682],
"engram_max_ngram_size": 4,
"engram_pad_id": 2,
"engram_compressed_vocab_size": 99092,
"dtype": "fp8",
"expert_dtype": "fp4",
"compress_rope_theta": 160000,
"compress_ratios": [0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
"vision_n_layers": 32,
"vision_dim": 1024,
"vision_n_heads": 16,
"vision_inter_dim": 2816,
"vision_patch_size": 14,
"vision_downsample_ratio": 3,
"vision_max_n_token": 1024,
"vision_min_pixels": 295936,
"vision_max_wh_ratio": null,
"image_token_id": 129264,
"engram_n_heads": 8,
"engram_head_dim": 256,
"vision_rope_theta": 10000
}
Loading