Skip to content

Close the DeepSeek TileKernels v0.57 execution path - #155

Merged
zhoubot merged 2 commits into
mainfrom
codex/deepseek-tilekernels-closure
Jul 21, 2026
Merged

Close the DeepSeek TileKernels v0.57 execution path#155
zhoubot merged 2 commits into
mainfrom
codex/deepseek-tilekernels-closure

Conversation

@zhoubot

@zhoubot zhoubot commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

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.

LinxISA Automation added 2 commits July 20, 2026 22:59
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.
@zhoubot
zhoubot requested review from a team as code owners July 21, 2026 01:24

@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 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.

Comment on lines +96 to +98
TEST_ASSERT(deepseek_moe_unique_group_indices_i32(i0, kElements) ==
kElements,
id, 4, 0);

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

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.

Suggested change
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);

Comment on lines +133 to +135
for (int r = 0; r < kRows; ++r)
TEST_ASSERT(f2[r * kCols] > 0.0f, id, 1,
static_cast<uint64_t>(r));

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

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.

Suggested change
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);

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

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.

Suggested change
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);

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

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.

Suggested change
deepseek_mhc_sinkhorn_backward_f32(f3, f1, f2, 1, kCols);
deepseek_mhc_sinkhorn_backward_f32(f3, f1, f2, kRows, kCols);

Comment thread avs/qemu/run_tests.py
Comment on lines +1323 to 1330
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"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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"]

@zhoubot
zhoubot merged commit 304d233 into main Jul 21, 2026
5 checks passed
@zhoubot
zhoubot deleted the codex/deepseek-tilekernels-closure branch July 21, 2026 01:33
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