类 | |
| 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()
|
inline |
Dequantize all.
引用了 bytes, dequantValue(), group , 以及 scales.
被这些函数引用 eve::tensor::Tensor::dequantized().
◆ dequantValue()
|
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.
引用了 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()
|
inline |
Efm max magnitude.
Largest finite magnitude of an e/m format (used for block scaling).
Ldexp.
引用了 bias.
被这些函数引用 quantize().
◆ f16ToF32()
|
inline |
◆ f32ToF16()
|
inline |
◆ f32ToFp4E2M1()
|
inline |
◆ f32ToFp8E4M3()
|
inline |
◆ floatToEfm()
|
inline |
◆ fp4E2M1ToF32()
|
inline |
◆ fp8E4M3ToF32()
|
inline |
◆ isQuantDType()
|
inline |
True when quant d type.
True for the weight-quantization dtypes (stored packed, dequantized on use).
引用了 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()
|
inline |
Quant byte size.
Bytes needed to store count elements of dt (int4/fp4 pack two per byte).
引用了 count, eve::tensor::Fp16, eve::tensor::Fp4E2M1, eve::tensor::Fp8E4M3, eve::tensor::Int4 , 以及 eve::tensor::Int8.
被这些函数引用 quantize().
◆ quantize()
|
inline |
Quantize.
Efm max magnitude.
Memcpy.
引用了 begin, count, efmMaxMagnitude(), end, f32ToF16(), f32ToFp4E2M1(), f32ToFp8E4M3(), eve::tensor::Fp16, eve::tensor::Fp4E2M1, eve::tensor::Fp8E4M3, g, group, eve::tensor::q::QuantPayload::group, groups, h, eve::tensor::Int4, eve::tensor::Int8, p, quantByteSize(), scale , 以及 v.
被这些函数引用 eve::tensor::TF::quantizeWeight().