kornia/kornia-rs

[Perf]: Investigate restoring opt-level=3 for aarch64 cross-compilation

Open

#682 opened on Jan 28, 2026

View on GitHub
 (6 comments) (0 reactions) (1 assignee)Rust (188 forks)auto 404
bughelp wantedtriage

Repository metrics

Stars
 (675 stars)
PR merge metrics
 (PR metrics pending)

Description

Title: Investigate restoring opt-level=3 for aarch64 cross-compilation

Description

We currently override the optimization level for the aarch64-unknown-linux-gnu target to 2 in our cargo configuration:

[target.aarch64-unknown-linux-gnu]
rustflags = ["-Copt-level=2", "-Ctarget-feature=+fp16,+fhm"]

This workaround was introduced to bypass a compiler segfault (SIGSEGV) in LLVM's BranchProbabilityInfo pass when compiling the faer dependency with opt-level=3.

Downgrading to opt-level=2 potentially leaves performance on the table for our ARM builds (e.g., Jetson devices), which is critical for this project.

Goal

Determine if this workaround is still necessary with the latest stable rustc version.

Task

  1. Attempt to remove the -Copt-level=2 flag (reverting to the default or explicit 3).
  2. Cross-compile the project for aarch64-unknown-linux-gnu.
  3. If the build succeeds without crashing, benchmark the artifacts to verify performance gains and ensure runtime stability.
  4. If it still crashes, document the current rustc version and the specific LLVM error trace for upstream reporting.

Contributor guide