MCPcopy Create free account
hub / github.com/antirez/ds4 / tensor_expect_plain_layout

Function tensor_expect_plain_layout

ds4.c:3187–3203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
3199static 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;

Callers 1

Calls 3

ds4_dieFunction · 0.85
tensor_type_nameFunction · 0.85
tensor_expect_layoutFunction · 0.85

Tested by

no test coverage detected