Skip to content

aarch64: gate FP16 vector helpers with target_feature - #47

Draft
kpernyer wants to merge 1 commit into
sarah-quinones:mainfrom
kpernyer:fix/aarch64-fp16-vector-target-feature
Draft

aarch64: gate FP16 vector helpers with target_feature#47
kpernyer wants to merge 1 commit into
sarah-quinones:mainfrom
kpernyer:fix/aarch64-fp16-vector-target-feature

Conversation

@kpernyer

@kpernyer kpernyer commented Aug 9, 2026

Copy link
Copy Markdown

What changed

Adds #[target_feature(enable = "fp16")] to the four aarch64 NEON vector FP16 inline-assembly helpers in gemm-common:

  • vmulq_f16
  • vaddq_f16
  • vfmaq_f16
  • vfmaq_laneq_f16

Why

These helpers emit Full FP16 instructions but were not target-feature-gated, unlike the scalar FP16 helpers nearby. Generic aarch64-unknown-linux-gnu code generation therefore rejects them with instruction requires: fullfp16.

Keeping the feature requirement on the functions preserves GEMM's runtime FP16 dispatch. Globally enabling +fp16 is not portable because runtime feature detection becomes compile-time true for that build.

Fixes #46.

Validation

  • cargo fmt --check
  • CARGO_HOME=/tmp/gemm-fp16-cargo-home CARGO_TARGET_DIR=/tmp/gemm-fp16-target-generic cargo test --package gemm-common --package gemm-f16

The targeted test command was run on Linux aarch64 with a clean Cargo configuration, so the machine-wide +fp16 override was not in effect. cargo test --workspace was also attempted but is currently blocked before tests by a missing system fontconfig development package (fontconfig.pc) required by an unrelated dependency.

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.

aarch64: gate NEON FP16 vector helpers with target_feature

1 participant