Skip to content

Add GGML backend for GAME transcription - #2285

Open
KakaruHayate wants to merge 8 commits into
openutau:masterfrom
KakaruHayate:feat/game-ggml-backend
Open

Add GGML backend for GAME transcription#2285
KakaruHayate wants to merge 8 commits into
openutau:masterfrom
KakaruHayate:feat/game-ggml-backend

Conversation

@KakaruHayate

@KakaruHayate KakaruHayate commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a pluggable GAME inference backend abstraction while preserving the existing ONNX implementation
  • add a native GGML backend using the long-lived game_ggml_cli serve protocol
  • support independent GGML-only installation through a game-ggml-medium .oudep package
  • add an ONNX/GGML backend selector in Preferences with automatic fallback to an installed backend
  • load the active backend's own config.json, so GGML does not require the ONNX GAME package
  • handle process cancellation, stderr draining, Unix executable permissions, and paths containing spaces

Origin & Credits

This GGML backend grew out of KCKT0112/GAME-ggml
(native C++/ggml GAME inference — CPU/Metal/CUDA/Vulkan) and its web variant
KCKT0112/web-game (Web Generative
Adaptive MIDI Extractor). The model, operator set, and weight layout ported
there form the basis of the game.cpp
backend; the GAME PyTorch original remains
the parity reference.

Motivation

The GGML implementation runs GAME without ONNX Runtime model sessions or a Python runtime. The native backend supports Vulkan/CUDA on Windows and Linux, plus Metal on macOS, and keeps one model process alive for all chunks in a transcription request.

The backend is implemented in a separate project: KakaruHayate/game.cpp. It uses ggml and packages the native executable, runtime libraries, medium GGUF model, and GAME config as one OpenUtau dependency package.

Official packages (v0.1.1)

Ready-to-install .oudep files are published to the
KakaruHayate/game.cpp Releases:

platform full (F32) q8 (Q8_0)
Windows x64 game_ggml-windows-x64-vulkan.oudep + -cuda.oudep same names, -q8 suffix
Linux x64 ...-linux-x64-vulkan.oudep + ...-cuda.oudep same
Linux x64 ...-linux-x64-cpu.oudep same
macOS game_ggml-macos-{arm64,x64}-metal.oudep same

Download the archive for your platform, unzip it in OpenUtau's Dependencies
folder at Dependencies/game-ggml-medium/ (both the CLI and the GGUF live in
one package), restart OpenUtau, and select the GGML backend in Preferences.

Recommended GGML configuration

Full measurements in docs/benchmark-7channel.md
(60 s audio, no slicing, nsteps=8, frame-level metrics vs the torch-CUDA fp32
no-cache baseline — every EP ≥ 0.97 RPA):

platform GPU weights EP notes
Windows NVIDIA F32 CUDA (fallback Vulkan) 6–8 s wall
Windows Intel/AMD/etc F32 Vulkan 4–5 s, smallest VRAM (+0.3 GiB)
Windows integrated F32/Q8 CPU + DBCache 48.5→27.1 s (−44 %), quality-neutral
Linux NVIDIA F32 CUDA (fallback Vulkan) as Windows CUDA
Linux Nouveau/AMD F32 Vulkan as Windows Vulkan
macOS Apple Silicon F32 Metal (only EP) CI-built
macOS Intel F32 Metal (cross-compiled) CI-built

Rules of thumb:

  • GPU present → F32 weights; CPU-only → CPU EP with DBCache on by default (−44 % wall, quality-neutral).
  • On GPU, Vulkan = smallest VRAM, CUDA = fastest wall.
  • Q8 saves ~3.4× VRAM/RAM (near-lossless quality) but may flip a boundary note on Vulkan — use the -full package if you need bit-consistent output; both are valid in practice.
  • No user escalation needed: CLI picks backend from GGUF/EP and cache defaults by EP (GPU off, CPU auto).

Design

  • IGameBackend isolates model lifecycle, inference, cancellation, and configuration.
  • GameOnnxBackend is a behavior-preserving extraction of the existing four-model ONNX pipeline and retains native batching.
  • GameGgmlBackend starts game_ggml_cli serve <model.gguf> lazily, sends framed float32 waveform requests through stdin, and reads one-line JSON note responses from stdout.
  • GameBackendFactory resolves the user preference and falls back to an installed backend (ONNX first for compatibility).
  • GGML installation is considered valid only when the CLI, GGUF model, and adjacent config.json are all present.

Verification

On current openutau/OpenUtau:master:

  • GameGgmlBackendTest: 3 passed
  • dotnet test OpenUtau.Test: 209 passed
  • dotnet build OpenUtau.sln: 0 warnings, 0 errors
  • the Windows x64 Vulkan artifact from the linked run was launched with serve and returned {"type":"ready"}
  • the CUDA artifacts are built with CUDA Toolkit 12.6.3 (release architecture 7.5 with forward-compatible PTX) and verified for Toolkit discovery, compilation, linking, packaging, and PE import-table integrity; the GitHub-hosted runner has no NVIDIA driver, so the CUDA startup smoke test runs on a machine with an NVIDIA GPU
  • Windows and Linux artifact layouts and oudep.yaml manifests were checked against OpenUtau PackageManager expectations
  • CI (game.cpp @ main + v0.1.0) is green: prepare-model(F32+Q8) → 7 platform builds → 14 oudep packages → release

Notes

  • ONNX remains the default and preferred fallback when both packages are installed.
  • GGML currently processes one chunk per request; OpenUtau disables batch dispatch for this backend.
  • The .oudep package id is game-ggml-medium, independent from the existing ONNX game package.

- Introduce IGameBackend interface + GameBackendFactory for ONNX/GGML switching
- Extract original ONNX logic into GameOnnxBackend (zero behavior change)
- Add GameGgmlBackend driving game_ggml_cli serve over stdin/stdout protocol
  - Binary 36-byte request header + float32 waveform on stdin
  - JSON notes response on stdout, quit magic for clean shutdown
- Refactor Game.cs to thin orchestrator delegating to selected backend
- Add GameBackend preference (Preferences.cs + PreferencesViewModel + axaml)
- Add Seed to GameOptions for reproducible GGML runs
- Medium model support in GAME-ggml (StageCtx memory/graph-node bumps)
- Add serve subcommand to game_ggml_cli (long-lived mode, binary protocol)
- Patch Dependencies.cmake: pocketfft gitlab → github/mreineck mirror (gitlab
  was returning 502; commit 32424d206 exists in mreineck mirror)
- Fix rng.cpp: missing <string> include (exposed by strict C++17 mode)

Co-authored-by: KakaruHayate <kakaru.hk@hotmail.com>
KakaruHayate added a commit to KakaruHayate/OpenUtau that referenced this pull request Aug 17, 2026
docs: recommended GGML EP config (sync from PR openutau#2285)
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