aarch64: gate FP16 vector helpers with target_feature - #47
Draft
kpernyer wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Adds
#[target_feature(enable = "fp16")]to the four aarch64 NEON vector FP16 inline-assembly helpers ingemm-common:vmulq_f16vaddq_f16vfmaq_f16vfmaq_laneq_f16Why
These helpers emit Full FP16 instructions but were not target-feature-gated, unlike the scalar FP16 helpers nearby. Generic
aarch64-unknown-linux-gnucode generation therefore rejects them withinstruction requires: fullfp16.Keeping the feature requirement on the functions preserves GEMM's runtime FP16 dispatch. Globally enabling
+fp16is not portable because runtime feature detection becomes compile-time true for that build.Fixes #46.
Validation
cargo fmt --checkCARGO_HOME=/tmp/gemm-fp16-cargo-home CARGO_TARGET_DIR=/tmp/gemm-fp16-target-generic cargo test --package gemm-common --package gemm-f16The targeted test command was run on Linux aarch64 with a clean Cargo configuration, so the machine-wide
+fp16override was not in effect.cargo test --workspacewas also attempted but is currently blocked before tests by a missing systemfontconfigdevelopment package (fontconfig.pc) required by an unrelated dependency.