@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 16c16301c8
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 04:45 UTC

Disable "Forbid direct 'import triton'" check for `vllm/triton_utils/importing.py` in an extensible way (#19783)

Signed-off-by: Andrew Feldman <afeldman@redhat.com>

afeldman-nm committed Jun 18, 2025 at 18:08 UTC 16c16301c8218a28eefcdec07757a782e5ddc643
1 file changed +10
tools/check_triton_import.py
+10
@@ -14,6 +14,12 @@ ALLOWED_LINES = {
14 "from vllm.triton_utils import tl, triton",
15 }
16
17 +ALLOWED_FILES = {"vllm/triton_utils/importing.py"}
18 +
19 +
20 +def is_allowed_file(current_file: str) -> bool:
21 + return current_file in ALLOWED_FILES
22 +
23
24 def is_forbidden_import(line: str) -> bool:
25 stripped = line.strip()
@@ -25,10 +31,14 @@ def parse_diff(diff: str) -> list[str]:
31 violations = []
32 current_file = None
33 current_lineno = None
34 + skip_allowed_file = False
35
36 for line in diff.splitlines():
37 if line.startswith("+++ b/"):
38 current_file = line[6:]
39 + skip_allowed_file = is_allowed_file(current_file)
40 + elif skip_allowed_file:
41 + continue
42 elif line.startswith("@@"):
43 match = re.search(r"\+(\d+)", line)
44 if match: