Skip to content

[None][chore] Drop sink_token_length from PyTorch attention surface - #14275

Merged
yuxianq merged 11 commits into
NVIDIA:mainfrom
yuxianq:drop-sink-token-length
May 25, 2026
Merged

[None][chore] Drop sink_token_length from PyTorch attention surface#14275
yuxianq merged 11 commits into
NVIDIA:mainfrom
yuxianq:drop-sink-token-length

Conversation

@yuxianq

@yuxianq yuxianq commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Deprecated Features

    • sink_token_length parameter in KvCacheConfig is now deprecated and ignored on the PyTorch backend.
  • Removed Features

    • StreamingLLM feature support removed from tests and documentation.
  • Documentation

    • Updated attention operator documentation to replace StreamingLLM section with Beam-Search details.
    • Clarified KV cache deprecation status and backend-specific behavior.
  • Tests

    • Removed StreamingLLM-related test cases.

Review Change Stack

Description

StreamingLLM has not been functional on the PyTorch backend since the non-cyclic KV-cache + paged-context FMHA migration (commands/build.py:317-318 already asserted this for the legacy TensorRT path). On the PyTorch path, sink_token_length was silently ignored by the attention kernel while the KV-cache manager still reserved sink blocks — a footgun that produced silent miscomputation if a user ever set KvCacheConfig.sink_token_length=N.

This PR cleans up sink_token_length from the entire PyTorch attention surface, leaving the deeper C++ plumbing (AttentionOp::EnqueueParams, XQA, MMHA, KVBlockArray, executor _KvCacheConfig, decoder DecoderState) intact. 5 atomic commits, peelable layer by layer:

  1. b9dc10d43f — Drop from thop.attention C++ signature + nanobind binding + RunnerBase; drop from 4 MLA helper ops (load_paged_kv_cache_for_mla, load_chunked_kv_cache_for_mla, mla_rope_append_paged_kv_assign_q, mla_rope_generation) — schema strings + signatures + bodies + register_fake; clean Python callers in trtllm.py, sparse/dsa.py, AutoDeploy custom ops, resource_manager.py, and llm_args.py; delete two already-skipped StreamingLLM tests; update kvcache.md + attention.md.
  2. 0e20321523 — Drop redundant explicit = 0; writes (EnqueueParams::sink_token_length already defaults to 0 in common/attentionOp.h); trim awkward implementation-detail prose from the deprecation notes.
  3. fbe45530d2 — Drop sink_token_length from buildPagedKvCacheBuffers declaration + definition + 5 callers (mlaPreprocessOp x3, dsv3RopeOp x1, trtllmGenQKVProcessOp x1); hardcode 0 inside the body where it hands off to the deeper buildKvCacheBuffers<KVBlockArray> template.
  4. 2cb6cd7b40 — Drop sink_token_len from KVCacheManager.get_max_atten_window_upper_bound and its single internal caller. Math collapses cleanly when sink_token_len is always 0; sample values verified (3200, 1568) identical to prior behavior.
  5. f5a72127a9 — Drop sink_token_length from the trtllm-gen QKV pipeline: default-init BuildDecoderInfoParams::sinkTokenLength{0} in gptKernels.h; drop the param + schema + writes from trtllmGenQKVProcessOp.cpp (build_decoder_info, qkv_preprocessing, kv_cache_postprocessing); remove the dataclass field, dead is_supported rejection, and 6 forwarding sites in trtllm_gen.py; drop the matching positional 0 in trtllm.py and register_fake stub field in cpp_custom_ops.py.

KvCacheConfig.sink_token_length is retained as a deprecated Pydantic shim (required by mirror_pybind_fields(_KvCacheConfig) since the executor C++ struct still owns the field) but no longer passed through _to_pybind — any user-supplied non-None value is silently dropped, closing the prior footgun. A DeprecationWarning fires when the field is accessed.

Per docs/source/features/kvcache.md, this field was already pre-announced as "deprecated and will be removed in a future release" — this PR cashes in that deprecation on the PyTorch path.

Test Coverage

Validated on B200 (umbriel-b200-013) after each rebuild:

Suite Result
tests/unittest/_torch/attention/test_attention.py 17 passed (thop.attention path)
tests/unittest/_torch/attention/test_attention_mla.py 80 passed (4 MLA helper ops x v1/v2 KV cache x bf16/fp8 x multiple context lengths, DeepSeek-V3 geometry)
tests/unittest/api_stability 35 passed (committed API surface unchanged)
tests/unittest/llmapi/test_llm_args.py::test_KvCacheConfig_declaration 1 passed

Local Pydantic sanity:

  • KvCacheConfig(sink_token_length=4) syntactically accepted but emits DeprecationWarning
  • cfg._to_pybind().sink_token_length is None — silently dropped before reaching C++ executor
  • _validate_and_adjust_attention_windows and get_max_atten_window_upper_bound signatures no longer take sink_token_len(gth)

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

@yuxianq
yuxianq requested review from a team as code owners May 18, 2026 18:48
@yuxianq

yuxianq commented May 18, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --extra-stage "DGX_B200-4_GPUs-AutoDeploy-1, DGX_H100-4_GPUs-AutoDeploy-1"

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: bafaa80b-9222-4aa6-acce-30a88c29133e

📥 Commits

Reviewing files that changed from the base of the PR and between ca0aad2 and f5a7212.

📒 Files selected for processing (20)
  • cpp/tensorrt_llm/kernels/gptKernels.h
  • cpp/tensorrt_llm/nanobind/thop/bindings.cpp
  • cpp/tensorrt_llm/thop/attentionOp.cpp
  • cpp/tensorrt_llm/thop/attentionOp.h
  • cpp/tensorrt_llm/thop/dsv3RopeOp.cpp
  • cpp/tensorrt_llm/thop/mlaPreprocessOp.cpp
  • cpp/tensorrt_llm/thop/trtllmGenQKVProcessOp.cpp
  • docs/source/features/attention.md
  • docs/source/features/kvcache.md
  • tensorrt_llm/_torch/attention_backend/sparse/dsa.py
  • tensorrt_llm/_torch/attention_backend/trtllm.py
  • tensorrt_llm/_torch/attention_backend/trtllm_gen.py
  • tensorrt_llm/_torch/auto_deploy/custom_ops/attention/trtllm_attention.py
  • tensorrt_llm/_torch/auto_deploy/custom_ops/mla/trtllm_mla.py
  • tensorrt_llm/_torch/custom_ops/cpp_custom_ops.py
  • tensorrt_llm/_torch/pyexecutor/resource_manager.py
  • tensorrt_llm/llmapi/llm_args.py
  • tests/integration/defs/accuracy/test_cli_flow.py
  • tests/unittest/llmapi/test_llm.py
  • tests/unittest/llmapi/test_llm_args.py
💤 Files with no reviewable changes (9)
  • tests/integration/defs/accuracy/test_cli_flow.py
  • tests/unittest/llmapi/test_llm.py
  • tests/unittest/llmapi/test_llm_args.py
  • tensorrt_llm/_torch/auto_deploy/custom_ops/attention/trtllm_attention.py
  • docs/source/features/attention.md
  • tensorrt_llm/_torch/attention_backend/sparse/dsa.py
  • tensorrt_llm/_torch/attention_backend/trtllm.py
  • tensorrt_llm/_torch/auto_deploy/custom_ops/mla/trtllm_mla.py
  • tensorrt_llm/_torch/attention_backend/trtllm_gen.py

📝 Walkthrough

Walkthrough

This PR removes the sink_token_length parameter (StreamingLLM feature) across the entire TensorRT-LLM stack. The parameter is removed from C++ operator signatures, Torch bindings, Python backends, and configuration APIs. It is hardcoded to 0 where needed internally and deprecated in the public configuration layer. Related documentation and tests are updated accordingly.

Changes

StreamingLLM sink_token_length Deprecation

Layer / File(s) Summary
C++ Core Infrastructure Removal
cpp/tensorrt_llm/kernels/gptKernels.h, cpp/tensorrt_llm/thop/attentionOp.h, cpp/tensorrt_llm/thop/attentionOp.cpp
BuildDecoderInfoParams initializes sinkTokenLength to 0, and attention function removes sink_token_length parameter. Cache keys omit sink tokens; buildPagedKvCacheBuffers hardcodes sink_token_length=0 when calling internal buffer construction.
Torch Operator Binding Updates
cpp/tensorrt_llm/nanobind/thop/bindings.cpp, cpp/tensorrt_llm/thop/dsv3RopeOp.cpp, cpp/tensorrt_llm/thop/mlaPreprocessOp.cpp, cpp/tensorrt_llm/thop/trtllmGenQKVProcessOp.cpp
Nanobind and Torch schema registrations for attention, mla_rope_generation, load_paged_kv_cache_for_mla, load_chunked_kv_cache_for_mla, mla_rope_append_paged_kv_assign_q, build_decoder_info, and qkv_preprocessing all remove sink_token_length from exported parameter lists.
TRTLLM-Gen Backend Removal
tensorrt_llm/_torch/attention_backend/trtllm_gen.py
Support checker and public is_supported/trtllm_gen_attention APIs remove sink_token_length parameters. EnqueueParams dataclass drops stored field. Context and generation phase wiring for build_decoder_info and qkv_preprocessing no longer pass sink-token values.
Python Attention Backend Call Sites
tensorrt_llm/_torch/attention_backend/trtllm.py, tensorrt_llm/_torch/attention_backend/sparse/dsa.py, tensorrt_llm/_torch/auto_deploy/custom_ops/attention/trtllm_attention.py, tensorrt_llm/_torch/auto_deploy/custom_ops/mla/trtllm_mla.py
All call sites for Torch operators (prefill/decode paths for standard and MLA attention) remove trailing sink_token_length arguments (previously hardcoded to 0).
Custom Ops Fake Signatures
tensorrt_llm/_torch/custom_ops/cpp_custom_ops.py
Fake shape-inference implementations for build_decoder_info and mla_rope_generation remove sink_token_length parameter and adjust parameter lists accordingly.
Resource Manager and Config Deprecation
tensorrt_llm/_torch/pyexecutor/resource_manager.py, tensorrt_llm/llmapi/llm_args.py
KVCacheManager hardcodes sink_token_length=0 in KVCacheManagerCpp construction, removes sink-token effects from attention window upper-bound calculations. KvCacheConfig.sink_token_length marked deprecated with note that PyTorch backend ignores the value.
Documentation and Test Updates
docs/source/features/attention.md, docs/source/features/kvcache.md, tests/integration/defs/accuracy/test_cli_flow.py, tests/unittest/llmapi/test_llm.py, tests/unittest/llmapi/test_llm_args.py
StreamingLLM section removed from attention docs and replaced with Beam-Search documentation. sink_token_length deprecation clarified in kvcache docs. StreamingLLM test cases removed; test assertions updated to not reference removed parameter.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested reviewers

  • schetlur-nv
  • SimengLiu-nv
  • eopXD
  • syuoni
  • mikeiovine
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title '[None][chore] Drop sink_token_length from PyTorch attention surface' is specific and clearly describes the main change: removing sink_token_length parameter from the PyTorch attention API surface.
Description check ✅ Passed The PR description comprehensively explains the issue (StreamingLLM non-functional on PyTorch, footgun behavior), solution (remove parameter from public APIs while keeping C++ plumbing), test validation (17+80+35+1 tests passed), and follows the template with all required sections including test coverage and completed checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #48962 [ run ] triggered by Bot. Commit: f5a7212 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #48962 [ run ] completed with state SUCCESS. Commit: f5a7212
/LLM/main/L0_MergeRequest_PR pipeline #38707 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yuxianq
yuxianq requested a review from yihwang-nv May 19, 2026 07:51
yuxianq added a commit to yuxianq/TensorRT-LLM that referenced this pull request May 19, 2026
…_kv_cache_for_mla caller

PR NVIDIA#14275 dropped ``sink_token_length`` from the four MLA helper ops in
commit b9dc10d, but the AutoDeploy chunked-prefill caller for
``load_chunked_kv_cache_for_mla`` (trtllm_mla.py:1271) was missed and
still passed a literal ``0,  # sink_token_length`` between
``attention_window_size`` and ``beam_width``. The schema now declares 18
parameters and the call passed 19, breaking
``test_trtllm_mla_out_buffer_padding_cached_kv[cuda-dtype0-4]`` on H100
CI with:

  RuntimeError: trtllm::load_chunked_kv_cache_for_mla() expected at most
  18 argument(s) but received 19 argument(s).

Drop the stale literal so the positional list matches the schema.

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
@yuxianq

yuxianq commented May 19, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49225 [ run ] triggered by Bot. Commit: a4edc01 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49225 [ run ] completed with state SUCCESS. Commit: a4edc01
/LLM/main/L0_MergeRequest_PR pipeline #38898 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yuxianq

yuxianq commented May 20, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49287 [ run ] triggered by Bot. Commit: a4edc01 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49287 [ run ] completed with state SUCCESS. Commit: a4edc01
/LLM/main/L0_MergeRequest_PR pipeline #38949 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yuxianq

yuxianq commented May 20, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run

@yuxianq

yuxianq commented May 20, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

yuxianq added 7 commits May 22, 2026 07:33
Continue the cleanup one layer deeper into the C++ thop helper.

`buildPagedKvCacheBuffers` used to take a `sink_token_length`
parameter and forward it into `buildKvCacheBuffers<KVBlockArray>`.
All thop callers either already pass 0 (MLA helpers, dsv3 RoPE) or
no longer have a meaningful non-zero value to pass (trtllm-gen QKV
preprocess — its own `sink_token_length` is still consumed by
`p.sinkTokenLength` for the kernel preprocessing struct, but the
KV cache buffer it constructs no longer cares).

Changes:
  - cpp/tensorrt_llm/thop/attentionOp.h: drop `sink_token_length`
    from `buildPagedKvCacheBuffers` declaration.
  - cpp/tensorrt_llm/thop/attentionOp.cpp: drop from definition.
    The internal `buildKvCacheBuffers<KVBlockArray>` call still
    requires the param (deeper C++ plumbing untouched), so pass a
    literal 0 there.
  - 5 callers updated to stop forwarding the value:
    mlaPreprocessOp.cpp (3 callsites in load_paged_kv_cache_for_mla,
    load_chunked_kv_cache_for_mla, mla_rope_append_paged_kv_assign_q),
    dsv3RopeOp.cpp (mla_rope_generation), and
    trtllmGenQKVProcessOp.cpp.

Validation on B200 (umbriel-b200-013, incremental build):
  - tests/unittest/_torch/attention/test_attention.py: 17 passed
  - tests/unittest/_torch/attention/test_attention_mla.py: 80 passed

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
`KVCacheManager.get_max_atten_window_upper_bound` was the last
internal Python helper that took `sink_token_len`. Its sole caller
(`_validate_and_adjust_attention_windows`) has been passing 0
since the previous commits, and the function's `sink_bubble_len`
math collapses to a no-op when `sink_token_len == 0`:

    sink_tokens_in_last_block = 0 % tokens_per_block  # = 0
    sink_bubble_len = 0
    max_atten_window_upper_bound = max_token_num - 0  # = max_token_num

Drop the parameter and the now-dead bubble math. Sample evaluations
confirm identical results for the two interesting regimes:

  - beam=1, 100 blocks * 32 tokens, max_seq=2048 -> 3200 (= 100*32)
  - beam=2, same, max_seq>upper                   -> 1568 (= 50*32 - 32)

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
Continue the cleanup into the trtllm-gen path. Every Python caller
in this pipeline already passed 0 — the `is_supported()` rejection
branch was provably dead since nothing produced a non-zero value.

Changes:
  - cpp/tensorrt_llm/kernels/gptKernels.h: default-init
    `BuildDecoderInfoParams::sinkTokenLength` to 0 so callers that
    previously had to assign it explicitly can omit the write.
    `QKVPreprocessingParams::sink_token_len` already defaults to {0}.
  - cpp/tensorrt_llm/thop/trtllmGenQKVProcessOp.cpp:
      - `build_decoder_info`: drop `sink_token_length` param +
        schema entry + the explicit `p.sinkTokenLength = ...` write.
      - `qkv_preprocessing` / `kv_cache_postprocessing`: drop both
        `sink_token_len` (kernel-prep) and `sink_token_length`
        (cyclic-KV) params + schema entries + the
        `p.sink_token_len = ...` write.
  - tensorrt_llm/_torch/attention_backend/trtllm_gen.py: drop the
    `sink_token_length` field from `TrtllmGenAttentionParams`, the
    dead rejection branch in `is_supported`, the docstring lines,
    and all 6 sites that forwarded `params.sink_token_length` (or
    literal 0) to the C++ ops.
  - tensorrt_llm/_torch/attention_backend/trtllm.py: drop the
    positional `0` (sink_token_length) from the `trtllm_gen_attention(...)`
    call now that the wrapper no longer takes the parameter.
  - tensorrt_llm/_torch/custom_ops/cpp_custom_ops.py: drop
    `sink_token_length` from the `build_decoder_info` register_fake
    stub to match the updated schema.

Validation on B200 (umbriel-b200-013):
  - tests/unittest/_torch/attention/test_attention.py: 17 passed
  - tests/unittest/_torch/attention/test_attention_mla.py: 80 passed

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
…_kv_cache_for_mla caller

PR NVIDIA#14275 dropped ``sink_token_length`` from the four MLA helper ops in
commit b9dc10d, but the AutoDeploy chunked-prefill caller for
``load_chunked_kv_cache_for_mla`` (trtllm_mla.py:1271) was missed and
still passed a literal ``0,  # sink_token_length`` between
``attention_window_size`` and ``beam_width``. The schema now declares 18
parameters and the call passed 19, breaking
``test_trtllm_mla_out_buffer_padding_cached_kv[cuda-dtype0-4]`` on H100
CI with:

  RuntimeError: trtllm::load_chunked_kv_cache_for_mla() expected at most
  18 argument(s) but received 19 argument(s).

Drop the stale literal so the positional list matches the schema.

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
…op.attention call

The ``thop.attention()`` call inside ``_handle_prefill_thop_cached_kv``'s
chunked-prefill loop (trtllm_mla.py:1304) was missing the
``sparse_mla_topk_lens`` positional argument between
``sparse_attn_indices_block_size`` (schema pos 68) and
``skip_softmax_threshold_scale_factor_prefill`` (schema pos 71).

The placeholder ``0,  # sparse_mla_topk`` was intended to be
``num_sparse_topk`` (schema pos 69) but its label was abbreviated and the
following ``sparse_mla_topk_lens`` (Tensor? = None, schema pos 70) was
omitted entirely. Without it, every subsequent positional arg was
off-by-one and the binding-arity validator rejected the call on H100:

  TypeError: attention(): incompatible function arguments. ... Invoked
  with types: ... int, int, NoneType, NoneType, ... (one Tensor?/None
  short of the 88-arg schema).

Add the missing ``None,  # sparse_mla_topk_lens`` line and rename the
sibling comment to ``num_sparse_topk`` for consistency with the three
other ``thop.attention`` call sites in this file.

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
…tion in cached_kv path

A second stale ``0,  # sink_token_length`` placeholder remained in the
final-causal ``thop.attention()`` call inside
``_handle_prefill_thop_cached_kv`` (trtllm_mla.py:1422), between
``attention_window_size`` and ``beam_width``. The prior
``ff551611cc`` only added the missing ``sparse_mla_topk_lens`` arg to
the chunked-loop call; the final-causal call still had one extra
positional ``0``, so it still passed 82 positional + 2 kwargs to a
schema expecting 88.

Drop the leftover line and add the missing position-name comments to
match the three other ``thop.attention`` call sites in this file.

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
…cy D200

This branch modifies ``tensorrt_llm/llmapi/llm_args.py`` (deprecating
``sink_token_length``), which triggers the baseline-gated ``ruff-legacy``
pre-commit on that file. The file already had 24 D200 violations on
``main`` while the baseline allows 23, so the lint reported one regression
(line numbers shifted but the count didn't change).

Collapse the existing multi-line ``CudaGraphConfig`` docstring (D200: a
one-line docstring should fit on one line) to bring the count back to 23
and unblock CI without modifying any of the other 23 pre-existing
violations.

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
@yuxianq
yuxianq force-pushed the drop-sink-token-length branch from 234e1b0 to b4face3 Compare May 22, 2026 07:38
@yuxianq

yuxianq commented May 22, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49890 [ run ] triggered by Bot. Commit: b4face3 Link to invocation

Post-rebase clang-format cleanup on the call sites where I removed
``sink_token_length`` from ``buildPagedKvCacheBuffers(...)`` — the
argument-list reflow left some long lines that exceeded the project's
column limit. Apply the formatter to bring them in line with the project
style.

No functional change; matches what ``pre-commit run clang-format``
produces locally.

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
@yuxianq

yuxianq commented May 22, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49897 [ run ] triggered by Bot. Commit: 2c2e817 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49890 [ run ] completed with state ABORTED. Commit: b4face3

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49897 [ run ] completed with state FAILURE. Commit: 2c2e817
/LLM/main/L0_MergeRequest_PR pipeline #39475 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

…and header

Build #39475 failed Build-x86_64 NVIDIA#2806 and Build-SBSA NVIDIA#2786 with a linker
error: undefined references to ``trtllmGenContextPreprocess``,
``trtllmGenContextPostprocess``, and ``trtllmGenGenerationPreprocess`` —
all three with one extra trailing ``long`` parameter compared to the
defined symbols in ``libth_common.so``.

Root cause: ``trtllmGenQKVProcessOp.cpp`` (the definitions) had
``sink_token_length`` removed in a prior commit, but two surfaces still
declared / passed it:

1. ``cpp/tensorrt_llm/thop/trtllmGenFusedOps.h`` (declarations consumed
   by ``bindings.cpp``) — still listed ``int64_t sink_token_length`` in
   all three signatures, so the compiler generated calls with the wrong
   arity that the linker could not resolve.
2. ``cpp/tensorrt_llm/nanobind/thop/bindings.cpp`` — the two lambda
   wrappers (``trtllmGenContextPreprocessBinding`` and
   ``trtllmGenGenerationPreprocessBinding``) still took
   ``sink_token_length`` as a parameter and forwarded it to the
   underlying call. The three ``m.def(...)`` registrations also still
   listed ``nb::arg("sink_token_length")``.

Fix: drop ``sink_token_length`` from all six remaining call-sites — three
in the header and three in the nanobind bindings. The Python callers in
``trtllm_gen.py`` already don't pass it.

Verified: pre-commit (clang-format / ruff / etc.) all pass; no residual
``sink_token_length`` reference in the trtllm-gen surface.

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
@yuxianq

yuxianq commented May 22, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49914 [ run ] triggered by Bot. Commit: ab1a2be Link to invocation

@Superjomn Superjomn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on the llmapi changes.

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49914 [ run ] completed with state SUCCESS. Commit: ab1a2be
/LLM/main/L0_MergeRequest_PR pipeline #39493 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yuxianq

yuxianq commented May 22, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49969 [ run ] triggered by Bot. Commit: ab1a2be Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49969 [ run ] completed with state SUCCESS. Commit: ab1a2be
/LLM/main/L0_MergeRequest_PR pipeline #39535 completed with status: 'SUCCESS'

CI Report

Link to invocation

@yuxianq
yuxianq merged commit f49ac56 into NVIDIA:main May 25, 2026
7 checks passed
yuxianq added a commit to yuxianq/TensorRT-LLM that referenced this pull request May 25, 2026
Step 2 of the squash + 2-step rebase workflow. Step 1 used ``git rebase
-X ours`` so the tree silently took main's lines wherever it could; this
commit re-applies the parts of the derived-attn-props refactor that step
1 dropped on the floor.

Two displaced regions:

1. ``tensorrt_llm/_torch/attention_backend/trtllm.py`` — the
   ``thop.attention(...)`` call inside ``TrtllmAttention._run`` was left
   as a syntactically-valid hybrid: main's positional args followed by
   my kwarg form, with the positional args referencing locals (output,
   workspace, layer_idx, ...) that the refactor moved into
   ``forward_args.X`` properties. Restore the kwarg-only form, drop the
   dead prelude that built the now-unused locals, and remove
   ``sink_token_length`` from both the call site and ``_THOP_LITERALS``
   (main dropped it from the C++ signature in NVIDIA#14275).

2. ``cpp/tensorrt_llm/nanobind/thop/bindings.cpp`` — the
   ``nb::arg("layer_idx")`` for ``thop.attention`` reverted to main's
   spelling even though the C++ function signature in attentionOp.h/.cpp
   already renamed the parameter to ``local_layer_idx``. Restore the
   ``nb::arg("local_layer_idx")`` so the binding name matches the
   underlying parameter and the Python kwarg
   ``local_layer_idx=self.local_layer_idx`` resolves.

Verification:
- pre-commit clean on all 10 touched files (autoflake + clang-format ran)
- ``test_attention_op_sync.py``: 5/5 pass (call-site kwargs match the
  ``nb::arg`` list and ``_THOP_LITERALS`` allowlist)
- All 6 touched Python modules import cleanly

Reviewability: ``git diff rebase-step1..HEAD`` shows every line of manual
judgement in this rebase, isolated from main's churn.

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
KleinBlueC pushed a commit to KleinBlueC/TensorRT-LLM that referenced this pull request May 26, 2026
…VIDIA#14275)

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
bmarimuthu-nv pushed a commit to nv-auto-deploy/TensorRT-LLM that referenced this pull request May 28, 2026
…VIDIA#14275)

Signed-off-by: Yuxian Qiu <142763828+yuxianq@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants