Skip to content

test(core): use a buffered descriptor for direct IO comparison - #9

Merged
bertholomus merged 1 commit into
bertholomus:deepseek-v41-zigfrom
sayyidfareed:test/direct-io-buffered-reference
Oct 12, 2026
Merged

bertholomus merged 1 commit into
bertholomus:deepseek-v41-zigfrom
sayyidfareed:test/direct-io-buffered-reference

Conversation

@sayyidfareed

@sayyidfareed sayyidfareed commented Oct 11, 2026 •

Copy link
Copy Markdown

What this changes

The buffered reference was opened with File.open (O_DIRECT) and then plain.direct was set false. That flag does not clear O_DIRECT on the fd; raw pread of one unaligned byte returns -1. Open the reference explicitly O_RDONLY|O_CLOEXEC, check it opened, and close it normally. All original byte comparisons and BufferTooSmall assertions remain. No production code, read alignment, or serving behavior changes.

Receipt

  • Environment: native base 4e80f05ecba89a4e90d16375ade2eddbdc0a10c4, Zig 0.17.0, Ubuntu 24.04.5 LTS, kernel 7.0.0-1019-nvidia, NVIDIA driver 580.178.04; Linux ARM64 CUDA environment; two NVIDIA GB10 nodes for historical live tests, SM121, Mia EXL3 2.9 bpw revision 64ba41b6c916a587db06eae2e19b7845f7be6e6b, recipe v0.6.1 kit. Container ARM64 image sha256:1ad8c1382c09861dee9c342b59f6e5e3e65fe7fde4a07b5e379bc985b66902dd.
  • Exact standalone source tested: 4e665c646a28b8c93903f93ebe6a934d6f61b157; command zig build test -j1 --summary all with a shared Zig cache.
  • Host result: Build Summary: 19/19 steps succeeded; 123/123 tests passed. Cached groups are additional; this count is executed tests, not an invented full-suite total.
  • Direct-I/O isolated regression: before 2 passed/1 failed; after 3/3 passed. Product functions are byte-identical. The full suite on this exact standalone commit passed; cached groups are identified by the build output.
  • Lean checker: pinned baseline 1,420 findings; this branch 1420; zero new findings. Existing oversized family modules are inherited. zig fmt --check passes changed Zig files.
  • The direct-I/O test failure is fixed here.
  • Exactness: not applicable to product output: only an existing test changes.
  • Decode/prefill: not applicable to this test-only change.
  • Not run: Metal M1–M5 and a clean-machine release installation. test-golden was attempted on the pinned source but that step does not exist, despite CONTRIBUTING.md naming it.
  • Public recipe and evidence and qualification limits. Ready for test-only review.

Checklist

  • Every token still goes through lane rounds; no serial bypass (test-only N/A where applicable).
  • Drafted equals plain, resumed equals fresh, concurrent equals solo (test-only N/A).
  • No precision reduction is introduced; any unverified output equivalence is disclosed above.
  • Prompt processing is no slower than the last release (test-only N/A).
  • Tested and untested platforms are named.
  • Red/green regression evidence is available; other missing device gates remain disclosed.
  • Added comments are single lines; measurements/history remain in receipts.
  • Outgoing commits use the public GitHub noreply identity; no private hosts, paths, credentials or tool attribution.

Merge considerations

Two-way revert; no live/runtime effect.

@bertholomus

Copy link
Copy Markdown
Owner

Thank you @sayyidfareed — merged. ELI5: the test's "buffered" reference was still opened for direct I/O — flipping the in-process flag doesn't clear O_DIRECT — so one unaligned byte failed the read and the comparison lied. Opening a genuinely buffered descriptor fixes it; nothing else changes (test-only). Verified here: zig build test green on Zig 0.17.0 x86_64, and the head SHA matches your receipt.

bertholomus added a commit that referenced this pull request Oct 20, 2026
…ything new (tp2 #18)

--loop-guard watched only for an exact cycle of at most eight tokens. A templated reasoning loop, each line fresh
while its token 8-grams recycle, has no such cycle: @Capicua25x saw the guard fire 0 times on 6 such runaways in
production traffic (tp2 #18). The guard now also counts, in windows of 1,024 reply tokens while the think block is
open, the share of the window's token 8-grams (with the 7 tokens before it) that no earlier window had; that many
windows in a row under 2% close the think block the way a cycle does. This is our Python engine's
call_gate.ThinkLoop (the novelty signal of tp2 #9, on token ids), next to cycleAt, which stays the first check.

- TENSORFOLD_LOOP_WINDOWS: the dry windows in a row (default 10; 0: exact cycles only). Python's 3 cut a legitimate
  long deliberation in @Capicua25x's traffic; 10 still caught every runaway they captured.
- runtime.loop.novelty: the closing window's share of new grams; the server log says loop=novelty:0.0000.
- Without --loop-guard nothing changes. With it, a reply with an exact cycle closes as before and reports
  runtime.loop.period; only a reply the cycle check misses can close earlier.
- loopCut finds the window end in a round's tokens, so drafted rounds close where single tokens do. As in
  ThinkLoop.cut, only a batch's first window end may fire (rounds are far shorter than a window).

Tests: each window's share equals the Python reference's (a loop of 13, and a three-letter LCG text over 60
windows); the fire points equal the reference's on four sequences at 3 and 10 windows, a token at a time and in
rounds of 7 and 48; a loop of 13 closes thinking through the lane engine, drafted equal to plain.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 94725fbbf0cb834343e6e6f5f23307a7f4f37bfb)
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.

2 participants