Repository navigation
test(mimo): assert the MiMo contracts that #171 shipped - #211
Merged
Merged
Conversation
Three assertions in the MiMo tests disagree with the code that the same PR (#171) added: - The MiMo cache conforms to CBv2MTPRectangularSerializing, and MiMoV26RectangularVerifyTests asserts that the bank supports rectangular MTP verification. The test asserted the opposite. - CBv2PrefillRequirement.evaluationOnly returns a [B, 1] handle (EngineLoopV2.prefillOutput). The test expected shape [1]. - MiMoV26MTPAssistant conforms to CBv2HistoricalMTPPrefixCheckpointCoding (MiMoV26MTPPrefixCheckpoint). The test asserted that it is not a prefix checkpoint drafter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 1, 2026
This was referenced Oct 3, 2026
Gajesh2007
added a commit
that referenced
this pull request
Oct 4, 2026
#289) * fix(cache): preserve demanded fork checkpoints and bound short capture * test: let expected paged work refusals reach the caller (#209) PagedWorkFixture.prepare wrapped prepareAttentionWork in XCTUnwrap. XCTUnwrap records a test failure when its expression throws, also when the caller expects the throw with XCTAssertThrowsError. Three tests expect prepare to refuse, so each expected refusal was recorded as a failure. prepare now throws the refusal to the caller and fails only when prepareAttentionWork returns nil. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit b7bbdc2) * fix(paged): write a full destination for broadcast direct KV (#210) Materialize broadcast retained KV into a complete contiguous destination while preserving bit values, ownership validation, and reservation bounds. Focused differential paging, lifetime, and bit-exact validation completed during review. (cherry picked from commit 3799b11) * test(mimo): skip native-lane tests on machines without the lane (#192) Since eeba2af (#178), 31 XCTest cases in five MiMo suites throw nativeLaneRequired on the hosted CI runner, so every run of Fork Tests on main fails. The tests need the exclusive native GPU lane, which the runner does not have. This change turns each of those throws into an XCTSkipUnless on the same environment variables. The tests now skip, with the reason, on a machine without the lane, and run as before where the variables are set. The unused nativeLaneRequired enum case is removed from each suite. Tests only. No production code change. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit c288f53) * test(mimo): assert the MiMo contracts that #171 shipped (#211) Three assertions in the MiMo tests disagree with the code that the same PR (#171) added: - The MiMo cache conforms to CBv2MTPRectangularSerializing, and MiMoV26RectangularVerifyTests asserts that the bank supports rectangular MTP verification. The test asserted the opposite. - CBv2PrefillRequirement.evaluationOnly returns a [B, 1] handle (EngineLoopV2.prefillOutput). The test expected shape [1]. - MiMoV26MTPAssistant conforms to CBv2HistoricalMTPPrefixCheckpointCoding (MiMoV26MTPPrefixCheckpoint). The test asserted that it is not a prefix checkpoint drafter. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 5e9d268) * test: run bit-exact reference tests only on reference hardware (#174) * style: format DiffusionGemmaVisionOracleTests.swift Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style: format DiffusionGemmaFactoryTests.swift Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: run bit-exact reference tests only on reference hardware Nine DiffusionGemma tests compare float bits with frozen references. On the hosted macos-26 runner (Apple M1 VM) they differ in the low bits, with no change in shape, dtype or sign. Add a `.referenceHardware` Swift Testing trait that runs a test only when MLX_REFERENCE_HARDWARE=1, and mark the nine tests with it. Elsewhere they report as skipped with the reason. No assertion, tolerance or reference changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: gate only the bit comparisons of mixed DiffusionGemma tests Three gated tests also held checks that pass on any hardware. Split them so only the bit-for-bit comparison is gated: - prefixIdentityTokensOwnerAndEmptyStateFailClosed() runs its fail-closed probes on all hardware. The donor-logits bit comparison moves to failClosedProbesLeaveDonorLogitsBitExact(). - nativeFactoryLoadsExactStateAndReleasesItsModel() keeps the load and model-release checks on all hardware. The logits bit comparison moves to nativeFactoryDenoiseMatchesReferenceBits(). - The two parameterized vision tests run their bf16 case on all hardware. The fp32 case moves to a separate gated test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: gate only the reference comparisons of three more DiffusionGemma tests Split the three tests that were still gated whole, so their checks that pass on any hardware run everywhere: - chunkedSessionBoundsPrefillAndCanCancelAfterPrefill() keeps the prefill bounds, the complete flag, the counters, cancel, the emitted checkpoint and the released cache for widths 1, 3 and 7. The KV and logits bit comparisons move to chunkedSessionMatchesIndependentNativeReference(). - sharedWeightsConditioningKeepsCommittedCacheState() keeps the fixture checks, both cache positions and the unchanged encoder KV after the provisional canvas. The reference comparisons stay in sharedWeightsConditioningAndCommittedCacheMatchReference(). - committedPrefixRestoreKeepsPositionsAfterDonorRetirement() keeps the token count, retained bytes, donor release and both positions. The reference comparisons stay in committedPrefixRestoreIsExactAfterDonorAppendAndRetirement(). Each pair shares one helper. The fixture reference, case-count and parameter-count checks of the block and fp32 vision fixtures also run everywhere now, in blockOracleFixtureIsPinned() and fp32FixtureIsPinned(). CONTRIBUTING.md says which comparisons the gate covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit a046367) * docs: describe demanded checkpoints and their shared fixture * fix(cache): honor request participation in short checkpoint scheduling * Preserve demanded checkpoint eligibility through preemption and packing * test: size the slot-cap request from what the ledger accepts slotCapLeavesRoomForServing() sized its request from bytesReserved. bytesReserved includes the paged pool's physical-floor overhead, which a request's target KV replaces when it reserves. The overhead depends on the buffer sizes the MLX allocator returns: a 36,864-byte segment gets a 49,152-byte buffer, or a 65,536-byte buffer reused from the process-wide cache. When earlier work left 64 KiB buffers in the cache, the capped arm left more than 5.5 windows of real slack instead of half a window, and the uncapped arm's reservation fit. Find the largest request the ledger accepts beside the capped set with trial reservations, then take half a window off it. The assertions do not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 06224a8) * Retain demanded native frontiers and preserve observed prefill endpoints * Document current SDK parameters and generation links * Disambiguate the task generation documentation link --------- Co-authored-by: David Tai <dtaipublic@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Fixes two of the six tests that fail in the whole-package pass of Fork Tests on main (run 36741368847, run 36769006274 on 0871943):
MiMoV26CBv2Tests.testNativeContiguousAdapterMiMoV26MTPEngineTests.testRequestIsolationMeasuredOwnershipAndReleaseKind of fix: wrong test assumption. No production change. #171 added the tests and the production code together. Three assertions disagree with contracts that #171 itself shipped and that other tests assert:
cache capability widenedMiMoV26ContiguousLayerCacheconforms toCBv2MTPRectangularSerializing(MiMoV26CBv2.swift:181-182), sobank.supportsMTPRectangularVerificationis truesupportsMTPis true, and the test already assertssupportsMTPis false.intermediate constructed vocabulary logits.evaluationOnlyreturnshidden.sum(axes: [1, 2]).reshaped(-1, 1), shape[1, 1](MiMoV26CBv2.swift:1176-1181)[B, 1](EngineLoopV2.swift:3560, and the generic path returnslogits[0..., -1, 0 ..< 1]). The lm_head spy check still passes: no vocabulary projection.XCTAssertFalse failedMiMoV26MTPAssistantconforms toCBv2HistoricalMTPPrefixCheckpointCoding(MiMoV26MTPPrefixCheckpoint.swift:48), which refinesCBv2MTPPrefixCheckpointDrafterMiMoV26MTPPrefixCheckpointTests(prefixCheckpointTensorDescriptors) andMiMoV26NativePrefixProducerTests(prefixCheckpointCodecID) use this conformance.The changes keep each check and assert the shipped contract: packed-prefill and span capabilities must stay off, rectangular serialization must stay on, the intermediate handle must be
[1, 1]with no readout, and the assistant must use the priced historical prefix checkpoint codec.Why these tests fail only since #178
The tests were added in #171. On #171 (run 36617213525, fe71e37) the whole-package pass stopped early: the xctest process crashed in
CBv2AsymmetricPagedStorageTestswithFatal error: process charge retirement refused. That suite runs beforeCBv2PagedAttentionWorkReservationTestsand theMiMo*suites, so those suites never ran. #178 fixed that crash, and from eeba2af on the pass reaches these suites for the first time. The failures are not from #178 or #188. They also fail the same way on an M5 laptop, so the hosted runner (M1, 7 GiB, 3 cores) is not the cause.Evidence
Local run (M5,
MLX_ENABLE_TF32=0, staged full metallib): on origin/main the same three errors as CI; with this changeMiMoV26CBv2TestsandMiMoV26MTPEngineTestshave 0 failures (the native-lane tests inMiMoV26MTPEngineTestsare separate; #192 handles them).Checklist
swift formaton the changed filesfork.yamlalready covers the files,check_forkdiff.pypasses)🤖 Generated with Claude Code