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

Function ds4_acquire_instance_lock

ds4.c:23215–23257  ·  view source on GitHub ↗

Refuse to start a second ds4 process. The model can map tens of GiB, so a * stale accidental second run is more dangerous than a normal CLI error. */

Source from the content-addressed store, hash-verified

23213 }
23214 if (ok) {
23215 ok = ds4_gpu_rope_tail_tensor(metal_graph_heads(g),
23216 1, cuda_tp_heads, DS4_N_HEAD_DIM,
23217 DS4_N_ROT, pos,
23218 compressed ? (uint32_t)DS4_ROPE_ORIG_CTX : 0,
23219 true,
23220 freq_base,
23221 freq_scale,
23222 ext_factor,
23223 attn_factor,
23224 DS4_ROPE_YARN_BETA_FAST,
23225 DS4_ROPE_YARN_BETA_SLOW) != 0;
23226 }
23227 if (ok && indexed_attention && decode_index_stage_profile) {
23228 ok = metal_graph_indexer_stage_profile_boundary("decode_attention",
23229 il,
23230 pos,
23231 1,
23232 n_comp,
23233 &decode_index_stage_t0);
23234 }
23235 } else if (ok && indexed_attention) {
23236 ok = ds4_gpu_attention_indexed_mixed_batch_heads_tensor(
23237 metal_graph_heads(g),
23238 model->map,
23239 model->size,
23240 layer->attn_sinks->abs_offset + (uint64_t)tp_head0 * (layer->attn_sinks->bytes / DS4_N_HEAD),
23241 metal_graph_q(g),
23242 raw_cache,
23243 g->layer_attn_comp_cache[il],
23244 metal_graph_attn_comp_cache_is_f16(),
23245 comp_selected,
23246 1,
23247 pos,
23248 n_raw,
23249 raw_cap,
23250 raw_start,
23251 n_comp,
23252 n_selected,
23253 g->raw_window,
23254 ds4_layer_compress_ratio(il),
23255 tp_heads,
23256 DS4_N_HEAD_DIM) != 0;
23257 if (ok && decode_index_stage_profile) {
23258 ok = metal_graph_indexer_stage_profile_boundary("decode_attention",
23259 il,
23260 pos,

Callers 1

ds4_engine_openFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected