Skip to content

feat(structures): decoder_llm + audio_codec whole-module structures with one-call doors (OmniVoice, 4.24x) - #176

Open
shideqin wants to merge 2 commits into
flashrt-project:mainfrom
shideqin:feat/omnivoice-structures
Open

feat(structures): decoder_llm + audio_codec whole-module structures with one-call doors (OmniVoice, 4.24x)#176
shideqin wants to merge 2 commits into
flashrt-project:mainfrom
shideqin:feat/omnivoice-structures

Conversation

@shideqin

Copy link
Copy Markdown
Contributor

What this adds

OmniVoice (Qwen3-1.5B backbone + 8-codebook MaskGIT head) adopted into
the structures layer as two whole-module structures, in the PR-175
tiering (hub artifact first, local native build second, host floor):

  • decoder_llm (catalog/decoder_llm/, impls/decoder_llm/nvfp4.py):
    the whole decoder stack as one seam — the native NVFP4 engines
    (fp4 GEMMs + fused qk-norm+RoPE + FA2 + fused residual/norm/quant)
    with per-batch dispatch (CFG batch B=2 rides the BF16 engine, single
    stream B=1 rides the FP4 CUDA graph), profile-envelope refusal outside
    the native engine's v1 contract (D=1024/L=28/NH=16/NKV=8/HD=128/
    FFN=3072).
  • audio_codec (catalog/audio_codec/, impls/audio_codec/fp16.py):
    the neural codec decode (codes -> waveform). Measured levers:
    torch.compile 1.00x, CUDA graph 1.02x, fp16 autocast 1.22x with
    waveform cosine 1.00000
    — the fp16 form is adopted; the host family
    (HiggsAudioV2TokenizerModel) is shared with Higgs-Audio-v3, so the
    structure recurs beyond one model.
  • One-call doors (the article's using-it shape): AutoPlan.attach()
    — the plan now carries its root host, so plan.attach() commits the
    swaps atomically (the paper's handle = plan.attach()); and
    structures.maskgit_loop(model) — the MaskGIT two-phase schedule door
    (loop.generate(task, gen_config)), the decode_loop twin for
    non-text generation hosts.
  • Per-seam fp4 backends (impls/decoder_ffn/nvfp4_static.py,
    impls/linear_proj/nvfp4_static.py): large-M NVFP4 FFN / projection
    tiers served by the local fp4 GEMM.
  • Scheme + discovery + dispatch: nvfp4_static scheme (weight-only,
    no calibration data), decoder-stack and audio-codec discovery rules
    (slot-based — layers/embed_tokens/norm/rotary_emb and
    decode/quantizer/acoustic_decoder/decoder_semantic — never model
    names), autobuild bind dispatch, and the omnivoice_llm /
    omnivoice_audio_codec binding receipts.

Measured (RTX 5060 Ti, torch 2.13+cu130, omnivoice 0.2.1, design mode,

32 MaskGIT steps, gs=2.0, seed=42, median of 3)

text baseline RTF structures RTF speedup
short 0.2292 0.0438 5.23x
medium 0.1187 0.0280 4.24x
long 0.0791 0.0159 4.97x
median 0.1187 0.0280 4.24x

The native inject path measures 0.0284 median on the same box — the
structures route matches it within noise (and is slightly ahead once the
codec is included). Per-seam-only adoption (fp4 FFN, fp4 FFN+projections)
measured ~1.0x; the win lives in the whole-LLM boundary and the schedule,
not the individual kernels (the "fast kernels are not fast pipelines"
result, inside the layer itself).

Usage (the article's one-call shape)

from flash_rt import structures

plan = structures.auto_swaps(model, calibration,
                             structures=("decoder_llm", "audio_codec"),
                             scheme="nvfp4_static")
print(structures.explain(plan))          # receipt
handle = plan.attach()                   # one-call door
loop = structures.maskgit_loop(model)    # the schedule door
tokens = loop.generate(task, gen_config) # two-phase MaskGIT schedule

Validation

  • CPU contract pins (tests/test_structures_decoder_llm.py): catalog
    entries, binding loads, scheme routing (decoder_llm / decoder_ffn /
    linear_proj / audio_codec), AutoPlan.attach() and maskgit_loop
    door exports, native-refusal without a local build, slot-based
    discovery — all pass without kernels (10 passed / 3 skipped here;
    the 3 skips are the local-build-present cases).
  • GPU: bind-time smokes through the real entry points; end-to-end audio
    generation real and non-silent; zero seam fallbacks in the benchmark
    runs (ledger-verified); fp16 codec waveform cosine 1.00000 vs the
    fp32 host.
  • tests/test_structures_bindings.py, test_structures_precision_entry.py,
    test_structures_decode_loop.py, test_structures_discovery_contracts.py
    stay green (59 + 23 passed).

Notes

  • The impls consume the local native build (flash_rt_kernels +
    flash_rt_omnivoice + flash_rt_fa2,
    -DFLASHRT_ENABLE_OMNIVOICE=ON -DGPU_ARCH=120); publishing the
    fp4/omnivoice kernels as hub packages with a torch-2.13 variant is the
    delivery-side follow-up (the hub-first tier then picks them up and no
    local build is needed).
  • The noCFG FP4 phase collapses tiny prompts to a repeated-code attractor
    in both the host and this path (host characteristic); keep
    guidance_scale > 0 and use real sentences.
  • Seam guards pin one thread per attachment; a serving thread pool should
    reset model.llm._frt_guard.thread = None (and the codec guard) per
    request.

@shideqin
shideqin requested a review from LiangSu8899 as a code owner August 16, 2026 09:43
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