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

Function hc_post_batch

server/src/deepseek4/deepseek4_graph.cpp:2109–2130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2107 const bool use_flash = attention_impl != DeepSeek4AttentionImpl::Explicit &&
2108 (n_tokens > 1 || indexer_topk != nullptr);
2109 if (use_flash) {
2110 if (exact_two_band) {
2111 // A larger scheduling band must retain the numerical topology of
2112 // two 2K requests. Prefix queries use the first band's F32 raw KV;
2113 // suffix queries see its final SWA tail after the same F16 cache
2114 // round-trip. HC, projections and MoE still run once over the full
2115 // token batch, avoiding a second expert-weight sweep.
2116 const int first_count = DS4_NUMERICAL_PREFILL_BAND;
2117 const int second_count = n_tokens - first_count;
2118 const int first_comp = ratio > 0
2119 ? ds4_comp_rows_used(lc.comp_kv, lc.n_comp, ratio,
2120 kv_start + first_count - 1)
2121 : 0;
2122 const int second_comp = n_comp_live;
2123 const int second_prior_count = std::min(first_count, w.n_swa);
2124
2125 auto view_kv = [&](int first, int count) {
2126 return ggml_view_2d(
2127 ctx, kv, head_dim, count, kv->nb[1],
2128 (size_t) first * kv->nb[1]);
2129 };
2130 auto append_comp = [&](ggml_tensor * raw, int count) {
2131 if (count <= 0 || !comp_kv_source) return raw;
2132 ggml_tensor * comp = ggml_view_2d(
2133 ctx, comp_kv_source, head_dim, count,

Callers 1

Calls 3

ds4_parallel_for_tokensFunction · 0.85
cpu_hc_postFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected