Skip to content

Add opt-in RMSNorm lowering and audio runtime memory controls - #1267

Merged
0xShug0 merged 1 commit into
mainfrom
feature/audio-runtime-extensions-pr1
Nov 12, 2026
Merged

0xShug0 merged 1 commit into
mainfrom
feature/audio-runtime-extensions-pr1

Conversation

@0xShug0

@0xShug0 0xShug0 commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Add reusable normalization and graph-memory controls while preserving existing callers’ default selections. Model-local integration is separate.

Changes

  • Add the explicit RSQRT unary operation using existing CPU/CUDA unary machinery; existing operation IDs and kernel math remain unchanged.
  • Add opt-in vectorized RMSNorm/GemmaRMSNorm lowering and forward its selection through Qwen3.5. Default normalization stays unchanged.
  • Add lazy_decode_cache=false to Qwen3.5, allowing forward-only consumers to defer unused cached-decode allocation.
  • Move Oobleck graph lifecycle management to PreparedGraph and add release_inactive_buffers=false, allowing alternating encoder/decoder phases to release the opposite phase’s buffers while retaining its graph.

No model code, specifications, converters or packages are changed.

Existing-caller lifecycle A/B

CUDA RTX 5090, eight CPU threads, warmed A→B→B→A. A uses the original Oobleck/Qwen3.5 lifecycle implementations; B uses the refactor with release_inactive_buffers=false and lazy_decode_cache=false. Model code, weights, precision and requests are identical. Normalization uses its existing default lowering.

Configuration Before mean request ms After mean request ms Change Peak VRAM before → after, MiB
FireRed ASR/understanding, retained graphs 189.504 190.357 +0.45% 12,012.84 → 12,012.84
FireRed ASR/understanding, mem_saver 192.800 191.694 −0.57% 12,008.84 → 12,010.84
FireRed voice design, retained graphs 1,771.758 1,774.044 +0.13% 12,962.84 → 12,960.84
FireRed voice design, mem_saver 1,783.459 1,782.332 −0.06% 12,960.84 → 12,896.84
Index Echo 2B translation 282.327 279.964 −0.84% 4,118.84 → 4,118.84
YuE2 default VAE tiles 1,833.460 1,826.513 −0.38% 5,196.84 → 5,194.84
YuE2 128-frame VAE tiles 1,833.134 1,835.997 +0.16% 5,204.84 → 5,200.84

All 160 requests completed successfully, including warmups and supplemental full-float speech checks. Corresponding results match exactly: 64 text results byte-for-byte and 96 audio results sample-for-sample.

Lifecycle coverage includes short→long→short reuse, different seeds followed by the original-seed repeat, ASR→understanding→ASR, chunked translation, VAE tile-shape changes and graph release/reprepare.

No consistent slowdown was observed; all timing differences were below 1% and are not claimed as speedups. Process-level VRAM was sampled every 20 ms; the largest observed increase was 2 MiB. These results cover the tested CUDA configurations, not other backends or every model route.

Opt-in memory benefit

CUDA RTX 5090, Debug build, eight CPU threads, the same Q8 package and identical requests across variants. The mixed workload alternates generation and editing, exercises short/long shapes and repeated seeds, and uses 100 steps/CFG 3 for generation and 20 steps/CFG 1 for editing. Variant order is A→Q→V→B→B→V→Q→A: A is the original lifecycle, Q enables lazy decode-cache allocation only, V enables inactive VAE buffer release only, and B enables both.

Lifecycle configuration Observed peak VRAM MiB Saving MiB Warmed mean request ms
Original lifecycle 14,118.84 — 1,421.221
Lazy decode cache only 13,812.84 306 1,413.889
Inactive VAE buffer release only 11,892.84 2,226 1,408.173
Both enabled 11,586.84 2,532 (17.93%) 1,420.059

This is a memory/time trade-off, not an inference-speed improvement. A targeted repeated-editing comparison measured 615.385 → 620.953 ms (+0.90%) with both enabled. VAE reallocation/preparation adds roughly 4–5 ms, while graph compute time stays similar. Corresponding outputs match exactly. Lazy cache creation, use and reset also reproduce cached-decode logits exactly (cosine 1, maximum error 0).

These savings concern forward-only text encoding and alternating VAE encode/decode. They are not general VRAM reductions for existing autoregressive or decode-only callers. The options remain disabled by default.

@0xShug0 0xShug0 added the ggml label Nov 12, 2026
@0xShug0
0xShug0 merged commit a292a9e into main Nov 12, 2026
7 checks passed
@0xShug0
0xShug0 deleted the feature/audio-runtime-extensions-pr1 branch November 12, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant