Repository navigation
test: hold the hog in the waiting-queue backstop test - #163
Conversation
Add the Fork Tests workflow. It builds the package on a macos-26 runner, builds the full MLX Metal library with cmake, copies it next to the test binaries, and runs six CBv2 paged suites one step each. A suite step fails when the suite executes zero tests or skips a test. Port the scripts from d-inference and add them to fork.yaml. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
system_profiler SPDisplaysDataType prints nothing on the hosted macos-26 VM. The CPU, memory and disk lines stay. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Pick the newest Xcode_26.x app whose name is only a version number. Beta and release candidate apps are left out, so a new beta on the runner image cannot change CI without a pull request. The step still fails when the selected Swift is older than 6.3. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
swift build makes no Metal library. The pinned mlx-swift excludes the MLX kernel sources and nojit_kernels.cpp from Cmlx, so SwiftPM builds MLX in JIT mode, and every MLX operation traps without a staged mlx.metallib. The partial 459-symbol library comes from xcodebuild, which this workflow does not use. State that the 10,000-symbol floor rejects a JIT-mode or incomplete cmake build. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
End the cache key with the commit SHA, as d-inference does, so each push to main saves a new entry. The prefix restore key still restores the newest entry for the same Xcode. Before the save, delete the staged mlx.metallib copies and the coverage data, so the cache keeps only SwiftPM output. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- run-nested-suite.sh: the suites need no model weights, but one test needs DARKBLOOM_EXCLUSIVE_NATIVE_GPU_TEST=1, which the caller sets. - fork-tests.yml: runs on main are not cancelled once they start. - Say "self-contained" instead of "hermetic" in the workflow and in fork.yaml. - fork.yaml: write the Fork Tests paragraph as one sentence per line, so later pull requests can add a sentence without touching the same lines. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
testWaitingQueueBackstopEmitsCanonicalQueueFullMarker polled every 5 ms for the hog request to show as running, but the hog finished its 60 scripted tokens in milliseconds. A late poll missed the window and the test failed after 10 s (Fork Tests run 36182132297, attempt 1). Set eventBufferCapacity to 4, as testDuplicateSubmitThrowsAndFirst- StreamStillDelivers does. The unread hog stream hits backpressure, so the hog pauses with its slot retained until the test drains it. The wait now also requires the hog to be paused. Only this test changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Run swift format format with .swift-format on the whole file, so the format check of #160 passes. It changes four places outside the backstop test: two nested CBv2Request calls and three comment alignments in CBv2EngineLoopConfig arguments. No code changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Validation follow-up for head ce39176: before approval, please add a gating CI invocation of CBv2SchedulerLoopTests (using the suite runner's zero-test/skip checks), or provide an equivalent linked CI run of this exact candidate that actually executes the class. The PR correctly documents that its current green Fork Tests job only compiles the changed scheduler test. The local 30-run evidence is useful, but the staged Metal library's source revision was not verifiable. Please build/stage the library from the candidate's resolved MLX dependency and record that revision in the run. Please retain the deterministic backpressure setup and existing assertions. This request is about exercising the fix in the supported CI configuration, not evidence that the proposed fix is wrong. Update the dependency notes to include #164 before #161 as well. |
Add a Fork Tests step that runs CBv2SchedulerLoopTests with scripts/run-nested-suite.sh, after the six Metal suites. The step fails when the class executes zero tests or skips a test, so CI runs the backstop fix instead of only compiling it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reply written by Claude (agent) on David Tai's behalf. Done. Commit 26f54f2 adds a gated step that runs |
Proposed changes
CBv2SchedulerLoopTests.testWaitingQueueBackstopEmitsCanonicalQueueFullMarkerfailed once in the Fork Tests whole-package step of #161 (run https://github.com/Layr-Labs/mlx-swift-lm/actions/runs/36182132297, attempt 1):Cause: the test polls every 5 ms, for at most 10 s, until the capacity gauge shows the hog request running and nothing waiting. The hog has
maxTokens: 60on the scripted model, so it runs for only milliseconds. When the poll comes late, as on a loaded 3-core runner, it misses that window, and the condition never comes true again. The later steps of the test also need the hog to hold the single running slot.Fix: the test now owns the hog's lifetime, as
testDuplicateSubmitThrowsAndFirstStreamStillDeliversdoes:CBv2EngineLoopConfig(eventBufferCapacity: 4). The test does not read the hog's stream, so the stream hits backpressure and the hog pauses with its slot retained. It cannot finish before the test drains its stream.loopForTesting.pausedIDsSnapshot() == [hogID]. After the pause, the condition stays true, so a late poll cannot miss it..length.The engine cannot admit the waiter while the hog is paused: a paused row stays in
SchedulerV2.running, and admission requiresrunning.count < maxConcurrentRequests. The backpressure lease is 120 s by default, far longer than the test.Only this test changes in behavior. Commit 26f54f2 also adds a Fork Tests step that runs
CBv2SchedulerLoopTests(see Test plan). A second commit, ce39176 (style: format CBv2SchedulerLoopTests.swift), runsswift format format --configuration .swift-formaton the whole file, so the format check of #160 passes. It changes five places outside this test (near lines 97-117, 694, 761 and 811): two nestedCBv2Requestcalls and three comment alignments. It changes no code.Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes: the changed file is formatted withswift format formatand.swift-formatin the separate commit ce39176Test plan
Local run on a laptop with 10 CPU cores (Apple silicon), on commit ce39176:
swift build --build-testswith the Xcode 27.0 toolchain (Swift 6.4),--build-system native, and the Xcode XCTest search paths. The Xcode license is not accepted on this laptop, so the build called the toolchain directly instead ofxcrun. The successful build took 2.0 min, after earlier attempts that failed on setup had compiled part of the package. The rebuild for the control took 13 s.work/mlx-metallib-aot(JIT off, deployment target 26.2) withscripts/stage-test-metallib.sh. Its MLX source commit could not be checked, because that checkout no longer exists.CBv2SchedulerLoopTestsclass (37 tests) with Xcode'sxctest -XCTest MLXLMTests.CBv2SchedulerLoopTests. This is the XCTest pass thatswift test --skip-build --filter CBv2SchedulerLoopTestsruns.ci/fork-tests(unfixed, negative control)CBv2SchedulerLoopTests.testCapacityLoserIsRequeuedNotErroredfailed withcaught error: "CancellationError"(CBv2SchedulerTestSupport.swift:533), in run 19 of the unfixed file. This PR does not change that test. It is a second flaky test. test: make the capacity-loser scheduler test deterministic #164 fixes it. The evidence table in test: make the capacity-loser scheduler test deterministic #164 also re-ran this PR's file 30 times under CPU load, and all 30 runs passed..build(5.0 GB) was deleted after the runs.git statuswas clean.ci: run the scheduler loop suite through the no-skip runner) adds a gated Fork Tests step. It runsCBv2SchedulerLoopTeststhroughscripts/run-nested-suite.sh, after the six Metal suites, with the sameif:condition and a 10-minute limit. The step fails when the class executes zero tests or skips a test.testWaitingQueueBackstopEmitsCanonicalQueueFullMarkerpassed in 0.066 s.scripts/build-metallib.shbuilt the Metal library with cmake from the resolved mlx-swift checkout,.build/checkouts/mlx-swift/Source/Cmlx/mlxat MLX commit 3fa8f25e6451174d7b06be372c3a24272b77d88e (17,326 symbols). That is the MLX commit that the pinned mlx-swift d7c1d3dc records. So the CI run does not depend on the local library, whose source revision could not be checked.Dependencies
Merge after #159 and before #164, #166, #167 and #161. #164 is stacked on this PR.
Merge order: #160, then #159, then delete
ci/fork-testsso GitHub retargets the stacked PRs tomain, then #162, then #163, then #164, then #166, then #167, then #161.Authorship
Commits were written by Claude Opus 5.5 under the direction of Claude Fable 5.1.
🤖 Generated with Claude Code