Prevent Metal watchdog failures during long-context prefill - #147
Open
m21ecom wants to merge 4 commits into
Open
Prevent Metal watchdog failures during long-context prefill#147m21ecom wants to merge 4 commits into
m21ecom wants to merge 4 commits into
Conversation
Bound pre-Apple10 full-attention work by both query rows and KV length, isolate long attention spans in labeled command buffers, and preserve the optimized Apple10 and short-context paths.
Forward true prefill and decode progress to rate-limited stderr logs so multi-minute requests remain observable without timer-only heartbeat noise.
…t-metal-watchdog # Conflicts: # Sources/TurboFieldfare/Kernels/Attention/PrefillAttention.swift # Sources/TurboFieldfare/Runtime/Inference/RealForwardRunner.swift # Sources/TurboFieldfareCLI/Args.swift # Sources/TurboFieldfareServer/Command/main.swift # Sources/TurboFieldfareServer/Core/ServerArguments.swift # Sources/TurboFieldfareServer/Core/ServerInference.swift # Tests/TurboFieldfare/Core/CLI/CLIArgumentsTests.swift # Tests/TurboFieldfareServer/OpenAIValidationTests.swift # docs/RUNTIME_CONTROLS.md
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.
Summary
Prevent long-context prompt prefill from submitting Metal attention work large enough to trigger
MTLCommandBufferErrorDomain Code=1/Impacting Interactivity.Changes
--prefill-watchdog-protection on|off, enabled by default.Motivation
Long prompts were failing for me during prefill with errors such as:
Metal command buffer failed: label=prefill ...
MTLCommandBufferErrorDomain Code=1
Impacting Interactivity
A fixed eight-query batch was still too large around KV length 6,784. The protected path now reduces the batch size with KV length—for example, approximately three rows around 6.8K KV, two around 10K, and one near 32K.
Validation
Environment:
Results:
The 32K validation means the server was configured for a 32K context window; the tested prompt itself contained 10,229 tokens.