Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Support for half float #341

Open
amithmath opened this issue Mar 30, 2021 · 5 comments
Open

Support for half float #341

amithmath opened this issue Mar 30, 2021 · 5 comments

Comments

@amithmath
Copy link

Is there any support for half precision floating point/bfloat in RISC-V gcc/g++?

@jim-wilson
Copy link
Collaborator

The zfh extension for IEEE binary16 support isn't frozen yet, so not in the FSF GCC tree yet. But there is support for it on branches with zfh in the name. There is also support for it on the rvv-intrinsic branch as the Vector extension is expected to be used in combination with the zfh extension. Just add _zfh to the -march option, e.g. -march=rv64gc_zfh to enable it. It is also supported in recent versions of the SiFive toolchain. And there is support in LLVM too, but I don't know the details as I don't follow LLVM development.

I'm not aware of any bfloat support as yet.

@amithmath
Copy link
Author

I think SiFive toochain, are you point to: https://github.com/sifive/freedom-tools ? But I am unable to locate ./configure in order to enable -march=rv64gc_zfh

@jim-wilson
Copy link
Collaborator

You build the toolchain normally (or download a binary from our web site). And then when you run gcc you add the -march=rv64gc_zfh or similar option to get half float support.

@amithmath
Copy link
Author

OK, I think rv64 means risc-v 64? I am using RISC-V32, I think in this case when I run gcc -march=rv32gc_zfh?

@jim-wilson
Copy link
Collaborator

Yes. Add _zfh to whatever arch you are currently using.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants