Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Half-float support #354

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Half-float support #354

wants to merge 4 commits into from

Conversation

Akaricchi
Copy link
Member

Currently used to reduce bandwidth usage of sprite attribute uploads. Not sure if worth it yet.

Tries to use the compiler's native float16 type, such as _Float16 or
__fp16 first. This is the best case, because these conversions can
compile to single asm instructions on supported architectures, falling
back to calling a generic routine from the runtime library (libgcc or
compiler-rt).

Failing that, we'll try to call the rt library routines directly. This
is tricky, because there are no headers for those, and we must get the
ABI right. We must compile and run some code to detect the ABI, which is
not always possible when cross-compiling. For that reason, you can set
the `float16_rt_abi` property to either `native`, `integer`, or `none`
in the cross file.

The `native` ABI assumes that float16s are passed as the compiler's
_Float16 type (e.g. in xmm registers on x86_64). This is currently not
very useful, since on compilers that have _Float16 we'll simply use the
intrinsic conversions.

The `integer` ABI assumes that float16s are passed as uint16_t.

`none` means that no attempt to use the runtime library routines will be
made, even if they exist.

If we can use neither intrinsic conversions nor the runtime library,
we'll fall back to questionable bit hackery. This method currently does
not support infinities and NaNs.
These can be optimized into SIMD operations in some cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant