-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[TRTLLMINF-133][infra] Move check testlist stage earlier in CI #17513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tburt-nv
wants to merge
6
commits into
NVIDIA:main
Choose a base branch
from
tburt-nv:user/tburt/shift_testlist_check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eef8a5b
move test list check to top-level pipeline
tburt-nv 7e26273
lazily evaluate model paths, and remove TRTLLM_BINDINGS_STUB
tburt-nv 202647a
Use binding stubs for test-list collection
tburt-nv 54f1594
add pre-commit check for stub alignment
tburt-nv 20eb829
avoid model mount
tburt-nv c542acc
remove inaccurate test
tburt-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # CI tool versions shared across Jenkins pipelines and Python scripts. | ||
| # Format: KEY=VALUE (no quotes, no spaces around '='). | ||
| # | ||
| # Consumed by: | ||
| # - jenkins/L0_Test.groovy (readProperties) | ||
| # - scripts/check_test_list.py (key=value parse) | ||
| TRT_TEST_DB_VERSION=1.8.5+bc6df7 | ||
|
tburt-nv marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| #!/usr/bin/env python3 | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| """Fail when collection binding stubs miss a compiled extension. | ||
|
|
||
| ``tests/integration/defs/stubify_bindings.py`` is a factory: most symbols are | ||
| invented on demand. Collection only needs ``_STUB_ROOTS`` to cover every | ||
| compiled Python extension the package ships so ``pytest --co`` can import | ||
| without a wheel. | ||
|
|
||
| This script is stdlib-only so pre-commit and GitHub Release Checks can run it | ||
| without a wheel, GPU, or torch. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import ast | ||
| import importlib.util | ||
| from pathlib import Path, PurePosixPath | ||
|
|
||
| REPO_ROOT = Path(__file__).resolve().parent.parent | ||
| STUB_PATH = REPO_ROOT / "tests" / "integration" / "defs" / "stubify_bindings.py" | ||
| SETUP_PATH = REPO_ROOT / "setup.py" | ||
| _SKIP_PACKAGE_DATA_PREFIXES = ("libs/", "include/", "runtime/") | ||
| _EXTENSION_SUFFIXES = frozenset({".so", ".pyd", ".dll"}) | ||
|
|
||
|
|
||
| def _stub_roots() -> set[str]: | ||
| """Load ``_STUB_ROOTS`` by importing the collection stub plugin. | ||
|
|
||
| Import runs ``install_bindings_stub()`` (pytest ``-p`` needs that on | ||
| import). This checker then exits, so the meta-path finder is harmless. | ||
| """ | ||
| spec = importlib.util.spec_from_file_location("stubify_bindings", STUB_PATH) | ||
| if spec is None or spec.loader is None: | ||
| raise SystemExit(f"cannot load {STUB_PATH}") | ||
| module = importlib.util.module_from_spec(spec) | ||
| spec.loader.exec_module(module) | ||
| return set(module._STUB_ROOTS) | ||
|
|
||
|
|
||
| def _const_strings(node: ast.expr) -> list[str]: | ||
| """Extract string literals from a list or a single constant.""" | ||
| if isinstance(node, ast.Constant) and isinstance(node.value, str): | ||
| return [node.value] | ||
| if not isinstance(node, ast.List): | ||
| return [] | ||
| return [ | ||
| elt.value | ||
| for elt in node.elts | ||
| if isinstance(elt, ast.Constant) and isinstance(elt.value, str) | ||
| ] | ||
|
|
||
|
|
||
| def _setup_package_data_patterns(tree: ast.AST) -> list[str]: | ||
| """Collect ``package_data`` glob strings assigned in setup.py via AST.""" | ||
| patterns: list[str] = [] | ||
| for node in ast.walk(tree): | ||
| if isinstance(node, ast.Assign) and any( | ||
| isinstance(target, ast.Name) and target.id == "package_data" for target in node.targets | ||
| ): | ||
| patterns.extend(_const_strings(node.value)) | ||
| elif ( | ||
| isinstance(node, ast.AugAssign) | ||
| and isinstance(node.target, ast.Name) | ||
| and node.target.id == "package_data" | ||
| ): | ||
| patterns.extend(_const_strings(node.value)) | ||
| elif isinstance(node, ast.Call): | ||
| func = node.func | ||
| if ( | ||
| isinstance(func, ast.Attribute) | ||
| and func.attr == "append" | ||
| and isinstance(func.value, ast.Name) | ||
| and func.value.id == "package_data" | ||
| ): | ||
| for arg in node.args: | ||
| patterns.extend(_const_strings(arg)) | ||
| return patterns | ||
|
|
||
|
|
||
| def _root_extension_module(pattern: str) -> str | None: | ||
| """Map a setuptools package_data glob to ``tensorrt_llm.<ext>`` or None. | ||
|
|
||
| Top-level compiled extensions: ``bindings.*.so`` → ``tensorrt_llm.bindings``. | ||
| One-level Python packages: ``flash_mla/*.py`` → ``tensorrt_llm.flash_mla``. | ||
| Nested native libs (``libs/*.so``) and mypyc trees (``runtime/...``) are | ||
| skipped. | ||
| """ | ||
| posix = pattern.replace("\\", "/") | ||
| if posix.startswith(_SKIP_PACKAGE_DATA_PREFIXES): | ||
| return None | ||
| path = PurePosixPath(posix) | ||
| if len(path.parts) == 1: | ||
| if path.suffix.lower() not in _EXTENSION_SUFFIXES: | ||
| return None | ||
| stem = path.stem.removesuffix(".*").rstrip("*") | ||
| if not stem.isidentifier(): | ||
| return None | ||
| return f"tensorrt_llm.{stem}" | ||
| if len(path.parts) == 2 and path.parts[1] == "*.py" and path.parts[0].isidentifier(): | ||
| return f"tensorrt_llm.{path.parts[0]}" | ||
| return None | ||
|
|
||
|
|
||
| def _compiled_extension_roots(setup_source: str) -> set[str]: | ||
| tree = ast.parse(setup_source, filename=str(SETUP_PATH)) | ||
| roots: set[str] = set() | ||
| for pattern in _setup_package_data_patterns(tree): | ||
| module = _root_extension_module(pattern) | ||
| if module is not None: | ||
| roots.add(module) | ||
| return roots | ||
|
|
||
|
|
||
| def main() -> int: | ||
| stub_roots = _stub_roots() | ||
| compiled_roots = _compiled_extension_roots(SETUP_PATH.read_text(encoding="utf-8")) | ||
|
|
||
| missing_roots = sorted(compiled_roots - stub_roots) | ||
| if not missing_roots: | ||
| print("OK: collection binding stubs cover compiled extensions.") | ||
| return 0 | ||
|
|
||
| stub_rel = STUB_PATH.relative_to(REPO_ROOT) | ||
| print("Collection binding stubs are out of date:\n") | ||
| print( | ||
| f" - {stub_rel}: _STUB_ROOTS is missing compiled modules " | ||
| f"{missing_roots}. Add them when you introduce a new bindings/.so " | ||
| "package so Check Test List can collect without a wheel." | ||
| ) | ||
| print( | ||
| "\nUpdate tests/integration/defs/stubify_bindings.py in this change " | ||
| "so Jenkins Check Test List keeps working." | ||
| ) | ||
| return 1 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.