[MPSNDArrayMatrixMultiplication encodeToCommandBuffer:] destination ... is too large for kernel on M3 Max 64 GB
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- c, macos
- Ambito
- machine-learning, performance
Direzione di ricerca
Start by reproducing the failure with ./h3 using the two commands in the issue on an M3 Max with 64 GB, then trace the MPSNDArrayMatrixMultiplication attention path that materializes the score matrix. Investigate a chunked or tiled SDPA path, or an MPSGraph scaled-dot-product fallback for large sequences. Done means both reported 8-second cases avoid the kernel abort while the small README validation continues to work.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reproduction
Any generation where the combined video+audio token sequence grows past ~26k. Two confirmed failures, both at denoise 0/20:
A. 1024×576, 8 s (192 frames):
./h3 -d ./MiniMax-H3 -p "..." --width 1024 --height 576 --seconds 8
--steps 20 --layers 45 --reuse 2 -o outputs/out.mp4
B. 896×512, 8 s (192 frames): same command with --width 896 --height 512.
Both abort with:
MPSNDArrayMultiaryKernel.mm:2644: failed assertion `[MPSNDArrayMatrixMultiplication encodeToCommandBuffer:] destination: [
<MPSTemporaryNDArray ...> Rank: 4, MPSDataTypeBFloat16, Device: Apple M3 Max
- dimensionLengths = [ 33654, 33654, 56, 1, ... ] (case A)
- dimensionLengths = [ 26358, 26358, 56, 1, ... ] (case B)
- strideElements = [ 1, 33656, ... ] / [ 1, 26360, ... ]
] is too large for kernel. Encode failed.'
zsh: abort
Analysis
The failing op is an explicitly materialized attention-score matrix: 56 heads × S×S BF16, i.e. 56 × S² × 2 bytes:
Canvas / duration | Sequence S | Score-matrix footprint
1024×576 × 8 s | 33,654 | ≈ 127 GB
896×512 × 8 s | 26,358 | ≈ 78 GB
where S ≈ (W/32)×(H/32)×⌈frames/4⌉ + audio tokens. Both footprints far exceed a 64 GB unified-memory machine. Development appears to happen on a 128 GB M5 Max, where the 78 GB case fits — which is presumably why this hasn't been caught. M3 Max also has no Metal 4/TensorOps attention path, so it falls into this MPS path even at shapes that work on M5.
Meanwhile small sequences work fine on the same machine: the README's 512×512 / 22-frame fox validation runs correctly.
Expected behavior
M3-class / ≤ 64 GB machines need a fallback that doesn't materialize the full S×S score matrix — e.g. a chunked/tiled SDPA (flash-attention style), or dispatching to an MPSGraph scaled-dot-product path when S exceeds a memory-derived threshold.
Suggested immediate mitigation for users
Keep 56 × S² × 2 ≤ ~22 GB of temp headroom (DiT at --layers 45 already resident at ~33 GB). On a 64 GB machine that means S ≲ 14,000, e.g. 864×480 × 5 s (S = 14,339) is the largest validated-geometry shape expected to work; longer videos must be produced as chained shorter segments via --ref-video.
Happy to run any diagnostics / patched builds on this machine.
- Lingua principale
- C
- Stelle
- 3.1k
- Fork
- 268
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di antirez/h3.c
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Bug: Interactive session doesn't emit 'Done ->' line when stdout is a pipe (non-TTY)Forse già presa @quantz8a l’ha presa 66 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Deadlock (not corruption) at 243 frames: `_MTLCommandBuffer waitUntilCompleted` never returnsAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Thank you: H3.c + StoryboardAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
Tutte le issue di antirez/h3.c
Issue simili
-
on_ctrl_redirect(): iterator never advances — infinite loop stalls the event loop at 100% CPUAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
openziti/ziti-sdk-c#1254 ·
I maintainer di solito rispondono entro 1 giorno
-
http_fetch tests: the two no-child rows fail, not skip, where a task's children file does not existForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea:http kind:gate-defect
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
InauguralSystems/EigenScript#2397 ·
I maintainer di solito rispondono entro 1 giorno
-
Add SECURITY.mdApertaenhancement
Difficoltà 1/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
modem: ppp: CMUX DLCI receive buffer overruns on large downlink packetsForse già presa @pedrohqr l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
zephyrproject-rtos/zephyr#126195 ·
I maintainer di solito rispondono entro 3 giorni