Skip to content

fix(sys): stop regenerating bindings for vulkan builds - #32

Open
xqqmdy wants to merge 3 commits into
OneNoted:mainfrom
xqqmdy:fix/sys-vulkan-bindings
Open

xqqmdy wants to merge 3 commits into
OneNoted:mainfrom
xqqmdy:fix/sys-vulkan-bindings

Conversation

@xqqmdy

@xqqmdy xqqmdy commented Oct 30, 2026 •

Copy link
Copy Markdown

Summary

Vulkan builds force bindgen at build time (since 6a52094) to pick up the ggml_backend_vk_* symbols. That regeneration is untrustworthy on modern libclang: with clang >= 22, bindgen cannot lay out whisper_full_params (nested anonymous structs) and emits an opaque { _address: u8 } stub, which corrupts the params ABI passed to whisper_full (known issue, see e.g. Zackriya-Solutions/meetily#428; clang 23.1.3 reproduces). GitHub CI (ubuntu-latest, clang 18) does not hit this, which is why the regeneration path looks healthy there, but it breaks vulkan builds for users on rolling distros (Arch etc.).

This keeps the intent of 6a52094 (vk symbols available to whisper-rs) but bakes them in instead: src/bindings.rs regenerated once with bindgen 0.71.1 + libclang 18.1.1 and committed. No build-time bindgen, no hand-written FFI. Regeneration instructions are documented in build.rs.

The diff vs the previous bundled bindings is limited to the ggml-vulkan additions and glibc 2.44-vs-2.41 header noise (_IO_FILE tail fields, _POSIX_C_SOURCE); no whisper.h structure changed and none of the glibc-touched fields are ever dereferenced.

Also allows the rustc 1.99 unnecessary_transmutes lint for the generated bitfield accessors: bindgen 0.71 still emits transmute style, and switching to cast_unsigned would raise the toolchain floor above the crate's declared MSRV (cast_unsigned stabilized in 1.87 > MSRV 1.85).

Verification

  • Build + layout asserts compile under clang 18 and clang 23 paths
  • RADV RDNA4 (RX 9070 XT): device enumeration and end-to-end GPU transcription of a 10.7s sample produce correct output
  • Full local CI green (fmt / clippy / tests / all feature checks incl. vulkan / package / release bundle)

Stack note: This is one of four single-commit PRs reviewed bottom-up:

Until the lower PRs merge, "Files changed" also shows their commits. The stacking exists because the local pre-push hook runs full CI on the working tree: on clang >= 22 machines the vulkan feature check cannot build without PR 3, and clippy 1.99 fails without PR 1, so each branch needs the ones below it to be locally verifiable. PRs 1–2 are independently green on GitHub CI (clang 18).

clippy 1.99 (useless_borrows_in_formatting) denies these under -D warnings;
local pre-push CI runs clippy with a newer toolchain than the one that last
touched src/ui.rs, so the hook fails on main without this.
setup_label embeds ANSI styling via tier_token, so asserting on the raw
string fails on terminals that force colors (CLICOLOR_FORCE=1), e.g. when
the pre-push hook runs cargo test from an interactive shell. Strip the
escape codes before asserting.
Vulkan builds forced bindgen at build time (upstream 6a52094) to pick up
the ggml_backend_vk_* symbols. That regeneration is untrustworthy on
modern libclang: with clang >= 22, bindgen cannot lay out
whisper_full_params (nested anonymous structs) and emits an opaque
{ _address: u8 } stub, corrupting the params ABI passed to whisper_full
(known issue, see e.g. meetily#428; clang 23.1.3 reproduces). GitHub
CI's ubuntu-latest ships clang 18 and does not hit this, which is why
the regeneration path looked healthy there.

Instead, bake the ggml_backend_vk_* declarations into the bundled
bindings: regenerate src/bindings.rs once with bindgen 0.71.1 +
libclang 18.1.1 (instructions in build.rs) and commit it. This keeps
upstream's intent (vk symbols available) without any build-time bindgen.

The diff vs the previous bundled bindings is limited to the ggml-vulkan
additions and glibc 2.44-vs-2.41 header noise (_IO_FILE tail fields,
_POSIX_C_SOURCE); no whisper.h structure changed and none of the
glibc-touched fields are ever dereferenced. Verified on RADV RDNA4:
device enumeration and end-to-end transcription with GPU acceleration.

Also allow the rustc 1.99 unnecessary_transmutes lint for the generated
bitfield accessors (bindgen 0.71 still emits transmute style; switching
to cast_unsigned would raise the toolchain floor above the crate's
declared MSRV).
@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f046bc58-b873-4155-ae2a-7064eca3579b
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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