Skip to content

Require numerical proof for DeepSeek PTO kernels - #157

Merged
zhoubot merged 2 commits into
mainfrom
codex/pto-full-verification
Jul 21, 2026
Merged

Require numerical proof for DeepSeek PTO kernels#157
zhoubot merged 2 commits into
mainfrom
codex/pto-full-verification

Conversation

@zhoubot

@zhoubot zhoubot commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Verification

  • clean LLVM clang/lld/llc build and f16/bf16 memory FileCheck
  • 6/6 PTO host CTests
  • 43/43 DeepSeek APIs declared, implemented, QEMU-invoked, and oracle-annotated
  • 32/32 DeepSeek kernel-reachable PTO operations catalog-mapped, QEMU-backed, and LLVM-emitted
  • QEMU deepseek_tilekernels, pto_parity, and tile suites pass
  • runtime evidence observes all five DeepSeek family IDs and 1,341 executed-PC hits

The frozen v0.57 catalog contains 111 operations. This PR claims complete verification of the DeepSeek kernel-reachable 32-operation surface, not 111/111 executable semantics.

LinxISA Automation added 2 commits July 21, 2026 12:18
The DeepSeek benchmark surface now uses scalar-reference and invariant oracles instead of presence-only smoke checks. Pin the PTO and LLVM revisions that add machine-readable coverage accounting, host quantization oracles, current tile memory wrappers, and legal narrow floating memory lowering.

Constraint: Verification scope is the 43 public DeepSeek APIs and 32 kernel-reachable PTO operations within the frozen 111-operation v0.57 catalog; pyCircuit and LinxCore remain outside this closure.

Rejected: Treat declaration or assembly presence as executable semantic coverage | it does not prove numerical behavior.

Confidence: high

Scope-risk: moderate

Directive: Do not report 32/32 kernel-reachable coverage as 111/111 catalog semantic coverage.

Tested: clean LLVM clang/lld/llc build and f16-bf16-memory FileCheck; clean PTO 6/6 host CTests; DeepSeek 43/43 API and 32/32 reachable-op contracts; clean QEMU deepseek_tilekernels, pto_parity, and tile suites.

Not-tested: repository-wide attention catalog requiring unsupported custom launch/vector-spill lowering; pre-existing v057-tile-phi-edge-tmov ambiguous-join test.
The PTO and LLVM changes were squash-merged upstream, so repoint the superproject from the obsolete topic commits to the corresponding main revisions. The merged and topic revisions have identical Git trees.

Constraint: pyCircuit and LinxCore remain outside this closure and are not repinned.

Rejected: Retain topic-branch gitlinks | squash merge rewrote both commit identities.

Confidence: high

Scope-risk: narrow

Directive: Preserve the 43-API and 32 kernel-reachable operation verification denominator when interpreting this closure.

Tested: merged-vs-topic Git tree identity; 6/6 PTO host CTests; 43/43 API and 32/32 reachable-operation assembly contracts.

Not-tested: full 111-operation executable semantics and repository-wide attention catalog lowering.
@zhoubot
zhoubot requested review from a team as code owners July 21, 2026 06:02

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds comprehensive test coverage and oracle verification assertions for various DeepSeek tile kernels (including MoE, quantization, engram, and MHC) in 17_deepseek_tilekernels.cpp, alongside updating the compiler/llvm and workloads/pto_kernels submodules. The review feedback identifies a type and stride mismatch in the deepseek_engram_hash_i32 test, where an int64_t array is cast and processed as 32-bit elements, which reduces test coverage. A suggestion is provided to use a 32-bit integer array instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines 372 to +376
deepseek_engram_hash_i32(i1, l0, kElements, 1, kCols,
0x12345678u);
for (int i = 0; i < kElements; ++i)
const uint32_t *hash_input = reinterpret_cast<const uint32_t *>(l0);
for (int i = 0; i < kElements; ++i) {
uint32_t expected = hash_input[i] ^ 0x12345678u;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

There is a type and stride mismatch between the test input l0 and the oracle verification for deepseek_engram_hash_i32.

l0 is defined as an int64_t array and initialized with 64-bit values (l0[i] = static_cast<int64_t>(i + 1)). However, the oracle casts l0 to const uint32_t * and hashes it as 32-bit elements.

On little-endian systems, this means that for every odd index i, hash_input[i] reads the upper 32 bits of l0[i/2], which is always 0. This significantly reduces the test coverage (half of the inputs are 0) and indicates that deepseek_engram_hash_i32 is likely designed to process 32-bit integers (int32_t / uint32_t).

To fix this and ensure proper test coverage, we should pass a 32-bit integer array (such as i0, which is already initialized with i % kCols) instead of l0.

Suggested change
deepseek_engram_hash_i32(i1, l0, kElements, 1, kCols,
0x12345678u);
for (int i = 0; i < kElements; ++i)
const uint32_t *hash_input = reinterpret_cast<const uint32_t *>(l0);
for (int i = 0; i < kElements; ++i) {
uint32_t expected = hash_input[i] ^ 0x12345678u;
deepseek_engram_hash_i32(i1, reinterpret_cast<const int64_t *>(i0), kElements, 1, kCols,
0x12345678u);
for (int i = 0; i < kElements; ++i) {
uint32_t expected = static_cast<uint32_t>(i0[i]) ^ 0x12345678u;

@zhoubot
zhoubot merged commit 3b50632 into main Jul 21, 2026
5 checks passed
@zhoubot
zhoubot deleted the codex/pto-full-verification branch July 21, 2026 06:07
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.

1 participant