Merge origin/main into dev/rebase-v0.16.0.
Resolve arg_utils merge conflict and align CI base image tag to v0.16.0 for the vLLM rebase track. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Taichang Zhou <tzhouam@connect.ust.hk>
This commit is contained in:
commit
e2ced80d59
64 files changed
+5186
-1228
No files matched your search
@@ -162,8 +162,9 @@ class AsyncOmni(OmniBase):
|
||||
"enable_cache_dit_summary": kwargs.get("enable_cache_dit_summary", False),
|
||||
"enable_cpu_offload": kwargs.get("enable_cpu_offload", False),
|
||||
"enable_layerwise_offload": kwargs.get("enable_layerwise_offload", False),
|
||||
"layerwise_num_gpu_layers": kwargs.get("layerwise_num_gpu_layers", False),
|
||||
"enforce_eager": kwargs.get("enforce_eager", False),
|
||||
"diffusion_load_format": kwargs.get("diffusion_load_format", "default"),
|
||||
"custom_pipeline_args": kwargs.get("custom_pipeline_args", None),
|
||||
},
|
||||
"final_output": True,
|
||||
"final_output_type": "image",
|
||||
|
||||
@@ -204,12 +204,6 @@ class OmniServeCommand(CLISubcommand):
|
||||
action="store_true",
|
||||
help="Enable layerwise (blockwise) offloading on DiT modules.",
|
||||
)
|
||||
omni_config_group.add_argument(
|
||||
"--layerwise-num-gpu-layers",
|
||||
type=int,
|
||||
default=1,
|
||||
help="Number of layers (blocks) to keep on GPU during generation.",
|
||||
)
|
||||
|
||||
# Video model parameters (e.g., Wan2.2) - engine-level
|
||||
omni_config_group.add_argument(
|
||||
|
||||
@@ -67,16 +67,20 @@ def _sequential_init_lock(engine_args: dict[str, Any], stage_init_timeout: int =
|
||||
"""
|
||||
from vllm_omni.worker.gpu_memory_utils import is_process_scoped_memory_available
|
||||
|
||||
if is_process_scoped_memory_available() and detect_pid_host():
|
||||
logger.debug(
|
||||
nvml_available = is_process_scoped_memory_available()
|
||||
pid_host = detect_pid_host()
|
||||
|
||||
if nvml_available and pid_host:
|
||||
logger.info(
|
||||
"NVML process-scoped memory available and PID host is available — concurrent init is safe, skipping locks"
|
||||
)
|
||||
yield
|
||||
return
|
||||
else:
|
||||
logger.debug(
|
||||
"NVML unavailable or PID host is not available (usually inside a container, "
|
||||
"--pid=host is not set in docker run command) — using sequential init locks"
|
||||
logger.info(
|
||||
"Using sequential init locks (nvml_available=%s, pid_host=%s)",
|
||||
nvml_available,
|
||||
pid_host,
|
||||
)
|
||||
|
||||
from vllm_omni.platforms import current_omni_platform
|
||||
@@ -201,7 +205,7 @@ def _sequential_init_lock(engine_args: dict[str, Any], stage_init_timeout: int =
|
||||
|
||||
|
||||
def _resolve_worker_cls(engine_args: dict[str, Any]) -> None:
|
||||
worker_type = engine_args.pop("worker_type", None)
|
||||
worker_type = engine_args.get("worker_type", None)
|
||||
if not worker_type:
|
||||
return
|
||||
if engine_args.get("worker_cls"):
|
||||
|
||||
@@ -306,37 +306,42 @@ def in_container() -> bool:
|
||||
return any(m in cg for m in markers)
|
||||
|
||||
|
||||
def has_pid_host() -> bool | None:
|
||||
"""
|
||||
def _nvml_pid_matches() -> bool | None:
|
||||
"""Check if os.getpid() matches what NVML would report via NSpid.
|
||||
|
||||
If /proc/self/status has a single NSpid entry, the container PID equals
|
||||
the host PID, so NVML process-scoped memory tracking works correctly.
|
||||
|
||||
Returns:
|
||||
True -> very likely running with --pid=host (host PID namespace)
|
||||
False -> very likely isolated PID namespace (default)
|
||||
True -> PID namespaces match (single NSpid entry)
|
||||
False -> PID namespaces differ (multiple NSpid entries)
|
||||
None -> cannot determine
|
||||
"""
|
||||
# Strong signal: in host pid namespace, PID 2 is usually kthreadd
|
||||
comm2 = _read_text("/proc/2/comm")
|
||||
if comm2 is not None:
|
||||
comm2 = comm2.strip()
|
||||
if comm2 == "kthreadd":
|
||||
return True
|
||||
# If PID 2 exists and is NOT kthreadd, we're almost certainly not in host pid ns
|
||||
return False
|
||||
|
||||
# Fallback: check for other low-numbered kernel threads (best-effort)
|
||||
for pid, name in [(3, "rcu_gp"), (4, "rcu_par_gp"), (10, "ksoftirqd/0")]:
|
||||
comm = _read_text(f"/proc/{pid}/comm")
|
||||
if comm is not None:
|
||||
if comm.strip() == name:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
return False
|
||||
status = _read_text("/proc/self/status")
|
||||
if status is None:
|
||||
return None
|
||||
for line in status.splitlines():
|
||||
if line.startswith("NSpid:"):
|
||||
pids = line.split()[1:]
|
||||
# Single PID means container PID == host PID
|
||||
return len(pids) == 1
|
||||
return None
|
||||
|
||||
|
||||
def detect_pid_host() -> bool:
|
||||
ic = in_container()
|
||||
if not ic:
|
||||
"""Check if os.getpid() matches the PID that NVML will report.
|
||||
|
||||
NVML always reports host-namespace PIDs. If this process lives in a
|
||||
different PID namespace the match will fail and process-scoped memory
|
||||
tracking won't work. We detect this via the NSpid field in
|
||||
/proc/self/status: a single entry means host PID == container PID.
|
||||
"""
|
||||
if not in_container():
|
||||
return True
|
||||
|
||||
return has_pid_host()
|
||||
result = _nvml_pid_matches()
|
||||
if result is not None:
|
||||
return result
|
||||
|
||||
# Cannot determine — assume mismatch to be safe.
|
||||
return False
|
||||
Reference in new issue
Block a user