MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / create_deepseek4_cache

Function create_deepseek4_cache

server/src/deepseek4/deepseek4_graph.cpp:3481–3565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3479 const HcWeightsCpu & weights,
3480 ggml_tensor * fn_tensor,
3481 int n_embd,
3482 int n_hc,
3483 int sinkhorn_iters,
3484 float hc_eps) {
3485#if defined(DFLASH27B_BACKEND_CUDA)
3486 if (ds4_hc_cuda_enabled() && fn_tensor && fn_tensor->data) {
3487 float mix[24];
3488 if (deepseek4_cuda_hc_pre_mix(hc_state, fn_tensor->data,
3489 n_embd, n_hc, hc_eps, mix)) {
3490 return finish_hc_pre_from_mix(hc_state, mix,
3491 weights.scale_data.data(),
3492 weights.base_data.data(),
3493 n_embd, n_hc, sinkhorn_iters);
3494 }
3495 }
3496#else
3497 (void)fn_tensor;
3498#endif
3499 return cpu_hc_pre(hc_state, weights.fn_data.data(),
3500 weights.scale_data.data(), weights.base_data.data(),
3501 n_embd, n_hc, sinkhorn_iters, hc_eps);
3502}
3503
3504static void hc_pre_auto_into(float * working,
3505 float * post,
3506 float * comb,
3507 const float * hc_state,
3508 const HcWeightsCpu & weights,
3509 ggml_tensor * fn_tensor,
3510 int n_embd,
3511 int n_hc,
3512 int sinkhorn_iters,
3513 float hc_eps,
3514 float * flat,
3515 float * mix_scratch,
3516 bool serial_fn) {
3517#if defined(DFLASH27B_BACKEND_CUDA)
3518 if (ds4_hc_cuda_enabled() && fn_tensor && fn_tensor->data) {
3519 float mix[24];
3520 if (deepseek4_cuda_hc_pre_mix(hc_state, fn_tensor->data,
3521 n_embd, n_hc, hc_eps, mix)) {
3522 finish_hc_pre_from_mix_into(working, post, comb, hc_state, mix,
3523 weights.scale_data.data(),
3524 weights.base_data.data(),
3525 n_embd, n_hc, sinkhorn_iters);
3526 return;
3527 }
3528 }
3529#else
3530 (void)fn_tensor;
3531#endif
3532 cpu_hc_pre_into(working, post, comb,
3533 hc_state, weights.fn_data.data(),
3534 weights.scale_data.data(), weights.base_data.data(),
3535 n_embd, n_hc, sinkhorn_iters, hc_eps, flat, mix_scratch, serial_fn);
3536}
3537
3538static void hc_pre_batch(std::vector<float> & working,

Callers 6

initMethod · 0.85
unparkMethod · 0.85
initMethod · 0.85
init_snapshot_test_shardFunction · 0.85

Calls

no outgoing calls

Tested by 1

init_snapshot_test_shardFunction · 0.68