DeepseekV4: Add fused hyper-connection ops (#25585)
* dsv4 hc-ops * add missing files; * add cparams * update rpc version * address review comments * address review comments
This commit is contained in:
@@ -61,6 +61,24 @@ static const llm_fused_op_probe llm_fused_op_lid_probe = {
|
||||
/*.n_tokens_per_seq =*/ 1,
|
||||
};
|
||||
|
||||
static const llm_fused_op_probe llm_fused_op_dsv4_hc_pre_probe = {
|
||||
/*.op =*/ LLM_FUSED_OP_DSV4_HC_PRE,
|
||||
/*.name =*/ "fused DeepSeek V4 HC pre",
|
||||
/*.n_tokens_per_seq =*/ 1,
|
||||
};
|
||||
|
||||
static const llm_fused_op_probe llm_fused_op_dsv4_hc_comb_probe = {
|
||||
/*.op =*/ LLM_FUSED_OP_DSV4_HC_COMB,
|
||||
/*.name =*/ "fused DeepSeek V4 HC comb",
|
||||
/*.n_tokens_per_seq =*/ 1,
|
||||
};
|
||||
|
||||
static const llm_fused_op_probe llm_fused_op_dsv4_hc_post_probe = {
|
||||
/*.op =*/ LLM_FUSED_OP_DSV4_HC_POST,
|
||||
/*.name =*/ "fused DeepSeek V4 HC post",
|
||||
/*.n_tokens_per_seq =*/ 1,
|
||||
};
|
||||
|
||||
llama_context::llama_context(
|
||||
const llama_model & model,
|
||||
llama_context_params params) :
|
||||
@@ -235,6 +253,11 @@ llama_context::llama_context(
|
||||
cparams.fused_lid = true;
|
||||
cparams.auto_flid = true;
|
||||
|
||||
cparams.fused_dsv4_hc_pre = true;
|
||||
cparams.fused_dsv4_hc_comb = true;
|
||||
cparams.fused_dsv4_hc_post = true;
|
||||
cparams.auto_fhc = true;
|
||||
|
||||
// with causal attention, the batch size is limited by the context size
|
||||
cparams.n_batch = cparams.causal_attn ? std::min(cparams.n_ctx, params.n_batch) : params.n_batch;
|
||||
|
||||
@@ -537,6 +560,14 @@ void llama_context::resolve_fused_ops(const llama_memory_context_i * mctx, uint3
|
||||
resolve(llm_fused_op_lid_probe, cparams.fused_lid);
|
||||
cparams.auto_flid = false;
|
||||
}
|
||||
|
||||
if (cparams.auto_fhc) {
|
||||
LLAMA_LOG_INFO("%s: resolving fused DeepSeek V4 HC support:\n", func);
|
||||
resolve(llm_fused_op_dsv4_hc_pre_probe, cparams.fused_dsv4_hc_pre);
|
||||
resolve(llm_fused_op_dsv4_hc_comb_probe, cparams.fused_dsv4_hc_comb);
|
||||
resolve(llm_fused_op_dsv4_hc_post_probe, cparams.fused_dsv4_hc_post);
|
||||
cparams.auto_fhc = false;
|
||||
}
|
||||
}
|
||||
|
||||
void llama_context::sched_reserve() {
|
||||
|
||||
Reference in New Issue
Block a user