Close the DeepSeek TileKernels v0.57 execution path - #155
Conversation
Pin the validated LLVM, QEMU, and PTO-Kernel changes and add a standard-input AVS suite that exercises all 43 mapped APIs through architectural tile instructions. Constraint: pyCircuit and LinxCore are explicitly outside this closure. Rejected: Pin all locally modified submodules | unrelated worktrees must remain isolated. Confidence: high Scope-risk: moderate Directive: Do not add pyCircuit or LinxCore to this closure until separately authorized and validated. Tested: PTO host CTests; LLVM lit; DeepSeek Linx assembly contract; QEMU AVS tests 0x1701-0x1705. Not-tested: Repository layout clean-tree gate, blocked by preserved unrelated dirty submodules.
Replace topic-branch gitlinks with the squash-merged LLVM, QEMU, and PTO-Kernel default-branch commits before landing the superproject closure. Constraint: LinxCore and pyCircuit remain outside this closure. Confidence: high Scope-risk: narrow Tested: Leaf PR merge SHAs verified against origin default branches.
There was a problem hiding this comment.
Code Review
This pull request integrates a new test suite, deepseek_tilekernels, to verify DeepSeek tile kernels (including transpose, MoE, quantization, engram, and MHC) under QEMU, alongside updating several subproject dependencies. The review feedback highlights several critical issues in the new C++ test file, such as incorrect assertion expectations for unique group indices, out-of-bounds indexing when accessing per-token quantization scale factors, and hardcoded row dimensions in the Sinkhorn forward and backward test calls. Additionally, merging redundant consecutive conditional blocks in run_tests.py is recommended to improve code maintainability.
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.
| TEST_ASSERT(deepseek_moe_unique_group_indices_i32(i0, kElements) == | ||
| kElements, | ||
| id, 4, 0); |
There was a problem hiding this comment.
The array i0 is initialized with i % kCols (where kCols is 32), meaning there are at most kCols (32) unique values in i0. Therefore, deepseek_moe_unique_group_indices_i32 can return at most kCols (32) unique group indices, not kElements (1024). Expecting kElements will cause this assertion to fail.
| TEST_ASSERT(deepseek_moe_unique_group_indices_i32(i0, kElements) == | |
| kElements, | |
| id, 4, 0); | |
| TEST_ASSERT(deepseek_moe_unique_group_indices_i32(i0, kElements) == | |
| kCols, | |
| id, 4, 0); |
| for (int r = 0; r < kRows; ++r) | ||
| TEST_ASSERT(f2[r * kCols] > 0.0f, id, 1, | ||
| static_cast<uint64_t>(r)); |
There was a problem hiding this comment.
For per-token quantization, the scale factor array f2 contains one scale factor per token (row), resulting in kRows (32) elements. Accessing f2[r * kCols] for r >= 1 will access indices >= 32, which are uninitialized/zero and will cause the assertion to fail. It should be f2[r] instead.
| for (int r = 0; r < kRows; ++r) | |
| TEST_ASSERT(f2[r * kCols] > 0.0f, id, 1, | |
| static_cast<uint64_t>(r)); | |
| for (int r = 0; r < kRows; ++r) | |
| TEST_ASSERT(f2[r] > 0.0f, id, 1, | |
| static_cast<uint64_t>(r)); |
| deepseek_mhc_pre_apply_mix_f32(f2, f0, f1, kRows, 1, kCols); | ||
| deepseek_mhc_pre_big_fuse_f32(f2, f0, f1, kRows, 1, kCols, 0.00001f); | ||
|
|
||
| deepseek_mhc_sinkhorn_f32(f2, f1, 1, kCols, 1); |
There was a problem hiding this comment.
The third parameter of deepseek_mhc_sinkhorn_f32 represents the number of rows (batch size). It is currently hardcoded to 1, but the subsequent assertion loop checks all kRows (32) rows. This will cause the assertions to fail for rows r >= 1 because those rows are not processed and remain zero. Pass kRows instead of 1.
| deepseek_mhc_sinkhorn_f32(f2, f1, 1, kCols, 1); | |
| deepseek_mhc_sinkhorn_f32(f2, f1, kRows, kCols, 1); |
| TEST_ASSERT(absf(sum - 1.0f) < 0.01f, id, 2, | ||
| static_cast<uint64_t>(r)); | ||
| } | ||
| deepseek_mhc_sinkhorn_backward_f32(f3, f1, f2, 1, kCols); |
There was a problem hiding this comment.
The fourth parameter of deepseek_mhc_sinkhorn_backward_f32 represents the number of rows. It should be updated to kRows instead of 1 to match the forward pass and process all rows.
| deepseek_mhc_sinkhorn_backward_f32(f3, f1, f2, 1, kCols); | |
| deepseek_mhc_sinkhorn_backward_f32(f3, f1, f2, kRows, kCols); |
| if any(s in selected for s in ("tile", "pto_parity", "deepseek_tilekernels")): | ||
| # Keep tile-suite bring-up deterministic: SIMT autovec currently | ||
| # triggers a mid-end crash on migrated PTO kernels under strict v0.57. | ||
| common_cflags += ["-mllvm", "-linx-simt-autovec=false"] | ||
| if any(s in selected for s in ("tile", "pto_parity")): | ||
| if any(s in selected for s in ("tile", "pto_parity", "deepseek_tilekernels")): | ||
| # Runtime policy: migrated PTO kernels run in smoke profile under QEMU. | ||
| # Full-profile coverage remains in compile/objdump gates. | ||
| common_cflags += ["-DPTO_QEMU_SMOKE=1"] |
There was a problem hiding this comment.
These two consecutive if statements have the exact same condition. They can be merged into a single if block to avoid redundant checks and improve code readability and maintainability.
| if any(s in selected for s in ("tile", "pto_parity", "deepseek_tilekernels")): | |
| # Keep tile-suite bring-up deterministic: SIMT autovec currently | |
| # triggers a mid-end crash on migrated PTO kernels under strict v0.57. | |
| common_cflags += ["-mllvm", "-linx-simt-autovec=false"] | |
| if any(s in selected for s in ("tile", "pto_parity")): | |
| if any(s in selected for s in ("tile", "pto_parity", "deepseek_tilekernels")): | |
| # Runtime policy: migrated PTO kernels run in smoke profile under QEMU. | |
| # Full-profile coverage remains in compile/objdump gates. | |
| common_cflags += ["-DPTO_QEMU_SMOKE=1"] | |
| if any(s in selected for s in ("tile", "pto_parity", "deepseek_tilekernels")): | |
| # Keep tile-suite bring-up deterministic: SIMT autovec currently | |
| # triggers a mid-end crash on migrated PTO kernels under strict v0.57. | |
| common_cflags += ["-mllvm", "-linx-simt-autovec=false"] | |
| # Runtime policy: migrated PTO kernels run in smoke profile under QEMU. | |
| # Full-profile coverage remains in compile/objdump gates. | |
| common_cflags += ["-DPTO_QEMU_SMOKE=1"] |
Pins the merged LLVM, QEMU, and PTO-Kernel implementations and adds the AVS standard-input suite for the 43 mapped DeepSeek APIs. LinxCore and pyCircuit are explicitly excluded from this closure. Validated with PTO host tests, LLVM lit, five-family assembly contracts, and QEMU AVS tests 0x1701 through 0x1705.