Add riscv half-precision floating point detection#375
Open
ken-unger wants to merge 4 commits intopytorch:mainfrom
Open
Add riscv half-precision floating point detection#375ken-unger wants to merge 4 commits intopytorch:mainfrom
ken-unger wants to merge 4 commits intopytorch:mainfrom
Conversation
fbarchard
approved these changes
Mar 4, 2026
Collaborator
fbarchard
left a comment
There was a problem hiding this comment.
LG. can you confirm this is vector arithmetics and is there a different detect for conversion?
another isa that would be great to detect is the 8 bit dot product
Author
|
Thanks. zfh is scalar while zvfh is vector arithmetics, and both include
the respective conversion instructions. Platforms only supporting
conversion, without arithmetics, include the minimal subset isa zfhmin and
zvfhmin respectively. My exposure is limited to sifive x280 and spacemit
x60 (bpi-f3) which both support the full zfh/zvfh isa. However, for other
(unknown) platforms we could add a cpuinfo_has_riscv_zfhmin() and
cpuinfo_has_riscv_zvfhmin() in a future PR.
model name : Spacemit(R) X60
isa :
rv64imafdcv_zicbom_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zfhmin_zca_zcd_zba_zbb_zbc_zbs_zkt_zve32f_zve32x_zve64d_zve64f_zve64x_zvfh_zvfhmin_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt
The 8 bit dot product would indeed be great to detect and expose, but that
standard is not yet ratified. There is a sifive x280 proprietary extension
Xsfvqmaccqoq (Int8 Matrix Multiplication Instructions - 4x8x4) which I may
look to add in future, and which is currently exposed in hwprobe. (
https://docs.kernel.org/arch/riscv/hwprobe.html).
…On Wed, Mar 4, 2026 at 1:24 AM fbarchard ***@***.***> wrote:
***@***.**** approved this pull request.
LG. can you confirm this is vector arithmetics and is there a different
detect for conversion?
another isa that would be great to detect is the 8 bit dot product
—
Reply to this email directly, view it on GitHub
<#375 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZ2FOVOCPFGU2N474HK5ATD4O7Y4FAVCNFSM6AAAAACWF65DZGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTQOBYGE3DONJRHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
fbarchard
approved these changes
Mar 5, 2026
Collaborator
|
Perfect. For XNNPack running on SiFive X280 its supposed to have zfh/zvfh, but the qemu I use doesnt support fp16, and cpuinfo didnt detect them. |
Author
|
Is there a maintainer who could review and merge (if accepted) this PR? Thank you. |
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.
Add cpuinfo_has_riscv_zfh() and cpuinfo_has_riscv_zvfh for fp16 detection.
The motivation here is to enable this runtime detection support in xnnpack for its rvv fp16 kernels. (xnnpack uses this library)