Performance: 1344x768 / 5s renders wait-dominated (GPU idle per profile) on M5 Max — measured dataset
Summary
At 1344×768 / 124 frames (5.17s), the DiT denoise is extremely slow on M5 Max even with healthy memory: ~36 min wall for 20 steps, and the profile shows wait ≈ wall with tiny root-gpu. The documented >3,072-row MPSGraph fallback is the likely cause, but there are no published timings for production shapes (5s+, widescreen) to confirm whether this is expected. This report adds measured numbers so the cost model is explicit.
Environment
- MacBook Pro, Apple M5 Max, 128 GB unified, macOS 26.5.2, Metal 4
- h3.c @ 8974cc0 (
--ssd-streamingincluded), default int8 path on M5 - Model: official HF snapshot
MiniMax-H3(FL2VA) - Command:
./h3 --profile -d ./MiniMax-H3 -p "<kids prompt>" --seed 42 --width 1344 --height 768 --frames 124 --steps 20 --layers 50 --reuse 1 --ssd-streaming H3_VAE_TILE_PIXELS=256
Measured --profile (GPU Euler denoise)
| Config | rows* | denoise wall | root-gpu | encode | wait |
|---|---|---|---|---|---|
| 1344×768, 124f | 37,296 | 2176.1s | 3.8s | 0.61s | 2175.4s |
| 896×512→out 1344, 124f | 16,576 | 1028.1s | 2.5s | 0.56s | 1027.5s |
| 672×384→out 1344, 124f | 9,324 | 372.8s | 1.2s | 0.53s | 372.2s |
| 1344×768, 22f | 7,056 | 223.1s | 0.8s | 0.51s | 222.5s |
| 512×512, 22f | 1,792 | 19.5s | 19.4s | — | ~0 |
* rows = latent_t × (W/32) × (H/32), latent_t(124f)=37, latent_t(22f)=7 (h3_host.c).
H3_PROFILE=1 on the 1344×768/22f case: command_encode tiny (~0.5s), so the CPU is not stuck encoding; the wait appears to be MPSGraph child-buffer execution that root-gpu can't see. GPU busy via powermetrics not collected (needs root).
H3_NAX=1 on 1344×768/22f: 265.8s vs 223.1s baseline (no improvement — consistent with NAX kernels never selected >3,072 rows).
Observations
- 512×512/22f (1,792 rows) is healthy: root-gpu ≈ wall.
- At ≥ 4,352 rows (512² @ 56f = 2.33s) everything is wait-dominated.
- SSD streaming fixed memory (DiT peak ~2.6–3.7 GiB, RAM stable) but did not help speed — as documented, it's a memory/speed tradeoff.
- Internal render downscale (672×384 / 896×512 → upscaled 1344×768 output) is the only practical way to cut time, at a visible quality cost; no internal canvas at 124f gets under 3,072 rows in a valid 1.75:1 aspect.
Questions
- Is this wait-dominated profile at >3,072 rows expected/accepted today, or a known optimization gap (e.g. NAX TensorOps >3,072-row split, MPSGraph scheduling for production shapes)?
- Any recommended env/flags for production 5s+ widescreen before the large-sequence path is optimized (e.g.
H3_GPU_SAMPLER_WINDOW, command blocks, NAX variants)? - Would a contributed benchmark (this table, exact cmd + profile output) be useful in the README to set expectations for 4–15s widescreen renders?
Happy to share full --profile logs or the exact test prompt if useful. Thanks for the great project.
Cross-stack data point for the same hardware class, in case it helps bound what "expected" looks like at these shapes.
I have been running H3 on an M5 Max / 128 GB / macOS 26.x through ComfyUI 0.30.0 + PyTorch 2.13 MPS (int8_convrot weights from Comfy-Org/MiniMax-H3, pruned Ref2VA DiT + int8 Qwen3-VL text encoder). Different stack, same silicon, so the numbers may be useful as a baseline for what the MPSGraph path costs when it is the only path.
Measured: ComfyUI / PyTorch MPS
864×480, 124 frames, rows = 27 × 15 × 37 = 14,985 (using the latent_t(124f)=37 from this issue).
| Steps | Sampling | Total wall |
|---|---|---|
| 20 | 72.4 s/step | 24.9 min |
| 12 | 72.4 s/step | ~16 min |
736×1280 (720p-class portrait), 124 frames, 12 steps: 239 s/step, 47.8 min total.
Normalised against the 896×512 row in your table
Your 896×512 → 1344, 124f: 16,576 rows, 1028.1 s / 20 steps = 51.4 s/step.
Scaling that to my 14,985 rows (attention quadratic, everything else linear, using the module split below) gives ≈ 42 s/step, against my measured 72.4 s/step.
So h3.c is roughly 1.7× faster than PyTorch MPS at production shapes — i.e. h3.c is still ahead even in the wait-dominated regime where NAX is not selected. That may be a useful lower bound: the >3,072-row fallback is not merely "as bad as PyTorch".
Module-level profile (may help localise the gap)
torch.profiler has no ProfilerActivity.MPS in 2.13, so I instrumented the DiT modules directly (sync on both sides of each forward, accumulate by class). Forced syncing inflates absolute time, so read the shares, not the seconds. 864×480 / 124f:
| Module | step 1 | step 2 |
|---|---|---|
| attention | 70.7 % | 67.4 % |
| mlp | 25.5 % | 29.0 % |
| adaln | 0.7 % | 0.7 % |
| everything else (norm/rope/packing/dispatch) | 2.8 % | 2.9 % |
Attention is ~70 % of the step and non-GEMM overhead is under 3 %. If the same holds in h3.c, the >3,072-row work is worth concentrating on attention rather than on the linear layers.
Machine ceiling on this hardware, for reference
All properly warmed (3 rounds × 20 iterations — under-warmed runs on MPS under-report by 2–3×, which cost me a couple of wrong conclusions):
| Measurement | Value |
|---|---|
| bf16 / fp16 GEMM, 4096³ | 64.2 TFLOPS |
| fp32 GEMM, 4096³ | 15.0 TFLOPS (4.3× ratio) |
| Memory bandwidth (2 GB clone) | 446 GB/s |
F.scaled_dot_product_attention at 12,555 × 56 heads × 128 |
592.6 ms → 7.6 TFLOPS |
Derived (uses my own FLOP accounting, so treat as an estimate): the pipeline runs at ≈ 10 TFLOPS effective, with the linear layers at ≈ 23 TFLOPS (36 % of peak, reasonable) and attention at ≈ 4.4 TFLOPS — about 7 % of peak. That single number is where the whole gap lives on the PyTorch side, and it is consistent with your root-gpu ≪ wall observation being an attention-path problem rather than a general scheduling one.
Two negative results from the PyTorch side
Possibly relevant since they rule things out cheaply. End-to-end A/B, 864×480 / 124f / 4 steps, identical seed and prompt:
| Configuration | s/step |
|---|---|
| default (sub-quadratic attention) | 72.4 |
--use-pytorch-cross-attention (SDPA) |
99.8 (+38 %) |
--fp16-unet |
83.0 (+15 %) |
--gpu-only |
83.1 (+15 %) |
--use-split-cross-attention |
SIGSEGV mid-sample |
Also: on MPS, torch._int_mm is unimplemented and a plain int32 matmul is ~17× slower than bf16, so the int8 path has to dequantise. I measured dequantisation at 23.4 G params/s, which is only 0.83 s/step for 19.5 B params — ~1 % of step time. Weight-side quantisation is not where the time goes at these shapes, which matches the "attention FLOPs dominate" note in the MLX port's README.
For completeness: PyTorch 2.13's dylibs contain MPSGraph symbols but no MetalPerformancePrimitives / Metal 4 tensor symbols, so the PyTorch path never reaches the M5 matrix units at all. That makes the M1 Ultra comparison in #17 (5.2× slower than M5 Max on the same preset, despite higher memory bandwidth) a fairly direct measurement of what those units are worth where TensorOps does engage — which is what makes the >3,072-row cutoff the interesting number.
Happy to re-run any of the above at a shape that would be more directly comparable.