载入中...
搜索中...
未找到
eve::tensor::q 命名空间参考

类

struct  QuantPayload
 QuantPayload public API. 更多...
 

函数

bool isQuantDType (DType dt)
 True when quant d type.
 
int quantByteSize (DType dt, int count)
 Quant byte size.
 
uint16_t f32ToF16 (float x)
 F 32 to f 16.
 
float f16ToF32 (uint16_t h)
 F 16 to f 32.
 
float fp8E4M3ToF32 (uint8_t v)
 Fp 8 e 4 m 3 to f 32.
 
float fp4E2M1ToF32 (uint8_t nib)
 Fp 4 e 2 m 1 to f 32.
 
uint32_t floatToEfm (float x, int expBits, int manBits, int bias)
 Float to efm.
 
uint8_t f32ToFp8E4M3 (float x)
 F 32 to fp 8 e 4 m 3.
 
uint8_t f32ToFp4E2M1 (float x)
 F 32 to fp 4 e 2 m 1.
 
float efmMaxMagnitude (int expBits, int manBits, int bias)
 Efm max magnitude.
 
float dequantValue (DType dt, const uint8_t *bytes, const float *scales, int group, int idx)
 Dequant value.
 
void dequantizeAll (DType dt, const uint8_t *bytes, const float *scales, int group, int count, float *out)
 Dequantize all.
 
QuantPayload quantize (const float *src, int count, DType dt, int group)
 Quantize.
 

函数说明

◆ dequantizeAll()

void eve::tensor::q::dequantizeAll ( DType  dt,
const uint8_t *  bytes,
const float *  scales,
int  group,
int  count,
float *  out 
)
inline

Dequantize all.

在文件 Quant.h 第 234 行定义.

引用了 bytes, dequantValue(), group , 以及 scales.

被这些函数引用 eve::tensor::Tensor::dequantized().

◆ dequantValue()

float eve::tensor::q::dequantValue ( DType  dt,
const uint8_t *  bytes,
const float *  scales,
int  group,
int  idx 
)
inline

Dequant value.

Memcpy.

F 16 to f 32.

Fp 8 e 4 m 3 to f 32.

Float.

Fp 4 e 2 m 1 to f 32.

Float.

在文件 Quant.h 第 197 行定义.

引用了 bytes, f16ToF32(), eve::tensor::Fp16, eve::tensor::Fp4E2M1, fp4E2M1ToF32(), eve::tensor::Fp8E4M3, fp8E4M3ToF32(), group, h, idx, eve::tensor::Int4, eve::tensor::Int8, scales , 以及 v.

被这些函数引用 dequantizeAll() , 以及 eve::tensor::Tensor::get().

◆ efmMaxMagnitude()

float eve::tensor::q::efmMaxMagnitude ( int  expBits,
int  manBits,
int  bias 
)
inline

Efm max magnitude.

Largest finite magnitude of an e/m format (used for block scaling).

Ldexp.

在文件 Quant.h 第 188 行定义.

引用了 bias.

被这些函数引用 quantize().

◆ f16ToF32()

float eve::tensor::q::f16ToF32 ( uint16_t  h)
inline

F 16 to f 32.

Memcpy.

在文件 Quant.h 第 63 行定义.

引用了 f, h , 以及 m.

被这些函数引用 dequantValue().

◆ f32ToF16()

uint16_t eve::tensor::q::f32ToF16 ( float  x)
inline

F 32 to f 16.

Memcpy.

Uint 16 t.

Uint 16 t.

在文件 Quant.h 第 37 行定义.

引用了 b, m , 以及 x.

被这些函数引用 quantize().

◆ f32ToFp4E2M1()

uint8_t eve::tensor::q::f32ToFp4E2M1 ( float  x)
inline

F 32 to fp 4 e 2 m 1.

Uint 8 t.

在文件 Quant.h 第 181 行定义.

引用了 floatToEfm() , 以及 x.

被这些函数引用 quantize().

◆ f32ToFp8E4M3()

uint8_t eve::tensor::q::f32ToFp8E4M3 ( float  x)
inline

F 32 to fp 8 e 4 m 3.

Uint 8 t.

在文件 Quant.h 第 175 行定义.

引用了 floatToEfm() , 以及 x.

被这些函数引用 quantize().

◆ floatToEfm()

uint32_t eve::tensor::q::floatToEfm ( float  x,
int  expBits,
int  manBits,
int  bias 
)
inline

Float to efm.

Round-trip encode of an arbitrary float into a tiny e/m format (nearest, via a cached value table + binary search — no per-element exponential math).

EfmEntry public API.

Ldexp.

Sort.

Fabs.

在文件 Quant.h 第 122 行定义.

引用了 a, ax, b, best, bias, m, mid, v, value , 以及 x.

被这些函数引用 f32ToFp4E2M1() , 以及 f32ToFp8E4M3().

◆ fp4E2M1ToF32()

float eve::tensor::q::fp4E2M1ToF32 ( uint8_t  nib)
inline

Fp 4 e 2 m 1 to f 32.

在文件 Quant.h 第 109 行定义.

引用了 m , 以及 v.

被这些函数引用 dequantValue().

◆ fp8E4M3ToF32()

float eve::tensor::q::fp8E4M3ToF32 ( uint8_t  v)
inline

Fp 8 e 4 m 3 to f 32.

Memcpy.

在文件 Quant.h 第 91 行定义.

引用了 f, m , 以及 v.

被这些函数引用 dequantValue().

◆ isQuantDType()

bool eve::tensor::q::isQuantDType ( DType  dt)
inline

True when quant d type.

True for the weight-quantization dtypes (stored packed, dequantized on use).

在文件 Quant.h 第 17 行定义.

引用了 eve::tensor::Fp16, eve::tensor::Fp4E2M1, eve::tensor::Fp8E4M3, eve::tensor::Int4 , 以及 eve::tensor::Int8.

被这些函数引用 eve::tensor::wgsl_detail::genEmbedding(), eve::tensor::glsl_detail::genEmbedding(), eve::tensor::glsl_detail::genMatMul(), eve::tensor::wgsl_detail::genMatMul() , 以及 eve::tensor::TF::quantizeWeight().

◆ quantByteSize()

int eve::tensor::q::quantByteSize ( DType  dt,
int  count 
)
inline

Quant byte size.

Bytes needed to store count elements of dt (int4/fp4 pack two per byte).

在文件 Quant.h 第 24 行定义.

引用了 count, eve::tensor::Fp16, eve::tensor::Fp4E2M1, eve::tensor::Fp8E4M3, eve::tensor::Int4 , 以及 eve::tensor::Int8.

被这些函数引用 quantize().

◆ quantize()

QuantPayload eve::tensor::q::quantize ( const float *  src,
int  count,
DType  dt,
int  group 
)
inline