Skip to content

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.

2 participants