diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index 21518a54..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: "Bug Report" -description: Submit a bug report to help us improve TensorRT-LLM backend -labels: [ "bug" ] -body: - - type: textarea - id: system-info - attributes: - label: System Info - description: Please share your system info with us. - placeholder: | - - CPU architecture (e.g., x86_64, aarch64) - - CPU/Host memory size (if known) - - GPU properties - - GPU name (e.g., NVIDIA H100, NVIDIA A100, NVIDIA L40S) - - GPU memory size (if known) - - Clock frequencies used (if applicable) - - Libraries - - TensorRT-LLM branch or tag (e.g., main, v0.7.1) - - TensorRT-LLM commit (if known) - - Versions of TensorRT, AMMO, CUDA, cuBLAS, etc. used - - Container used (if running TensorRT-LLM in a container) - - NVIDIA driver version - - OS (Ubuntu 22.04, CentOS 7, Windows 10) - - Docker image version - - Any other information that may be useful in reproducing the bug - validations: - required: true - - - type: textarea - id: who-can-help - attributes: - label: Who can help? - description: | - To expedite the response to your issue, it would be helpful if you could identify the appropriate person - to tag using the **@** symbol. Here is a general guideline on **whom to tag**. - - Rest assured that all issues are reviewed by the core maintainers. If you are unsure about whom to tag, - you can leave it blank, and a core maintainer will make sure to involve the appropriate person. - - Please tag fewer than 3 people. - - Quantization: @Tracin - - Documentation: @juney-nvidia - - Feature request: @ncomly-nvidia - - Performance: @kaiyux - - Others: @byshiue @schetlur-nv - - placeholder: "@Username ..." - - - type: checkboxes - id: information-scripts-examples - attributes: - label: Information - description: 'The problem arises when using:' - options: - - label: "The official example scripts" - - label: "My own modified scripts" - - - type: checkboxes - id: information-tasks - attributes: - label: Tasks - description: "The tasks I am working on are:" - options: - - label: "An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)" - - label: "My own task or dataset (give details below)" - - - type: textarea - id: reproduction - validations: - required: true - attributes: - label: Reproduction - description: | - Kindly share a code example that demonstrates the issue you encountered. It is recommending to provide a code snippet directly. - Additionally, if you have any error messages, or stack traces related to the problem, please include them here. - - Remember to use code tags to properly format your code. You can refer to the - link https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting for guidance on code formatting. - - Please refrain from using screenshots, as they can be difficult to read and prevent others from copying and pasting your code. - It would be most helpful if we could reproduce your issue by simply copying and pasting your scripts and codes. - - placeholder: | - Steps to reproduce the behavior: - - 1. - 2. - 3. - - - type: textarea - id: expected-behavior - validations: - required: true - attributes: - label: Expected behavior - description: "Provide a brief summary of the expected behavior of the software. Provide output files or examples if possible." - - - type: textarea - id: actual-behavior - validations: - required: true - attributes: - label: actual behavior - description: "Describe the actual behavior of the software and how it deviates from the expected behavior. Provide output files or examples if possible." - - - type: textarea - id: additioanl-notes - validations: - required: true - attributes: - label: additional notes - description: "Provide any additional context here you think might be useful for the TensorRT-LLM team to help debug this issue (such as experiments done, potential things to investigate)." diff --git a/.github/workflows/conventional-pr.yml b/.github/workflows/conventional-pr.yml new file mode 100644 index 00000000..d3348b77 --- /dev/null +++ b/.github/workflows/conventional-pr.yml @@ -0,0 +1,54 @@ +# Copyright 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of NVIDIA CORPORATION nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Thin caller: the logic lives in the org-wide reusable workflow, pinned by +# tag. Workflow changes ship as a new tag in the .github repository plus a +# one-line rev bump here (tags are write-once, never moved). + +name: conventional-pr + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + pull_request_target: + types: [opened, edited, synchronize, reopened] + +jobs: + conventional-pr: + # Same-repo PRs run on the safe pull_request event; fork PRs run on + # pull_request_target so the labeling job gets a writable token (safe + # here: the reusable workflow never checks out PR code - it only reads + # PR metadata via the API and manages labels). + if: >- + (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'pull_request_target' && + github.event.pull_request.head.repo.full_name != github.repository) + permissions: + pull-requests: write + issues: write + contents: read + uses: triton-inference-server/.github/.github/workflows/conventional-pr.yml@v1.4.3 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 4fa18732..cd8680b3 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,4 +1,4 @@ -# Copyright 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,7 +32,23 @@ on: jobs: pre-commit: runs-on: ubuntu-latest + permissions: + contents: read steps: - uses: actions/checkout@v5.0.0 + with: + fetch-depth: 2 - uses: actions/setup-python@v6.0.0 - - uses: pre-commit/action@v3.0.1 + - uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} + - name: Run pre-commit on the files modified by the PR + # Null-delimited so paths with spaces survive; --no-run-if-empty + # handles deletion-only PRs; deleted paths are filtered out before + # being handed to pre-commit. + run: | + python -m pip install --quiet pre-commit + git diff --name-only -z --diff-filter=d HEAD^1 HEAD \ + | xargs -0 --no-run-if-empty \ + pre-commit run --show-diff-on-failure --color=always --files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ee803e26..8385c82e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -# Copyright 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -24,52 +24,72 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +default_install_hook_types: [pre-commit, commit-msg] + +# The tensorrt_llm submodule is maintained in its own repository and is +# excluded from all hooks here. +exclude: ^tensorrt_llm/ repos: -- repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort -- repo: https://github.com/Lucas-C/pre-commit-hooks.git - rev: v1.1.13 - hooks: - - id: remove-crlf -- repo: https://github.com/google/yapf - rev: v0.43.0 - hooks: - - id: yapf -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 - hooks: - - id: check-added-large-files - exclude: 'tensorrt_llm/' - - id: check-merge-conflict - - id: check-symlinks - - id: detect-private-key - - id: end-of-file-fixer - - id: check-yaml - - id: trailing-whitespace -- repo: https://github.com/PyCQA/autoflake - rev: v1.6.1 - hooks: - - id: autoflake - args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variables'] -- repo: https://github.com/pre-commit/mirrors-clang-format - rev: v16.0.0 - hooks: - - id: clang-format - types_or: [c++, c, cuda] - exclude: | - (?x)^( - tensorrt_llm/.* - )$ -- repo: https://github.com/cheshirekow/cmake-format-precommit - rev: v0.6.10 - hooks: - - id: cmake-format -- repo: https://github.com/codespell-project/codespell - rev: v2.2.4 - hooks: - - id: codespell - exclude: tools/dataset/ - args: - - --skip=".git,tensorrt_llm" +- repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + additional_dependencies: [toml] +- repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black + types_or: [python, cython] +- repo: https://github.com/PyCQA/flake8 + rev: 7.3.0 + hooks: + - id: flake8 + args: ["--max-line-length=88", "--select=C,E,F,W,B,B950", "--extend-ignore=E203,E501"] + types_or: [python, cython] +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: v16.0.5 + hooks: + - id: clang-format + types_or: [c, c++, cuda, proto, textproto, java] + args: ["-fallback-style=none", "-style=file", "-i"] +- repo: https://github.com/codespell-project/codespell + rev: v2.2.4 + hooks: + - id: codespell + additional_dependencies: [tomli] + args: ["--toml", "pyproject.toml"] + exclude: (?x)^(.*stemmer.*|.*stop_words.*|^CHANGELOG.md$) +# Validates commit messages against the Conventional Commits format +# (: ); PR titles are validated org-wide by the +# conventional-pr reusable workflow. +- repo: https://github.com/compilerla/conventional-pre-commit + rev: v4.4.0 + hooks: + - id: conventional-pre-commit + stages: [commit-msg] + args: [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test] +# More details about these pre-commit hooks here: +# https://pre-commit.com/hooks.html +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-json + - id: check-symlinks + - id: check-toml + - id: check-yaml + - id: check-shebang-scripts-are-executable + - id: detect-private-key + - id: end-of-file-fixer + types_or: [c, c++, cuda, proto, textproto, java, python] + - id: mixed-line-ending + - id: requirements-txt-fixer + - id: trailing-whitespace + +- repo: https://github.com/triton-inference-server/.github + rev: v1.4.3 + hooks: + - id: add-license diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e4c246bb --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,48 @@ +# Copyright 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of NVIDIA CORPORATION nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[tool.codespell] +# note: pre-commit passes explicit lists of files here, which this skip file list doesn't override - +# this is only to allow you to run codespell interactively +skip = "./.git,./.github" +# ignore short words, and typename parameters like OffsetT +ignore-regex = "\\b(.{1,4}|[A-Z]\\w*T)\\b" +# use the 'clear' dictionary for unambiguous spelling mistakes +builtin = "clear" +# disable warnings about binary files and wrong encoding +quiet-level = 3 + +[tool.isort] +profile = "black" +use_parentheses = true +multi_line_output = 3 +include_trailing_comma = true +force_grid_wrap = 0 +ensure_newline_before_comments = true +line_length = 88 +balanced_wrapping = true +indent = " " +skip = ["build"]