Skip to content

Consolidate PocketTTS Small Mimi decoding and reduce inference overhead - #1318

Merged
0xShug0 merged 1 commit into
mainfrom
refactor/mimi-codec-runtime
Nov 17, 2026
Merged

0xShug0 merged 1 commit into
mainfrom
refactor/mimi-codec-runtime

Conversation

@0xShug0

@0xShug0 0xShug0 commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

PocketTTS Small's decoder previously submitted separate convolution graphs and moved intermediate results through the host. Replace that execution with a session-owned framework MimiLatentDecoderRuntime, reusing existing convolution, transformer and graph-management modules.

Default offline blocks and streaming execute the complete decoder block in one cached graph per mode, with persistent KV and convolution state. CUDA full-sequence decoding retains its single graph; CPU full-sequence decoding uses three coarse, bounded stages. Model-specific latent normalization, fades and text-chunk resets remain in the session.

No GGML kernel changes, shared-module math changes, precision changes or public-option changes. Original PocketTTS and existing Mimi codec callers are unchanged.

Performance

Main versus this PR, sequential warmed A→B→B→A, eight threads, matching published F32 packages. Each block has two excluded warmups and 15 measured requests. CUDA: RTX 5090; CPU: Ryzen 9 7900X. Debug builds on both sides.

Across all six variants, default offline/streaming RTF is 27–33% lower on CUDA and 9–16% lower on CPU, with gains in both run orders.

Representative 18M results:

Path Main RTF PR RTF Generation-time reduction Process peak memory, main → PR
CUDA offline 0.01274 0.00912 28.4% 816 → 800 MiB VRAM
CUDA streaming 0.02088 0.01513 27.5% 798 → 792 MiB VRAM
CPU offline 0.04522 0.03855 14.7% 545.8 → 517.9 MiB RSS
CPU streaming 0.06279 0.05537 11.8% 508.2 → 507.9 MiB RSS

Warmed 18M streaming TTFA, using the same A→B→B→A runs and eight threads (cold-start time excluded):

Backend Main TTFA PR TTFA
CUDA, RTX 5090 6.39 ms 5.71 ms
CPU, Ryzen 9 7900X 12.58 ms 12.06 ms

Process memory is sampled every 20 ms.

Explicit full-sequence CUDA performance and VRAM remain effectively unchanged. CPU full-sequence RTF improves by 8–15% for the two distinct decoder configurations; 18M peak RSS decreases from 966.1 to 540.7 MiB.

Correctness and lifecycle

  • All six variants pass official Python teacher-forced waveform replay on CPU/CUDA for bounded offline, streaming and full-sequence decoding: 36 PR checks plus 36 main controls, all above the unchanged 0.99999 cosine gate.
  • Matched CUDA PCM is identical to main. CPU PCM differs by at most one signed-16-bit sample step, including long-form and native batch output.
  • Long-form ASR checks return 0% WER for eight representative outputs covering 2M/18M, CPU/CUDA and offline/streaming.
  • Direct decoder lifecycle checks pass on CPU, CUDA and Vulkan for both distinct decoder configurations: reset, changed/restored inputs, graph-shape reuse, cache recreation, offline/stream interleaving and stream-block changes after reset.
  • Non-aligned CPU tail partitions preserve valid samples; short→long→short, repeated native batches and single-after-batch execution preserve main-versus-PR output parity.

Keep PocketTTS unchanged. The Small-only refactor builds successfully; regression validation of the final scoped changes remains pending.
@0xShug0
0xShug0 merged commit 28a6fe7 into main Nov 17, 2026
7 checks passed
@0xShug0
0xShug0 deleted the refactor/mimi-codec-runtime branch November 17, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant