[CPU] Enable chunked prefill and prefix caching for qwen3.5 (#46202)

Signed-off-by: Li, Tianmu <tianmu.li@intel.com>
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
This commit is contained in:
Tianmu Li
2026-06-25 03:49:21 +00:00
committed by GitHub
co-authored by Claude Sonnet 4.6 Li, Jiang <jiang1.li@intel.com>
parent dc55936f64
commit 1aad125815
7 changed files with 388 additions and 32 deletions
+10
View File
@@ -5,6 +5,7 @@
Contains replacement functions to fallback Triton usages in CPU backend
"""
import ctypes
from collections.abc import Callable
import torch
@@ -336,3 +337,12 @@ rejection_greedy_sample_kernel = _FuncWrapper(_rejection_greedy_sample_kernel_im
rejection_random_sample_kernel = _FuncWrapper(_rejection_random_sample_kernel_impl)
expand_kernel = _FuncWrapper(_expand_kernel_impl)
sample_recovered_tokens_kernel = _FuncWrapper(_sample_recovered_tokens_kernel_impl)
def _batch_memcpy_impl(src_ptrs, dst_ptrs, sizes, BLOCK_SIZE=None):
# BLOCK_SIZE is unused; kept for signature parity with the Triton kernel.
for src, dst, size in zip(src_ptrs.tolist(), dst_ptrs.tolist(), sizes.tolist()):
ctypes.memmove(dst, src, size)
batch_memcpy_kernel = _FuncWrapper(_batch_memcpy_impl)