Closed srush closed 1 year ago
You can do this with half, or you can to_bits()
it into u16
, or pass it as a byte slice, the kernel launching does not check if parameter types are right, so it doesn't really care what the input is, as long as it turns into the expected bytes.
If any one else is curious, I ended up doing it with half / newtype.
#[derive(Default, Clone, Copy, Debug)]
struct F16(f16);
unsafe impl DeviceCopy for F16 {}
...
let t: [F16; OUT] = [F16(f16::from_f32(0.0)); OUT];
t.as_dbuf()?,
Works great!
I was curious what the state of passing in fp16 buffers was in Cust? I'm not trying to do anything fancy, just pass in fp16 to an existing PTX function not written in Rust. Can this be done currently with half or similar libraries? Do I need to encode this myself?