Split long non-causal SDPA queries to avoid Ultra corruption - #64
Open
quantz8a wants to merge 1 commit into
Open
Split long non-causal SDPA queries to avoid Ultra corruption#64quantz8a wants to merge 1 commit into
quantz8a wants to merge 1 commit into
Conversation
MPSGraph scaledDotProductAttention can silently return garbage on M2/M3 Ultra above ~15k query rows (antirez#16). Chunk non-causal queries (default block 2048, only when sequence > 12288). Tune with --sdpa-query-block / env H3_SDPA_MAX_QUERY_ROWS and H3_SDPA_SPLIT_MIN_ROWS; set MAX to 0 to disable.
quantz8a
force-pushed
the
fix/16-sdpa-query-block
branch
from
September 12, 2026 15:55
d5ad814 to
39e9569
Compare
Author
|
Local M3 Ultra (96GB) validation for this PR:
This geometry is in the Ultra corruption zone discussed in #16; output is coherent rather than noise. |
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
scaledDotProductAttentionsilent corruption on M2/M3 Ultra for long non-causal sequences (Corrupted video (and audio) outputs #16 / Apple FB24605554).sequence > 12288; leave smaller jobs on the fast single-op path.--sdpa-query-block N,H3_SDPA_MAX_QUERY_ROWS(0 disables),H3_SDPA_SPLIT_MIN_ROWS.Fixes #16
Related: #15 (same size class; assert vs silent garbage)
Notes
--ssd-streamingfor long HQ jobs (as discussed in Corrupted video (and audio) outputs #16).Test plan
h3_gpu.m/main.cwith stock flagsmake -j && ./h3_tests896×512or1344×768, ≥100 frames, steps≥4 previously produced static → now coherent scene/audio512×512, 22–107f) unchanged wall-clock path (no split below gate)896×512, 107f, steps=4,--ssd-streaming)