Skip to content

test(backend-cpu): golden parity gate for packed encodings + golden-parity CI leg (SKEEP-003 S0.9) - #1049

Merged
michalharakal merged 1 commit into
developfrom
feature/1005-parity-gate
Aug 22, 2026
Merged

michalharakal merged 1 commit into
developfrom
feature/1005-parity-gate

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

Summary

SKEEP-003 slice S0.9 (milestone M0 #1001): the packed-encoding golden parity gate that every later memory-architecture slice must keep green.

  • Bit-identical goldens (skainet-backends/skainet-backend-cpu/src/goldenTest/, compiled into jvmTest and the Kotlin/Native test targets): PackedDecodeGoldenTest (block decoders of Q4_0 / Q5_0 / Q5_1 / Q8_0 / Q4_K / Q5_K / Q6_K, ternary from values and from a TQ2_0 block), ScalarKernelGoldenTest (the seven scalar reference matmul kernels), TurboQuantGoldenTest (codes, scales, decoded vector; polar-3/4, polar-4+QJL). Seeded inputs (xorshift64*, sane FP16 scales), FNV-64 digest over the raw float bits + head values recorded in Goldens.kt (26 digests). Verified identical on JVM and linuxX64. JS/Wasm are excluded by construction (double-precision Float).
  • Dispatch parity (commonTest, every target): PackedMatmulDispatchParityTest — all seven encodings through ops.matmul(x, ops.transpose(w)) vs an FP32 reference from the decoded weight, 5e-3 relative (SIMD / Q8-activation tiers, Q4_K/Q6_K parity tests compare the ggml-faithful int8 (block_q8_K) native kernels against exact-float scalar references — divergence is intended activation-quant loss, not a bug #944). Fills the Q4_0/Q8_0/Q5_0/Q5_K gaps of the existing PackedMatmulDispatchTest.
  • CI: new build.yml matrix leg golden-parity = apiCheck + the golden/parity tests on jvm + linuxX64 (a few minutes, fails early). apiCheck was required by the contributing docs but never run in CI.
  • scripts/pr-gate.sh --golden mode; contributing docs section (build-from-source.adoc) on the gate and how to re-baseline intentionally.

A benchmark baseline table (StorageBenchmarks + JMH matmul/elementwise/reductions, this machine) follows as a docs-only commit under docs/design/memory/ once the run finishes — it is informational, no code change.

Re-baselining Goldens.kt is a deliberate act: only in a PR that intentionally changes decoder/kernel numerics, stated in the PR.

Test plan

Full local gate on b7573a5 (JDK 25): jvmTest ✔ · apiCheck ✔ · verifyNpmPins jsTest wasmJsTest wasmWasiTest ✔ · linuxX64Test ✔ · assemble ✔ · :skainet-test:skainet-test-java:test ✔. Golden tests: 26/26 on JVM, 26/26 on linuxX64; parity 7/7 on every target. New CI leg visible in this PR's checks.

Closes #1005

🤖 Generated with Claude Code

…tical decode/kernel/TurboQuant digests, dispatch parity, CI leg (SKEEP-003 S0.9)

Guards the packed-encoding system bit-for-bit across the SKEEP-003 migration
(milestone M0, #1001):

- goldenTest source set (compiled into jvmTest and the Kotlin/Native test
  targets): PackedDecodeGoldenTest (Q4_0, Q5_0, Q5_1, Q8_0, Q4_K, Q5_K, Q6_K
  block decoders; ternary from values and from a TQ2_0 block),
  ScalarKernelGoldenTest (the seven scalar reference matmul kernels),
  TurboQuantGoldenTest (codes, scales, decoded vector for polar-3/4 and
  polar-4 + QJL). Seeded inputs (xorshift64*), FNV-64 digest over raw float
  bits plus head values, recorded in Goldens.kt; verified identical on JVM
  and linuxX64. JS/Wasm are excluded by construction (double-precision Float).
- commonTest PackedMatmulDispatchParityTest (every target): all seven
  encodings through ops.matmul(x, ops.transpose(w)) vs an FP32 reference
  from the decoded weight, 5e-3 relative (SIMD / Q8-activation tiers, #944).
- CI: new build.yml matrix leg `golden-parity` = apiCheck + the golden and
  parity tests on jvm + linuxX64 (apiCheck was required by the contributing
  docs but never run in CI).
- scripts/pr-gate.sh --golden mode; contributing docs section on the gate.

Closes #1005

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-1049 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

@michalharakal
michalharakal requested a review from aharakal August 22, 2026 18:24
@michalharakal
michalharakal merged commit df5de63 into develop Aug 22, 2026
18 checks passed
@michalharakal
michalharakal deleted the feature/1005-parity-gate branch August 22, 2026 18:39
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.

[S0.9] Golden parity gate + PR gate script + benchmark baseline (guards every memory-architecture slice)

2 participants