How Meetily Implements Cross-Platform GPU Acceleration: Metal, CUDA, and Vulkan Support

Meetily combines compile-time feature flags with runtime hardware detection to automatically configure the optimal GPU backend across macOS, Windows, and Linux without manual intervention.

Meetily, the open-source meeting transcription tool from Zackriya-Solutions/meetily, delivers cross-platform GPU acceleration through a hybrid architecture that bridges Rust's conditional compilation with dynamic system profiling. The implementation centers on the whisper_rs transcription engine, which targets platform-specific graphics APIs while maintaining a unified interface for CPU fallback. By leveraging Cargo features and hardware detection modules, Meetily automatically selects Metal on Apple devices, CUDA on NVIDIA hardware, or Vulkan for portable GPU compute.

Compile-Time Backend Selection via Feature Flags

The foundation of Meetily's GPU acceleration strategy resides in frontend/src-tauri/Cargo.toml, where optional features declare support for each graphics API. These features forward to the underlying whisper-rs crate, ensuring only the necessary backend code is compiled into the binary.

The available feature flags include:


# frontend/src-tauri/Cargo.toml

[features]
metal = ["whisper-rs/metal"]
cuda  = ["whisper-rs/cuda"]
vulkan = ["whisper-rs/vulkan"]
hipblas = ["whisper-rs/hipblas"]
coreml = ["whisper-rs/coreml"]

Platform-specific defaults in the Cargo.toml automatically enable the most appropriate backend for the target OS. macOS builds default to metal (and coreml for Apple Silicon), while Windows and Linux builds default to openblas for CPU-only operation unless the developer explicitly enables cuda, vulkan, or hipblas during compilation.

Runtime GPU Detection and Hardware Profiling

After compilation, Meetily determines actual hardware capabilities through the hardware_detector.rs module at frontend/src-tauri/src/audio/hardware_detector.rs. This component constructs a HardwareProfile by inspecting the operating system and environment variables to identify the available GPU type.

The detection logic specifically checks for:

  • Metal frameworks on macOS
  • CUDA installations via CUDA_PATH or CUDA_HOME environment variables
  • Vulkan SDKs through VULKAN_SDK or system libraries (/usr/lib/libvulkan.so, vulkan-1.dll)

The returned HardwareProfile contains:

  • has_gpu_acceleration: Boolean flag for GPU availability
  • gpu_type: Enum variant (Metal, Cuda, Vulkan, OpenCL, or None)
  • performance_tier: Resource classification from Low to Ultra based on CPU cores and memory

Mapping Compile-Time Backends to Runtime Configuration

The critical integration point between build features and hardware detection resides in frontend/src-tauri/src/whisper_engine/acceleration.rs. This module defines the WhisperCompiledBackend enum and the whisper_context_acceleration_for function, which synthesizes compile-time capabilities with runtime discovery.

The function accepts three parameters:

  1. Compiled backend: Which feature was enabled at build time (Metal, Cuda, Vulkan, HipBlas, or Cpu)
  2. Runtime GPU: The GpuType detected by the hardware profiler
  3. Performance tier: System classification derived from available resources

It returns a WhisperContextAcceleration struct configuring:

  • use_gpu: Enabled when the compiled backend matches detected hardware
  • flash_attn: Automatically activated for Metal and CUDA backends when the performance tier is High or Ultra
  • gpu_device: Currently defaults to 0 (first available device)

The selection logic implements the following rules:

let use_gpu = !matches!(compiled_backend, WhisperCompiledBackend::Cpu);
let fast_tier = matches!(performance_tier, PerformanceTier::High | PerformanceTier::Ultra);
let flash_attn = match compiled_backend {
    WhisperCompiledBackend::Metal | WhisperCompiledBackend::Cuda => fast_tier,
    _ => false,
};

Engine Initialization and Backend Activation

When WhisperEngine initializes in frontend/src-tauri/src/whisper_engine/whisper_engine.rs, the constructor invokes detect_gpu_acceleration() to log the active configuration and initialize the whisper-rs context. The engine prints diagnostic output indicating whether Metal, CUDA, Vulkan, or CPU-only mode is active, conditioned on the compile-time features present in the binary.

This architecture ensures that a macOS build automatically reports Metal acceleration, while a Windows build compiled without GPU features reports "CPU only" regardless of underlying hardware capabilities.

Practical Implementation Examples

To inspect hardware capabilities programmatically:

use crate::audio::hardware_detector::HardwareProfile;

let profile = HardwareProfile::detect();
println!(
    "GPU: {:?}, cores: {}, tier: {:?}",
    profile.gpu_type, profile.cpu_cores, profile.performance_tier
);

To create an engine instance with automatic backend selection:

use meetily::frontend::src_tauri::whisper_engine::WhisperEngine;

let engine = WhisperEngine::new()?; // Logs active backend (Metal, CUDA, Vulkan, etc.)

To manually configure acceleration settings:

use meetily::frontend::src_tauri::whisper_engine::{
    acceleration::{whisper_context_acceleration_for, WhisperCompiledBackend},
    GpuType, PerformanceTier,
};

let compiled = WhisperCompiledBackend::Cuda;
let runtime = GpuType::Cuda;
let tier = PerformanceTier::High;

let accel = whisper_context_acceleration_for(compiled, runtime, tier);
println!(
    "Using GPU: {}, FlashAttention: {}",
    accel.use_gpu, accel.flash_attn
);

Summary

  • Feature flags in Cargo.toml (metal, cuda, vulkan) determine which GPU backends are compiled into the Meetily binary
  • Runtime detection in hardware_detector.rs identifies the actual GPU type by checking environment variables and system libraries across platforms
  • The whisper_context_acceleration_for function in acceleration.rs maps compiled backends to detected hardware, automatically enabling Flash-Attention for high-performance Metal and CUDA devices
  • Platform defaults ensure macOS builds target Metal automatically, while Windows and Linux require explicit feature selection for GPU support
  • Engine initialization in whisper_engine.rs validates the configuration and initializes the whisper-rs context with the detected acceleration settings

Frequently Asked Questions

How does Meetily choose between Metal, CUDA, and Vulkan?

Meetily employs a two-stage selection process. First, compile-time feature flags in Cargo.toml restrict which backends are available in the compiled binary. Second, the hardware_detector.rs module performs runtime detection to identify which GPU is physically present on the host. The engine only enables acceleration when the compiled backend and detected hardware type match, falling back to CPU operation otherwise.

Can Meetily use GPU acceleration without an NVIDIA graphics card?

Yes. Meetily supports Metal for Apple Silicon and Intel Macs, Vulkan for AMD and Intel graphics on Windows/Linux, and HIPBLAS for AMD ROCm-compatible hardware. The hardware_detector.rs module checks for these alternatives by inspecting Metal frameworks on macOS or Vulkan libraries (libvulkan.so, vulkan-1.dll) on other platforms, enabling acceleration on diverse hardware configurations.

What is Flash-Attention and when does Meetily enable it?

Flash-Attention is a memory-efficient attention mechanism that reduces computational overhead during transcription. According to the source code in acceleration.rs, Meetily automatically enables Flash-Attention when the compiled backend is Metal or CUDA and the HardwareProfile reports a High or Ultra performance tier. This optimization remains disabled for CPU-only operation and Vulkan backends to ensure compatibility and stability.

How can I verify which GPU backend is active at runtime?

When initializing the WhisperEngine, the detect_gpu_acceleration() method in whisper_engine.rs prints a diagnostic log line indicating the active backend. You can also programmatically verify the configuration by calling HardwareProfile::detect() from hardware_detector.rs, which returns the specific GpuType variant detected on your system, or by inspecting the WhisperContextAcceleration struct returned by whisper_context_acceleration_for.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →