mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2025-09-06 20:49:55 +00:00
cpuinfer: filter repeated backend instantiation
This commit is contained in:
parent
09c043d8a6
commit
d166fb9f6e
1 changed files with 6 additions and 1 deletions
|
@ -727,8 +727,13 @@ class CPUInferKVCache:
|
|||
|
||||
class CPUInfer:
|
||||
cpuinfer = None
|
||||
cur_backend_thread_num = 0
|
||||
|
||||
def __init__(self, thread_num):
|
||||
CPUInfer.cpuinfer = cpuinfer_ext.CPUInfer(thread_num)
|
||||
if thread_num > CPUInfer.cur_backend_thread_num:
|
||||
CPUInfer.cur_backend_thread_num = thread_num
|
||||
del CPUInfer.cpuinfer
|
||||
CPUInfer.cpuinfer = cpuinfer_ext.CPUInfer(thread_num)
|
||||
|
||||
def submit(self, task):
|
||||
CPUInfer.cpuinfer.submit(task)
|
||||
|
|
Loading…
Add table
Reference in a new issue