[Config] Register the fork's knobs by cache identity; lint; gpu test marker
- Every fork knob is registered in envs.py and classified as a compile/capture factor or runtime-only; envs.py documents that capture identity and AOT cache identity are different things. - ruff findings cleared on lines this fork authored; upstream lines untouched. - A `gpu` pytest marker so the GPU-free tier can be selected, not just skipped. - Duplicate knob-table entries from two branches reconciled onto one off|warn|raise normaliser. Co-Authored-By: Hinata <hinata@idihore.id> Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
+212
-7
@@ -310,6 +310,132 @@ if TYPE_CHECKING:
|
||||
# AOT cache on it; the layer itself still reads os.environ directly.
|
||||
VLLM_HOST_EMBED_TABLE: bool = False
|
||||
VLLM_PLE_OFFLOAD_READY_TIMEOUT: float = 600.0
|
||||
# --- Flash-Next fork knobs (v2.2) --------------------------------
|
||||
# Every name below was read straight from os.environ at its use site, so
|
||||
# envs.validate_environ() logged it as unknown on every boot that set one
|
||||
# and compile_factors() could not see it. Registering makes the hash
|
||||
# complete; the read sites are unchanged (they still parse and fail closed
|
||||
# themselves, which registration must not weaken). Runtime-only entries are
|
||||
# listed in compile_factors().ignored_factors with their reason.
|
||||
#
|
||||
# TWO IDENTITIES, NOT ONE. "Read once at startup"
|
||||
# settles neither of them, so every entry below is labelled with both:
|
||||
#
|
||||
# AOT identity -- does the value change the torch.compile / AOT
|
||||
# artifact? This is the ONLY identity compile_factors()
|
||||
# keys. It protects against reusing another process's
|
||||
# cached artifact.
|
||||
# CAPTURE identity -- does the value change what a cudagraph capture bakes
|
||||
# in (ops present, launch constants, shapes)? Nothing
|
||||
# in this tree keys anything on capture identity: the
|
||||
# env is read before capture, in-process, so capture
|
||||
# identity is protected only by "do not change the
|
||||
# value between capture and replay in one process".
|
||||
#
|
||||
# So a knob that is a capture factor but NOT an AOT factor gets no
|
||||
# protection from being registered here. Registering it is a contract
|
||||
# statement and a cross-process guard, not a mechanism. Where the two
|
||||
# identities are not both established by reading the code, the knob is
|
||||
# hashed anyway: a spurious cache miss costs a recompile, a missed one costs
|
||||
# a wrong graph.
|
||||
#
|
||||
# COMPILE/CAPTURE FACTORS (hashed):
|
||||
# AOT: yes. CAPTURE: yes. PLE table is FP8-with-global-scale ->
|
||||
# Qwen4ExpPLEFp8EmbeddingMethod instead of the checkpoint's method:
|
||||
# different weight dtype and a different embedding forward.
|
||||
VLLM_PLE_FP8_GLOBAL_SCALE: bool = False
|
||||
# CAPTURE: yes, established -- clip counting allocates persistent per-layer
|
||||
# int64 counters and its increment ops are CAPTURED into the cudagraph (see
|
||||
# the graph-safety note in models/qwen4_exp/nvidia/qsa.py); unset, those ops
|
||||
# are absent. AOT: not established (the QSA forward is a custom op); hashed
|
||||
# conservatively.
|
||||
VLLM_QSA_KV_CLIP_COUNT: str = ""
|
||||
# CAPTURE: n/a -- collection requires --enforce-eager, so an enabled run
|
||||
# does not capture at all. AOT: adds absmax reduction ops to the attention
|
||||
# forward; hashed conservatively.
|
||||
VLLM_QSA_KV_COLLECT: str = ""
|
||||
# CAPTURE: yes -- the resolved value is a launch constant baked into the
|
||||
# graph at capture (csrc/libtorch_stable/persistent_topk.cuh:143-148).
|
||||
# AOT: not established. Hashed conservatively.
|
||||
# NOT A PYTHON READ SITE: the value is resolved once per process by
|
||||
# exact_medium_enabled() in csrc/libtorch_stable/topk.cu:30-36, which is the
|
||||
# single source of truth. This entry is a raw passthrough so nothing can
|
||||
# mistake it for a second parser; do not use envs.MERLIN_TOPK_EXACT_MEDIUM
|
||||
# to decide behaviour. Registered with the medium-path exact restart
|
||||
# so the cache-factor contract is complete.
|
||||
MERLIN_TOPK_EXACT_MEDIUM: str | None = None
|
||||
#
|
||||
# RUNTIME-ONLY (registered for validate_environ + a single cached read):
|
||||
# Static K/V scale sidecar: fill_()ed into existing fp32 device buffers
|
||||
# after load and before capture, and the kernel does tl.load(k_scale_ptr),
|
||||
# so the value is never a constexpr and the graph is identical.
|
||||
VLLM_QSA_KV_SCALES: str = ""
|
||||
# Guard telemetry: mode raise|warn|off and the reader poll interval in
|
||||
# seconds. counter() returns a real tensor in every mode, so the Triton
|
||||
# arguments and the captured graph do not depend on either.
|
||||
VLLM_E2_GUARD_MODE: str = "off"
|
||||
VLLM_E2_GUARD_INTERVAL: str = "0.05"
|
||||
# Debug allocator telemetry (poll seconds + output directory) and the
|
||||
# scheduler allocation log path.
|
||||
VLLM_E2_MEMSTATS: str = "0"
|
||||
VLLM_E2_MEMSTATS_DIR: str = ""
|
||||
VLLM_E2_SCHED_LOG: str = ""
|
||||
# O(live blocks) host-side ownership assertion in the scheduler, which is
|
||||
# plain Python and never compiled.
|
||||
VLLM_E2_ZERO_OWNERSHIP_CHECK: bool = False
|
||||
# PLE offload child placement: rewrites CUDA_VISIBLE_DEVICES for the child
|
||||
# only (CUDA_VISIBLE_DEVICES is itself an ignored factor).
|
||||
VLLM_PLE_OFFLOAD_HOME_DEVICE: str = ""
|
||||
# PLE timeouts / deadlines, in seconds.
|
||||
VLLM_PLE_OFFLOAD_WAIT_TIMEOUT: float = 120.0
|
||||
VLLM_PLE_PROGRESS_DEADLINE_S: float = 300.0
|
||||
VLLM_PLE_STARTUP_DEADLINE_S: float = 1800.0
|
||||
# Test-only PLE fault injection: cut spec, marker log, bootstrap gate.
|
||||
# AOT: no. CAPTURE: no. Read once at import by the vllm_ple_test_fault
|
||||
# singleton, but the process that reads them is a real engine, so
|
||||
# validate_environ sees them.
|
||||
VLLM_PLE_TEST_FAULT: str | None = None
|
||||
VLLM_PLE_TEST_FAULT_GATE: str | None = None
|
||||
VLLM_PLE_TEST_FAULT_LOG: str | None = None
|
||||
#
|
||||
# --- Knobs registered ahead of their read sites (v2.2) -----------
|
||||
# Registered ahead of their code so the MERGED tree is complete and
|
||||
# validate_environ is quiet from the first boot (a
|
||||
# cross-change knob table). Each mirrors its read site's
|
||||
# parse; if a read site changes, the entry here must be reconciled.
|
||||
# (Both read sites below are now live.)
|
||||
# AOT: no. CAPTURE: no -- strictly host-side and outside capture.
|
||||
# off|warn|raise (1 = warn), normalised by _e2_diagnostic_mode like the
|
||||
# rest of the family. The mamba ownership check moved this gate off a plain
|
||||
# boolean; reconciled here.
|
||||
# Read site returns with the deferred PLE transport.
|
||||
VLLM_E2_PLE_FLAG_CHECK: str = "off"
|
||||
# AOT: no. CAPTURE: no -- strictly host-side. off|warn|raise (1 = warn).
|
||||
# the mamba slot-ownership check, v1/worker/mamba_utils.py:74.
|
||||
VLLM_E2_MAMBA_SLOT_OWNERSHIP: str = "off"
|
||||
#
|
||||
# --- TODO: knobs that are NOT in this tree at all ----------
|
||||
# The tie-determinism toggles and the BSM pin live in a separate
|
||||
# patch stack, not in v2.0.1 and not in this tree:
|
||||
#
|
||||
# MERLIN_FULL_K MERLIN_QSA_SORT MERLIN_TIE_DET MERLIN_TIE_RECENT
|
||||
# MERLIN_PIN_BSM
|
||||
#
|
||||
# They are therefore UNAUDITED: nothing in this repository shows what they
|
||||
# change, and this file will not classify code it cannot read. The rule they
|
||||
# fall under is the standing one -- an os.environ (or std::getenv) knob that
|
||||
# changes a compiled or captured artifact is not in the cache key unless it
|
||||
# is registered here. From what is known of them (Marlin split-K, a
|
||||
# persistent_topk ordering change and a cutoff tie-break) they are very
|
||||
# likely capture factors and possibly AOT factors, which is exactly why a
|
||||
# guess is not good enough.
|
||||
#
|
||||
# WHEN THE PATCHES LAND, for each name: register it below, label both
|
||||
# identities from its actual read site, hash it unless exclusion is proven,
|
||||
# and delete it from this block. tests/test_envs.py holds a test that fails
|
||||
# if a name is registered while still listed here, so the classification
|
||||
# cannot be skipped silently.
|
||||
# ----------------------------------------------------------------------
|
||||
VLLM_LOG_MODEL_INSPECTION: bool = False
|
||||
VLLM_DEBUG_MFU_METRICS: bool = False
|
||||
VLLM_WEIGHT_OFFLOADING_DISABLE_PIN_MEMORY: bool = False
|
||||
@@ -2153,6 +2279,43 @@ environment_variables: dict[str, Callable[[], Any]] = {
|
||||
"VLLM_PLE_OFFLOAD_READY_TIMEOUT": lambda: float(
|
||||
os.getenv("VLLM_PLE_OFFLOAD_READY_TIMEOUT", "600")
|
||||
),
|
||||
# --- Flash-Next fork knobs (v2.2); see the TYPE_CHECKING block for
|
||||
# which of these are compile/capture factors and which are ignored.
|
||||
# Compile/capture factors.
|
||||
"VLLM_PLE_FP8_GLOBAL_SCALE": lambda: (
|
||||
os.getenv("VLLM_PLE_FP8_GLOBAL_SCALE", "") == "1"
|
||||
),
|
||||
"VLLM_QSA_KV_CLIP_COUNT": lambda: os.getenv("VLLM_QSA_KV_CLIP_COUNT", "").strip(),
|
||||
"VLLM_QSA_KV_COLLECT": lambda: os.getenv("VLLM_QSA_KV_COLLECT", "").strip(),
|
||||
# Capture-configuration factor, read in C++; raw passthrough on purpose.
|
||||
"MERLIN_TOPK_EXACT_MEDIUM": lambda: os.getenv("MERLIN_TOPK_EXACT_MEDIUM", None),
|
||||
# Runtime only; all of the following are in compile_factors.ignored_factors.
|
||||
"VLLM_QSA_KV_SCALES": lambda: os.getenv("VLLM_QSA_KV_SCALES", "").strip(),
|
||||
"VLLM_E2_GUARD_MODE": lambda: (
|
||||
os.getenv("VLLM_E2_GUARD_MODE", "off").strip().lower()
|
||||
),
|
||||
"VLLM_E2_GUARD_INTERVAL": lambda: os.getenv("VLLM_E2_GUARD_INTERVAL", "0.05"),
|
||||
"VLLM_E2_MEMSTATS": lambda: os.getenv("VLLM_E2_MEMSTATS", "0"),
|
||||
"VLLM_E2_MEMSTATS_DIR": lambda: os.getenv("VLLM_E2_MEMSTATS_DIR", ""),
|
||||
"VLLM_E2_SCHED_LOG": lambda: os.getenv("VLLM_E2_SCHED_LOG", ""),
|
||||
"VLLM_E2_ZERO_OWNERSHIP_CHECK": lambda: (
|
||||
os.getenv("VLLM_E2_ZERO_OWNERSHIP_CHECK", "") == "1"
|
||||
),
|
||||
"VLLM_PLE_OFFLOAD_HOME_DEVICE": lambda: os.getenv(
|
||||
"VLLM_PLE_OFFLOAD_HOME_DEVICE", ""
|
||||
).strip(),
|
||||
"VLLM_PLE_OFFLOAD_WAIT_TIMEOUT": lambda: float(
|
||||
os.getenv("VLLM_PLE_OFFLOAD_WAIT_TIMEOUT", "120")
|
||||
),
|
||||
"VLLM_PLE_PROGRESS_DEADLINE_S": lambda: float(
|
||||
os.getenv("VLLM_PLE_PROGRESS_DEADLINE_S", "300")
|
||||
),
|
||||
"VLLM_PLE_STARTUP_DEADLINE_S": lambda: float(
|
||||
os.getenv("VLLM_PLE_STARTUP_DEADLINE_S", "1800")
|
||||
),
|
||||
"VLLM_PLE_TEST_FAULT": lambda: os.getenv("VLLM_PLE_TEST_FAULT", None),
|
||||
"VLLM_PLE_TEST_FAULT_GATE": lambda: os.getenv("VLLM_PLE_TEST_FAULT_GATE", None),
|
||||
"VLLM_PLE_TEST_FAULT_LOG": lambda: os.getenv("VLLM_PLE_TEST_FAULT_LOG", None),
|
||||
# Log model inspection after loading.
|
||||
# If enabled, logs a transformers-style hierarchical view of the model
|
||||
# with quantization methods and attention backends.
|
||||
@@ -2381,13 +2544,6 @@ def compile_factors() -> dict[str, object]:
|
||||
"VLLM_DEBUG_DUMP_PATH",
|
||||
"VLLM_PORT",
|
||||
"VLLM_CACHE_ROOT",
|
||||
# PLE host-side diagnostics: both gate Python that runs outside any
|
||||
# capture and neither adds a node to a compiled graph, so hashing them
|
||||
# would invalidate every compile cache the moment a diagnostic boot is
|
||||
# taken -- which is exactly when the cache is wanted. Remove from this
|
||||
# set if either ever grows a device-side component.
|
||||
"VLLM_E2_PLE_FLAG_CHECK",
|
||||
"VLLM_E2_MAMBA_SLOT_OWNERSHIP",
|
||||
# Runtime memory-plan persistence; does not affect compiled graphs.
|
||||
"VLLM_ENABLE_STARTUP_PLAN",
|
||||
# Location-only derived paths: where a cache/config directory lives
|
||||
@@ -2464,6 +2620,55 @@ def compile_factors() -> dict[str, object]:
|
||||
"CUDA_VISIBLE_DEVICES",
|
||||
"NO_COLOR",
|
||||
"VLLM_SKIP_VERSION_SUFFIX",
|
||||
# --- Flash-Next fork knobs that are runtime-only (v2.2) ------
|
||||
# Registering a name in environment_variables makes it a compile
|
||||
# factor by default (this function is a deny-list), so every fork knob
|
||||
# that cannot change a compiled or captured artifact is listed here
|
||||
# with its reason. Hashing them would invalidate the whole AOT cache on
|
||||
# a log path, a timeout or a guard-mode flip.
|
||||
#
|
||||
# Static QSA K/V scales: fill_()ed into existing fp32 device buffers
|
||||
# after load and before capture; the kernel reads them with
|
||||
# tl.load(k_scale_ptr), never as a constexpr.
|
||||
"VLLM_QSA_KV_SCALES",
|
||||
# Guard telemetry: counter() returns a real [3] int64 view in every
|
||||
# mode, so the Triton arguments and the captured graph are identical;
|
||||
# the mode only gates the side reader thread and the check_pending
|
||||
# raise, and the interval is that thread's poll cadence.
|
||||
"VLLM_E2_GUARD_MODE",
|
||||
"VLLM_E2_GUARD_INTERVAL",
|
||||
# Debug telemetry cadence and output locations.
|
||||
"VLLM_E2_MEMSTATS",
|
||||
"VLLM_E2_MEMSTATS_DIR",
|
||||
"VLLM_E2_SCHED_LOG",
|
||||
# Host-side scheduler assertion; the scheduler is never compiled.
|
||||
"VLLM_E2_ZERO_OWNERSHIP_CHECK",
|
||||
# Placement only: rewrites CUDA_VISIBLE_DEVICES for the PLE offload
|
||||
# child, and CUDA_VISIBLE_DEVICES is already ignored above.
|
||||
"VLLM_PLE_OFFLOAD_HOME_DEVICE",
|
||||
# Timeouts and deadlines, in seconds. VLLM_PLE_OFFLOAD_READY_TIMEOUT
|
||||
# was registered in the v2 host-embed commit and left hashed by
|
||||
# oversight: serve-v2.sh sets it to 1800, so every boot that changed it
|
||||
# missed the AOT cache for no reason.
|
||||
"VLLM_PLE_OFFLOAD_READY_TIMEOUT",
|
||||
"VLLM_PLE_OFFLOAD_WAIT_TIMEOUT",
|
||||
"VLLM_PLE_PROGRESS_DEADLINE_S",
|
||||
"VLLM_PLE_STARTUP_DEADLINE_S",
|
||||
# Test-only fault injection: a cut spec, a marker log path and a
|
||||
# bootstrap gate file. None of them reaches a kernel or a graph.
|
||||
"VLLM_PLE_TEST_FAULT",
|
||||
"VLLM_PLE_TEST_FAULT_GATE",
|
||||
"VLLM_PLE_TEST_FAULT_LOG",
|
||||
# Diagnostic knobs, both strictly host-side and outside capture, so
|
||||
# neither AOT nor capture identity depends on them. Hashing
|
||||
# them would invalidate every compile cache the moment a diagnostic
|
||||
# boot is taken -- exactly when the cache is wanted. Remove from this
|
||||
# set if either ever grows a device-side component.
|
||||
# MERLIN_TOPK_EXACT_MEDIUM is deliberately NOT here: it is a capture
|
||||
# configuration factor and is hashed conservatively.
|
||||
"VLLM_E2_PLE_FLAG_CHECK",
|
||||
"VLLM_E2_MAMBA_SLOT_OWNERSHIP",
|
||||
# ------------------------------------------------------------------
|
||||
"FORCE_COLOR",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user