| 3185 | fprintf(stderr, "ds4: warmed tensor pages in %.3fs (checksum=%llu)\n", |
| 3186 | t1 - t0, (unsigned long long)checksum); |
| 3187 | } |
| 3188 | |
| 3189 | /* ========================================================================= |
| 3190 | * Scalar Conversion and Quantized Tensor Kernels. |
| 3191 | * ========================================================================= |
| 3192 | * |
| 3193 | * These functions are the CPU reference math used by the C backend and by |
| 3194 | * Metal diagnostics. They implement only the tensor formats present in the |
| 3195 | * DeepSeek V4 Flash GGUF: F16, F32, Q8_0, Q2_K, IQ2_XXS, and Q8_K activation |
| 3196 | * blocks used for expert dot products. |
| 3197 | */ |
| 3198 | |
| 3199 | static inline float f16_to_f32(uint16_t h) { |
| 3200 | #if defined(__ARM_NEON) |
| 3201 | const float16x4_t hv = vreinterpret_f16_u16(vdup_n_u16(h)); |
| 3202 | return vgetq_lane_f32(vcvt_f32_f16(hv), 0); |
| 3203 | #else |
| 3204 | uint32_t sign = (uint32_t)(h & 0x8000) << 16; |
| 3205 | uint32_t exp = (h >> 10) & 0x1f; |
| 3206 | uint32_t mant = h & 0x03ff; |
no test coverage detected