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

Function read_f32_binary_file

ds4.c:1273–1300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1271 * represented by the VM through shared zero-page bookkeeping. The CPU decode
1272 * KV cache grows one token at a time, so using calloc here can move thousands
1273 * of first-touch faults into generation. On Darwin we have observed this end
1274 * in a kernel cpt_mapcnt_inc overflow panic instead of a user-space error.
1275 *
1276 * Explicitly writing the zeroes while the cache is allocated keeps those VM
1277 * faults out of the token loop and gives the cache private resident pages.
1278 */
1279 memset(p, 0, total);
1280 return p;
1281}
1282
1283static double now_sec(void) {
1284 struct timespec ts;
1285 clock_gettime(CLOCK_MONOTONIC, &ts);
1286 return (double)ts.tv_sec + (double)ts.tv_nsec * 1.0e-9;
1287}
1288
1289/* =========================================================================
1290 * Metal Routed Expert Locality Profiler.
1291 * =========================================================================
1292 *
1293 * SSD streaming decode needs routed-expert locality data before a cache policy
1294 * is meaningful. This profiler is intentionally Metal-decode-only for now:
1295 * it reads the tiny selected-expert and route-weight tensors after router
1296 * selection, records histograms, and simulates per-layer latest-N unique expert
1297 * caches without changing normal inference when disabled.
1298 */
1299
1300enum { DS4_EXPERT_PROFILE_MAX_CAPS = 10 };
1301
1302static const uint32_t ds4_expert_profile_cap_candidates[DS4_EXPERT_PROFILE_MAX_CAPS] = {
1303 1, 2, 4, 8, 16, 32, 64, 128, 256, 384

Calls 1

statClass · 0.70

Tested by

no test coverage detected