Skip to content

Precompute Drama3 Gemma scales and remove redundant CUDA decode views - #1067

Merged
0xShug0 merged 1 commit into
mainfrom
perf/drama3-norm-reshape
Oct 23, 2026
Merged

0xShug0 merged 1 commit into
mainfrom
perf/drama3-norm-reshape

Conversation

@0xShug0

@0xShug0 0xShug0 commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Changes

  • Precompute Gemma normalization scales (1 + weight) in F32 at model load, using the existing tensor-source and backend-weight-store APIs. Backbone graphs use the existing RMSNorm module with the prepared scales; the tower uses the same prepared-scale approach. Ordinary GDN normalization is unchanged.
  • Enable the existing identity-reshape-elision setting only for the CUDA cached backbone decode graph.
  • Preserve Vulkan's original decode views: removing them changed its fusion path and sampled output. Norm folding alone preserved the checked Vulkan outputs.
  • Extend the existing model-local backbone test to verify nonzero Gemma scales are offset exactly once and ordinary GDN scales remain unchanged.
  • No framework, GGML, model-spec, public-option, sampler, weight-format, or expert-offload-policy changes.

Performance

RTX 5090, Debug C++17, eight threads, the same Q4-expert/F16-tower GGUF and reference voice. Each session ran one warmup and three distinct 262–266-character clone requests, sequentially. Settings: seed 42, temperature 1, top-k 4097, top-p 0.9, context 4096, text chunk size 2000. All outputs stopped naturally.

Baseline includes the codec batching and asynchronous decoding merged in #1065. Warm RTF uses summed session.wall_ms divided by summed generated duration, excluding warmup; peak VRAM includes model load and warmup.

Backend / mode Baseline warm RTF PR warm RTF Baseline peak VRAM PR peak VRAM
Full CUDA 0.1803 0.1780 24,366 MiB 24,364 MiB
Full Vulkan 0.2560 0.2473 23,746 MiB 23,746 MiB
CUDA CPU-weight offload, eight slots, pinned host weights 0.4580 0.4451 7,560 MiB 7,544 MiB
Vulkan CPU-weight offload, eight slots, pinned host weights 0.6125 0.6041 6,908 MiB 6,906 MiB

RTF reductions are approximately 1.2%, 3.4%, 2.8%, and 1.4%, respectively. These are modest gains; the small VRAM differences are not claimed as savings. Resident rows pool two sessions per side; offload rows use one session per side and have less repeatability evidence. The codec remains on the GPU in offload mode.

Validation And Limits

  • All paired WAVs in the retained configuration are byte-identical, with matching frame counts and durations and finite samples.
  • The existing backbone allocation/prefill/continuation test passed on CPU, CUDA, and Vulkan. It exercises allocation-failure cleanup, changing prompt lengths, continuation, state reset, and the new scale checks.
  • CUDA A/B measurements used the same active CUDA graph construction before the Vulkan-only restriction was added. A subsequent run of the final build also matched all four CUDA baseline WAVs byte-for-byte. Vulkan results use the restricted final configuration.
  • A Vulkan diagnostic with backend fusion disabled made the unrestricted baseline and candidate WAVs identical, isolating the output difference to the fusion path exposed by removing views. That unrestricted configuration is not enabled.
  • No ASR rerun was used to compare identical WAVs. Full-model CPU/Metal/HIP execution and exhaustive long-form quality validation were not performed.

@0xShug0
0xShug0 merged commit a7f1860 into main Oct 23, 2026
7 checks passed
@0xShug0
0xShug0 deleted the perf/drama3-norm-reshape branch October 23, 2026 22:48
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