[PD] Fix data race in NixlKVManager for NIXL backend (#28897)
This commit is contained in:
@@ -246,7 +246,7 @@ class NixlKVManager(CommonKVManager):
|
||||
):
|
||||
super().__init__(args, disaggregation_mode, server_args, is_mla_backend)
|
||||
try:
|
||||
from nixl._api import nixl_agent, nixl_agent_config
|
||||
from nixl._api import nixl_agent, nixl_agent_config, nixl_thread_sync_t
|
||||
except ImportError as e:
|
||||
raise ImportError(
|
||||
"Please install NIXL by following the instructions at "
|
||||
@@ -267,7 +267,13 @@ class NixlKVManager(CommonKVManager):
|
||||
"SGLANG_DISAGGREGATION_NIXL_BACKEND_PARAMS must be a JSON object "
|
||||
"with string keys and string values"
|
||||
)
|
||||
agent_config = nixl_agent_config(backends=[], num_threads=num_threads)
|
||||
# self.transfer_worker and self._start_bootstrap_thread runs concurrently
|
||||
# so we cannot use sync_mode=None which is thread-unsafe.
|
||||
agent_config = nixl_agent_config(
|
||||
backends=[],
|
||||
num_threads=num_threads,
|
||||
sync_mode=nixl_thread_sync_t.NIXL_THREAD_SYNC_STRICT,
|
||||
)
|
||||
self.agent = nixl_agent(str(uuid.uuid4()), agent_config)
|
||||
if num_threads > 0:
|
||||
# TODO: Remove this once NIXL passes thread parameters from
|
||||
|
||||
Reference in New Issue
Block a user