LoongArch64 FP16 hardware support#131
Merged
VoidStarKat merged 1 commit intoVoidStarKat:mainfrom Sep 11, 2025
heiher:loong64-fp16
Merged
LoongArch64 FP16 hardware support#131VoidStarKat merged 1 commit intoVoidStarKat:mainfrom heiher:loong64-fp16
VoidStarKat merged 1 commit intoVoidStarKat:mainfrom
heiher:loong64-fp16
Conversation
LoongArch is a RISC instruction set architecture and currently a Tier-2
(with host-tools) target [^1] in the Rust upstream community.
This patch introduces FP16 conversion functions based on the LoongArch
SIMD extension to improve performance.
Benchmarks:
```
HalfFloatSliceExt::convert_from_f32_slice/constants
time: [10.816 ns 10.823 ns 10.831 ns]
change: [-63.769% -63.728% -63.693%] (p = 0.00 < 0.05)
Performance has improved.
HalfFloatSliceExt::convert_from_f32_slice/large
time: [137.68 ns 137.77 ns 137.88 ns]
change: [-94.847% -94.841% -94.834%] (p = 0.00 < 0.05)
Performance has improved.
HalfFloatSliceExt::convert_from_f64_slice/constants
time: [12.656 ns 12.669 ns 12.684 ns]
change: [-78.455% -78.418% -78.367%] (p = 0.00 < 0.05)
Performance has improved.
HalfFloatSliceExt::convert_from_f64_slice/large
time: [544.15 ns 544.49 ns 544.91 ns]
change: [-89.799% -89.791% -89.781%] (p = 0.00 < 0.05)
Performance has improved.
HalfFloatSliceExt::convert_to_f32_slice/constants
time: [6.0412 ns 6.0442 ns 6.0482 ns]
change: [-74.100% -74.068% -74.042%] (p = 0.00 < 0.05)
Performance has improved.
HalfFloatSliceExt::convert_to_f32_slice/large
time: [512.78 ns 513.08 ns 513.45 ns]
change: [-77.628% -77.526% -77.422%] (p = 0.00 < 0.05)
Performance has improved.
HalfFloatSliceExt::convert_to_f64_slice/constants
time: [10.779 ns 10.784 ns 10.792 ns]
change: [-49.028% -48.922% -48.813%] (p = 0.00 < 0.05)
Performance has improved.
HalfFloatSliceExt::convert_to_f64_slice/large
time: [923.19 ns 923.77 ns 924.50 ns]
change: [-80.876% -80.862% -80.849%] (p = 0.00 < 0.05)
Performance has improved.
```
[^1]: https://doc.rust-lang.org/stable/rustc/platform-support/loongarch-linux.html
Alexhuszagh
referenced
this pull request
in Alexhuszagh/float16
Sep 21, 2025
LoongArch64 FP16 hardware support
|
@heiher This causes the crate to fail to build on stable. The usage of nightly features should be gated behind a Cargo feature. |
Contributor
Author
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.
LoongArch is a RISC instruction set architecture and currently a Tier-2 (with host-tools) target 1 in the Rust upstream community.
This patch introduces FP16 conversion functions based on the LoongArch SIMD extension to improve performance.
Benchmarks:
Footnotes
https://doc.rust-lang.org/stable/rustc/platform-support/loongarch-linux.html ↩