Skip to content

Support Apple CoreML acceleration for local AI denoise model (8x faster on Mac) #1239

Open
jtalboom wants to merge 3 commits into
CyberTimon:mainfrom
jtalboom:feature/coreml-hardware-acceleration
Open

Support Apple CoreML acceleration for local AI denoise model (8x faster on Mac) #1239
jtalboom wants to merge 3 commits into
CyberTimon:mainfrom
jtalboom:feature/coreml-hardware-acceleration

Conversation

@jtalboom
Copy link
Copy Markdown

@jtalboom jtalboom commented Jun 3, 2026

Description

This PR introduces two enhancements to RapidRAW:

  1. Local AI Hardware Acceleration (CoreML Toggle): Adds an opt-in toggle under Settings for macOS users. When enabled, the local AI Denoise model is accelerated using Apple's Neural Engine and GPU via CoreML (CoreMLExecutionProvider in ort). To ensure numerical stability and maximize compatibility (since models like LaMa/CLIP fail CoreML compilation due to dynamic axes), the switch is restricted solely to the Denoising model and is disabled by default.
  2. Denoise Timer: Adds an elapsed execution timer within the Denoise Modal. It shows running elapsed seconds during active processing and displays a final completion duration once finished.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Performance improvement
  • Code refactoring
  • Documentation update
  • UI/UX improvement
  • Build/CI or Dependency update

Changes Made

Rust Backend (src-tauri)

  • AI Session Factory: Added create_session(app_handle, model_path) in src-tauri/src/ai_processing.rs to exclusively handle CoreML initialization for the Denoise model. SAM, LaMa, and CLIP remain natively bound to CPU execution.
  • App Settings: Added enable_denoise_hardware_acceleration to AppSettings in src-tauri/src/app_settings.rs (defaults to false).

React Frontend (src)

  • Settings UI: Added the macOS-only "Denoise Hardware Acceleration" toggle in SettingsPanel.tsx.
  • Properties Definition: Updated AppSettings interface in AppProperties.tsx to include enableDenoiseHardwareAcceleration.
  • Denoise Modal Timer:
    • Added a timer inside DenoiseModal.tsx that tracks elapsed duration in elapsedTime state.
    • Added UI feedback showing active elapsed time and completed duration.
  • Localization: Added translation keys in English (en.json) and German (de.json).

Screenshots/Videos

  • AI Hardware Acceleration Switch in settings:
Denoising_setting
  • Denoise timer in progress:
Denoising_timer

Testing

  • I have tested these changes locally and confirmed that they work as expected without issues

Test Configuration:
I used a MacBook Air M5 24GB on MacOS 26.5.1

Benchmark Results (Denoise):

  • CPU execution (Hardware Acceleration disabled): 109.82 seconds
Denoising_CoreML_Off
  • CoreML execution (Hardware Acceleration enabled): 13.14 seconds (8.3x speedup)
Denoising_CoreML_On

Checklist

  • My code follows the project's code style
  • I haven't added unnecessary AI-generated code comments
  • My changes generate no new warnings or errors

Additional Notes

  • The CoreML toggle is visible on macOS only.
  • Hardware Acceleration is explicitly bound only to the Denoise pipeline to bypass CoreML compiler limits (error code -7) present in the Transformer models.

AI Disclaimer

  • This PR is entirely AI-generated
  • This PR is AI-generated but guided by a human
  • This PR was handwritten with AI assistance
  • This PR contains only blood, sweat, and coffee (AI-free)

@jtalboom jtalboom requested a review from CyberTimon as a code owner June 3, 2026 20:59
@jtalboom jtalboom changed the title Feature/coreml hardware acceleration Support Apple CoreML acceleration for local AI denoise model (8x faster on Mac) Jun 4, 2026
Joep Talboom added 2 commits June 6, 2026 19:50
Introduces an opt-in toggle in the settings to enable Apple's CoreML Hardware Acceleration (Neural Engine/GPU) for the local Denoise model. The default safely remains pure CPU execution to ensure maximum numerical precision and stability, allowing users to test hardware acceleration when needed.
Adds an elapsed execution timer within the Denoise Modal. Shows running elapsed seconds during active processing and displays the final completion duration once the process finishes.
@jtalboom jtalboom force-pushed the feature/coreml-hardware-acceleration branch from 32bc5d2 to b624620 Compare June 7, 2026 18:26
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