Skip to content

build: guards for SKEEP-003's acceptance criteria (#1501) - #1509

Open
michalharakal wants to merge 3 commits into
developfrom
feature/1501-skeep-003-acceptance-guards
Open

michalharakal wants to merge 3 commits into
developfrom
feature/1501-skeep-003-acceptance-guards

Conversation

@michalharakal

@michalharakal michalharakal commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1501. Part of #932.

Stacked on #1508 (the docs close-out): until that merges, this PR also shows its commit. Review the second commit.

Three of SKEEP-003's five acceptance criteria had no test or guard.

  • Downcast guard. ./gradlew checkTensorDataDowncasts scans production sources outside tensor/data, tensor/storage and lang/memory for is / !is / as / as? whose target is a …TensorData class or a storage marker (PackedBlockStorage, RowDequantSource, the MemorySegment markers). The count per file has to equal config/tensor-data-downcast-allowlist.txt, the same rule as checkUnmarkedStubs: a new downcast fails, and a removed one fails until the entry is lowered. Today: 162 downcasts in 21 files (DefaultCpuOps.kt 51, DefaultCpuOpsJvm.kt 48, AccelerateCpuOps.kt 18, WasmCpuOps.kt 10, QuantizedMatmul.kt 9, the rest 1–3 each). It runs in the existing stub-markers CI leg. This changes no behaviour; it makes the migration in SKEEP-003: dispatch on Format instead of TensorData downcasts, loaders return views, TensorData as true façades #1507 measurable.
  • Flat memory under a forward scope. ForwardScopeFlatMemoryTest (JVM) runs 300 steps of matmul, add and relu at 512 × 512 with reset() at each step boundary. After 20 warm-up steps it asserts that the direct buffer pool grows by less than one step's activations, the live heap after a collection by less than a tenth of what a leak of every activation would be (about 840 MB), and the slab peak not at all. Measured here: no growth in any of the three. RSS is printed, not asserted: it failed on a CI runner without a leak, because a JVM commits heap lazily.
  • Benchmark baseline. reference/benchmark-baseline.adoc holds the JMH numbers for MatmulBench, KernelMatmulBench, QuantizedMatmulBench, ElementwiseAdd1MBench and Reductions1MBench at develop 0.64.0, with how to compare. scripts/pr-gate.sh --bench referred to a baseline that docs: describe the memory model as built, and fold the loose files into Antora #1106 had deleted and now points at this page.

One observation from the baseline, not addressed here: on Linux, MatmulBench with blasEnabled=true is about seven times slower than the Panama kernel (8.5 ms against 1.3 ms at 256). BLAS routing is off by default outside macOS.

🤖 Generated with Claude Code

michalharakal and others added 2 commits November 11, 2026 14:20
An audit at 0.64.0 found the old storage layer still in place beside
the new one. The SKEEP goes back to Accepted and gains a status table
per acceptance criterion and per open decision, linking the issues
that track them. 003a, SKEEP-002, memory-model.adoc and the
TensorStorage KDoc lose statements that later work made untrue.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
checkTensorDataDowncasts counts downcasts to concrete TensorData
classes outside the data package against an allowlist that has to
match the code exactly: 162 sites in 21 files today. It runs in the
stub-markers CI leg.

ForwardScopeFlatMemoryTest runs 300 forward passes under a forward
scope on the JVM and asserts that direct memory, RSS and the slab
stay flat.

reference/benchmark-baseline.adoc records the JMH numbers a dispatch
or storage change is compared against; scripts/pr-gate.sh points at it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-1509 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

…ryTest (#1501)

RSS grew past the bound on a CI runner although nothing leaked: a JVM
commits heap lazily, so RSS follows garbage that is already dead. The
test now asserts the live heap after a collection and prints RSS.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-1509 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

This branch has not been deployed

No deployments
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.

SKEEP-003 acceptance guards: downcast guard, flat direct-memory test, benchmark baseline

1 participant