[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)
|
super().__init__(args, disaggregation_mode, server_args, is_mla_backend)
|
||||||
try:
|
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:
|
except ImportError as e:
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"Please install NIXL by following the instructions at "
|
"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 "
|
"SGLANG_DISAGGREGATION_NIXL_BACKEND_PARAMS must be a JSON object "
|
||||||
"with string keys and string values"
|
"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)
|
self.agent = nixl_agent(str(uuid.uuid4()), agent_config)
|
||||||
if num_threads > 0:
|
if num_threads > 0:
|
||||||
# TODO: Remove this once NIXL passes thread parameters from
|
# TODO: Remove this once NIXL passes thread parameters from
|
||||||
|
|||||||
Reference in New Issue
Block a user