Skip to content

test(paged): poisoned-write probe so trivial splitkv equality cannot pass - #17

Merged
holtwood merged 1 commit into
masterfrom
tllm-splitkv-layer-probe
Sep 15, 2026
Merged

holtwood merged 1 commit into
masterfrom
tllm-splitkv-layer-probe

Conversation

@holtwood

Copy link
Copy Markdown
Member

Summary

PR #16 修复 attn_partial 未分配后,layer 级门禁 SplitKvLegacyAndDirectAgreeBitwiseAtSameSplits 仍有一个结构性缺陷:它只比较 legacy/direct 两条同样会静默空转的路径(partial_workspace == nullptr → 两条 splitkv 入口都静默 return),"逐位相等"可以来自"两条路径同样坏"。

本 PR 加固 layer 级测试,不再依赖路径间互相印证:

  • 新增 SplitKvEntryActuallyWritesPartials:先毒化 attn_partial(-12345.25f 哨兵,fp32 独占值)与 attn_buf(7.0),各跑 legacy/direct × {2,4} splitkv decode,断言已用 partial 槽位与 combine 输出被真实覆写——kernel 空转则显式失败
  • 收紧 SplitKvChangesNumericsOnlyVersusSinglePass:5% 相对容差 → 2e-3 绝对容差(benchmark 等价记录实测 max|diff| ≈ 6e-5);旧容差宽到能吸收 attn_buf 陈旧读的差异

Mutation check(核心证据)

将 src/transformer.cpp 回退到分配修复前(acb91ef)重跑:

用例 修复前 修复后
SplitKvEntryActuallyWritesPartials ❌ FAILED(attn_partial == nullptr 探针触发) ✅
SplitKvChangesNumericsOnlySlightlyVersusSinglePass ❌ FAILED(2e-3 抓住陈旧读) ✅
SplitKvLegacyAndDirectAgreeBitwiseAtSameSplits ✅(仍为平凡相等——现已由探针用例兜底) ✅

Test plan

  • PagedDispatchTest* 14/14 通过(修复后代码)
  • 全量 241 tests passed
  • clang-format-19 clean

Generated with Devin

…pass

SplitKvLegacyAndDirectAgreeBitwiseAtSameSplits compared two paths that
both silently no-op when attn_partial is null, so the bitwise gate was
vacuous while the allocation was missing (fixed in 1d772e1). Add
SplitKvEntryActuallyWritesPartials: poison attn_partial + attn_buf,
run each splitkv entry, and assert the used partial slots and the
combine output were overwritten. Also tighten
SplitKvChangesNumericsOnlySlightlyVersusSinglePass from a 5% relative
tolerance to 2e-3 absolute — the loose bound absorbed the stale-read
delta, letting the no-op state pass.

Mutation check against pre-fix transformer.cpp: both gates go red.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@holtwood
holtwood merged commit f3d1f5b into master Sep 15, 2026
2 checks passed
@holtwood
holtwood deleted the tllm-splitkv-layer-probe branch September 16, 2026 06:20
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