mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
fix (#2701)
This commit is contained in:
@@ -1,5 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
struct __nv_fp8_e8m0 {
|
||||||
|
__device__ __nv_fp8_e8m0(uint8_t x) : __x(x) {}
|
||||||
|
|
||||||
|
__device__ operator float() {
|
||||||
|
if (__x == 0xFF) {
|
||||||
|
return std::numeric_limits<float>::quiet_NaN();
|
||||||
|
}
|
||||||
|
return std::ldexp(1.0f, static_cast<int>(__x) - 127);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t __x{0};
|
||||||
|
};
|
||||||
|
|
||||||
struct __nv_fp4_e2m1 {
|
struct __nv_fp4_e2m1 {
|
||||||
__device__ __nv_fp4_e2m1(float x) {
|
__device__ __nv_fp4_e2m1(float x) {
|
||||||
if (std::isnan(x)) {
|
if (std::isnan(x)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user