Skip to main content

Module external_impls

Module external_impls 

Source
Expand description

Third-party type integrations.

When a user enables a *-crate feature, baracuda automatically teaches the external crate’s numeric types how to speak baracuda’s trait vocabulary. The impls here are intentionally one-way: we implement baracuda traits for the external types, never the other way around.

§half-crate

Implements [DeviceRepr] and [ValidAsZeroBits] for half::f16 and half::bf16. Both types are #[repr(transparent)] over u16 in the half crate, so zero bytes represent 0.0.

§f8-crate

Implements [DeviceRepr] and [ValidAsZeroBits] for float8::F8E4M3 and float8::F8E5M2. The float8 crate currently ships these two variants only; Fuel’s wider F4/F6/F8E8M0 coverage will require either a richer upstream crate or baracuda growing its own newtypes in crate::numeric.

§KernelArg

The crate::KernelArg blanket impl covers &T / &mut T for any T: DeviceRepr, so adding DeviceRepr here is enough to make these types usable as kernel arguments. Example:

use baracuda_types::KernelArg;
let h: half::f16 = half::f16::from_f32(1.0);
let _arg: *mut core::ffi::c_void = (&h).as_kernel_arg_ptr();