Skip to content

Refactor Granite5ASR graph reuse and batch GPU attention - #1335

Merged
0xShug0 merged 1 commit into
mainfrom
refactor/granite5asr-inference
Nov 19, 2026
Merged

0xShug0 merged 1 commit into
mainfrom
refactor/granite5asr-inference

Conversation

@0xShug0

@0xShug0 0xShug0 commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Granite5ASR rebuilt and allocated its encoder graph on every request. Retain the latest input shape in a session-owned PreparedGraph, batch independent GPU attention blocks, and keep the final partial block separate. CPU retains per-block attention.

All changes are model-local, including the model spec and usage documentation. No framework, GGML, CLI or server changes.

  • Reuse framework FFN modules, weight bindings, CTC frame argmax, residual primitives and weight-option parsing.
  • Reduce the default graph metadata arena from 1024 to 16 MiB, reserving more when the graph requires it; reduce weight-store metadata from 256 to 8 MiB.
  • Remove the unused special-token mask and redundant tokenizer JSON parsing.
  • Preserve confidence scoring, word timestamps, chunking and streaming behavior.

Validation

Default Q8 GGUF, Debug build, eight threads, RTX 5090 / Ryzen 9 7900X. Main-versus-branch comparisons match text, language, word timestamps and serialized confidence values on CUDA, Vulkan and CPU: 17 offline requests, nine streaming API requests, eight block-boundary requests and three same-shape input-change requests per backend and revision.

Coverage includes English/Japanese, chunking, long-to-short reuse, 127/128/129/256/257-frame boundaries, and replacing input content without changing its shape. Streaming remains the existing finalize-based transcription path.

Warmed repeated requests, sequential A→B→B→A, 16 measured samples per recording and revision:

Backend Recording Main RTF Refactor RTF
CUDA English, 14.225 s 0.00366 0.00281
CUDA Different English speaker, 2.51 s 0.00506 0.00452
CPU English, 14.225 s 0.02005 0.02048
CPU Different English speaker, 2.51 s 0.02323 0.02324

CUDA repeated requests improve by approximately 23% and 11%. CPU is approximately unchanged on the short clip and 2.1% slower on the longer clip. Mixed-shape timings varied: Vulkan RTF ranged from 0.00349–0.00700 on main versus 0.00333–0.00627 after refactoring; some CUDA/CPU mixed-shape samples were slower, so this is not a blanket performance-regression-free claim.

Benchmark peak VRAM remains essentially unchanged: CUDA 1276→1276 MiB; Vulkan 681→682 MiB.

Final Debug build and model-spec checks passed. Native BF16/F16 and HIP/Metal execution were not validated in this pass.

@0xShug0
0xShug0 merged commit ee499a1 into main Nov 19, 2026
7 checks passed
@0xShug0
0xShug0 deleted the refactor/granite5asr-inference branch November 19, 2026 06:18
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