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

Function cli_prefill_progress_cb

ds4_cli.c:243–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241 return DS4_BACKEND_METAL;
242#else
243 return DS4_BACKEND_CUDA;
244#endif
245}
246
247static void log_context_memory(ds4_backend backend,
248 int ctx_size,
249 uint32_t prefill_chunk,
250 bool ssd_streaming) {
251 ds4_context_memory m =
252 ds4_context_memory_estimate_with_prefill_mode(backend,
253 ctx_size,
254 prefill_chunk,
255 ssd_streaming);
256 const uint64_t kv_bytes = m.raw_bytes + m.compressed_bytes;
257 const uint64_t total_bytes = kv_bytes + m.scratch_bytes;
258 const bool color = ds4_log_is_tty(stderr);
259 const char *green = color ? "\x1b[32m" : "";
260 const char *bright_green = color ? "\x1b[1;32m" : "";
261 const char *reset = color ? "\x1b[0m" : "";
262 fprintf(stderr,
263 "%sds4: memory: KV %.2f GiB (raw %.2f + compressed %.2f) "
264 "+ buffers %.2f GiB = %s%.2f GiB context%s\n",
265 green,
266 (double)kv_bytes / 1073741824.0,
267 (double)m.raw_bytes / 1073741824.0,
268 (double)m.compressed_bytes / 1073741824.0,
269 (double)m.scratch_bytes / 1073741824.0,
270 bright_green,
271 (double)total_bytes / 1073741824.0,
272 reset);
273 fprintf(stderr,
274 "%sds4: memory detail: ctx=%d prefill_cap=%u raw_kv_rows=%u "
275 "compressed_kv_rows=%u backend=%s%s\n",
276 green,
277 ctx_size,
278 m.prefill_cap,
279 m.raw_cap,
280 m.comp_cap,
281 ds4_backend_name(backend),
282 reset);
283}
284

Callers

nothing calls this directly

Calls 1

ds4_logFunction · 0.85

Tested by

no test coverage detected