fix(hicache): support staged write-back for asymmetric MHA (#30981)

Co-authored-by: 晟海 <huangtingwei.htw@antgroup.com>
Co-authored-by: Zhangheng <hzh0425@apache.org>
This commit is contained in:
HZY
2026-07-22 09:58:49 +08:00
committed by GitHub
co-authored by 晟海 Zhangheng
parent 4597dd4d88
commit 3217b7e3ce
5 changed files with 408 additions and 19 deletions
+11 -1
View File
@@ -137,6 +137,7 @@ def _generate(
return_logprob=False,
logprob_start_len=-1,
temperature=0.0,
routed_dp_rank=None,
):
"""Send generate request and return results."""
json_data = {
@@ -155,11 +156,19 @@ def _generate(
"logprob_start_len": logprob_start_len,
}
)
if routed_dp_rank is not None:
json_data["routed_dp_rank"] = routed_dp_rank
response = requests.post(base_url + "/generate", json=json_data)
return response.json()
def _get_input_logprobs(base_url, new_input_ids, output_logprobs, temperature=0.0):
def _get_input_logprobs(
base_url,
new_input_ids,
output_logprobs,
temperature=0.0,
routed_dp_rank=None,
):
"""Run prefill to get input logprobs matching output logprobs."""
_flush_cache(base_url)
results = _generate(
@@ -169,6 +178,7 @@ def _get_input_logprobs(base_url, new_input_ids, output_logprobs, temperature=0.
return_logprob=True,
logprob_start_len=0,
temperature=temperature,
routed_dp_rank=routed_dp_rank,
)
assert len(results) == len(new_input_ids)