Commit d166fb9f authored by Lander-Hatsune's avatar Lander-Hatsune
Browse files

cpuinfer: filter repeated backend instantiation

parent 09c043d8
...@@ -727,7 +727,12 @@ class CPUInferKVCache: ...@@ -727,7 +727,12 @@ class CPUInferKVCache:
class CPUInfer: class CPUInfer:
cpuinfer = None cpuinfer = None
cur_backend_thread_num = 0
def __init__(self, thread_num): def __init__(self, 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) CPUInfer.cpuinfer = cpuinfer_ext.CPUInfer(thread_num)
def submit(self, task): def submit(self, task):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment