ARM NEON NF4 lookup table (16 float values indexed by 4-bit code)
| 42 | |
| 43 | // ARM NEON NF4 lookup table (16 float values indexed by 4-bit code) |
| 44 | static inline void neon_nf4_lut(float32x4_t lut[4]) { |
| 45 | // Indices 0-15 map to NF4 dequantized values |
| 46 | // Order: index 0 = -1.0, index 1 = -0.6962, ..., index 7 = 0.0, ..., index 15 = 1.0 |
| 47 | static const float nf4_values[16] = { |
| 48 | -1.0f, |
| 49 | -0.6961928009986877f, |
| 50 | -0.5250730514526367f, |
| 51 | -0.39491748809814453f, |
| 52 | -0.28444138169288635f, |
| 53 | -0.18477343022823334f, |
| 54 | -0.09105003625154495f, |
| 55 | 0.0f, |
| 56 | 0.07958029955625534f, |
| 57 | 0.16093020141124725f, |
| 58 | 0.24611230194568634f, |
| 59 | 0.33791524171829224f, |
| 60 | 0.44070982933044434f, |
| 61 | 0.5626170039176941f, |
| 62 | 0.7229568362236023f, |
| 63 | 1.0f |
| 64 | }; |
| 65 | lut[0] = vld1q_f32(nf4_values); |
| 66 | lut[1] = vld1q_f32(nf4_values + 4); |
| 67 | lut[2] = vld1q_f32(nf4_values + 8); |
| 68 | lut[3] = vld1q_f32(nf4_values + 12); |
| 69 | } |
| 70 | |
| 71 | // ARM NEON FP4 lookup table |
| 72 | static inline void neon_fp4_lut(float32x4_t lut[4]) { |
no outgoing calls
no test coverage detected