Repository navigation
Add opt-in RMSNorm lowering and audio runtime memory controls - #1267
Merged
Merged
Conversation
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.
Add reusable normalization and graph-memory controls while preserving existing callers’ default selections. Model-local integration is separate.
Changes
RSQRTunary operation using existing CPU/CUDA unary machinery; existing operation IDs and kernel math remain unchanged.lazy_decode_cache=falseto Qwen3.5, allowing forward-only consumers to defer unused cached-decode allocation.PreparedGraphand addrelease_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=falseandlazy_decode_cache=false. Model code, weights, precision and requests are identical. Normalization uses its existing default lowering.mem_savermem_saverAll 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.
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.