Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b160bcd
DeepSeek V4.1 Flash: configuration, Engram tables and resident weight…
akol1 Oct 13, 2026
c53616f
DeepSeek V4.1 Flash: Metal operators with fp64-dot references and the…
akol1 Oct 13, 2026
4e68261
THIRD_PARTY_NOTICES: the native DS4.1 reference follows DeepSeek-V4.1…
akol1 Oct 13, 2026
74b7541
DeepSeek V4.1 load: the router gate and bias ride the pack's dtypes
akol1 Oct 13, 2026
86b6eec
DeepSeek V4.1 load: the Engram gate weights ride f32 or bf16
akol1 Oct 13, 2026
611a130
DeepSeek V4.1: the kept-dense EXL3 form, for rank-split repacks
akol1 Oct 13, 2026
d20aea6
DeepSeek V4.1 reference: the kept-dense apply
akol1 Oct 13, 2026
c349413
DeepSeek V4.1: the rebase residue — one counters binding, the state-w…
akol1 Oct 14, 2026
6ad76e1
mHC fp64 ideal reference: the mix at rounding level, 1-ULP noise atte…
akol1 Oct 14, 2026
943d93f
CSA2 reference: FP64-ideal parameterization of the pool, RMS and spar…
akol1 Oct 14, 2026
1cf442a
csa2: FP64 stage harness, compressor pool + RMS, six adversarial inpu…
akol1 Oct 14, 2026
630f5d2
csa2: FP64 stage harness over the sparse attention kernel, with kerne…
akol1 Oct 14, 2026
0be1833
csa2: indexer stage harness — FP32/FP64 score comparison and top-k se…
akol1 Oct 14, 2026
2e56ff2
csa2: indexer stage receipts — carry the BF16 einsum/score boundaries…
akol1 Oct 14, 2026
79e59ac
csa2: sparse stage reads its own FP32 rounding level before the BF16 …
akol1 Oct 14, 2026
bba3e7d
csa2: per-stage harnesses for sinks, tile denominators, output mix an…
akol1 Oct 14, 2026
5c27e3d
csa2: measure how much score noise the top-k selection absorbs
akol1 Oct 14, 2026
2f9e506
The fp64 harness ports: dedupe the shared math helpers, fix the shard…
akol1 Oct 14, 2026
ffc7028
The oracle records the indexer's selection margins while it teaches
akol1 Oct 14, 2026
6e2a7ce
The indexer-margin capture at depth: one diagnostic token's selection…
akol1 Oct 14, 2026
f5c483e
the operator harnesses through zig fmt
akol1 Oct 14, 2026
8f63e8d
DeepSeek V4.1: the sparse output accumulates each 64-column tile in c…
akol1 Oct 14, 2026
8bfdf68
The dense EXL3 apply accumulates its dot as a hi/lo FP32 pair
akol1 Oct 15, 2026
efed9c1
DeepSeek V4.1: the token map ships its table generator and its unit t…
akol1 Oct 18, 2026
ec57308
DeepSeek V4.1: the family's comments on one line each, within the 120…
akol1 Oct 18, 2026
43b4ee8
DeepSeek V4.1 reference: the operator harnesses split at their seams
akol1 Oct 18, 2026
28f8dc7
DeepSeek V4.1: the reference and Metal comments on one line each
akol1 Oct 18, 2026
a9badee
DeepSeek V4.1 reference: fp64 tests for the Engram hash, gather and gate
akol1 Oct 19, 2026
32dc75a
DeepSeek V4.1 reference: hold the Engram gate to the registered kerne…
akol1 Oct 19, 2026
46a2fb3
DeepSeek V4.1 reference: the index tie fixture broadcasts row 0 into …
akol1 Oct 21, 2026
2485c13
test(contract): DeepSeek V4.1 sparse attention through the Metal kern…
akol1 Oct 21, 2026
14db390
Pass the span metadata the counter recorder now requires
akol1 Oct 21, 2026
e740bf0
Rebase the precision line onto 1.1.2
akol1 Oct 21, 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
Prev Previous commit
Next Next commit
the operator harnesses through zig fmt
  • Loading branch information
akol1 committed Oct 21, 2026
commit f5c483e5899ee43fd398716ae87fc6c94579babc
11 changes: 8 additions & 3 deletions zig/tests/deepseek_v41_reference/attention_math.zig
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ pub const State = struct {
try projection.applyF32(compressor.wkv, x, &self.partial_kv[owner][slot], scratch);
try projection.applyF32(compressor.wgate.?, x, &self.partial_gate[owner][slot], scratch);
if ((position + 1) % ratio != 0) return false;
poolOf(f32, .{ &self.partial_kv[owner][0], &self.partial_kv[owner][1] },
.{ &self.partial_gate[owner][0], &self.partial_gate[owner][1] }, &self.latent);
poolOf(f32, .{ &self.partial_kv[owner][0], &self.partial_kv[owner][1] }, .{ &self.partial_gate[owner][0], &self.partial_gate[owner][1] }, &self.latent);
}
m.rms(&self.latent, compressor.norm, c.rms_norm_eps, &self.latent);
const indexer = a.indexer.?;
Expand Down Expand Up @@ -373,7 +372,13 @@ pub fn sparseHeadOf(comptime T: type, q: []const u16, keys: KeyTable, indices: [
/// The same head, with `pre` optionally capturing acc/denominator before the output rounding: the
/// same values in FP32 versus FP64 then differ only by the stage's arithmetic, so their ULP distance
/// is the stage's true rounding level instead of the BF16 output quantum that hides it.
pub fn sparseHeadPre(comptime T: type, q: []const u16, keys: KeyTable, indices: []const i32, sink: f32, out: []u16,
pub fn sparseHeadPre(
comptime T: type,
q: []const u16,
keys: KeyTable,
indices: []const i32,
sink: f32,
out: []u16,
pre: ?[]T,
) void {
@setFloatMode(.strict);
Expand Down
2 changes: 0 additions & 2 deletions zig/tests/deepseek_v41_reference/math.zig
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,11 @@ pub fn rms(x: []const u16, weight: Tensor, eps: f32, out: []u16) void {
rmsOf(f32, x, weight, eps, out);
}
/// Element type widened to the reference precision; FP32 is the source contract, FP64 the ideal.

/// FP64 decode of a BF16 cell, exact at both reference precisions.
pub fn d64(x: u16) f64 {
return @as(f64, f(x));
}
/// Round an FP64 value once to BF16 (round-to-nearest-even) with no intermediate FP32 rounding.

/// The RMS boundary at reference precision T: the source-contract FP32 mean projection for f32,
/// a wide FP64 mean, exact division and reciprocal square root for f64.
pub fn rmsOf(comptime T: type, x: []const u16, weight: Tensor, eps: f32, out: []u16) void {
Expand Down
Loading