Skip to content

[None][refactor] Refactor Skip Softmax Attention Interface - #14687

Merged
bobboli merged 32 commits into
NVIDIA:mainfrom
bobboli:bli/skip-softmax-decouple-llm-vg
Jun 17, 2026
Merged

[None][refactor] Refactor Skip Softmax Attention Interface#14687
bobboli merged 32 commits into
NVIDIA:mainfrom
bobboli:bli/skip-softmax-decouple-llm-vg

Conversation

@bobboli

@bobboli bobboli commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  1. Split sparse attention user configs from backend runtime params so AttentionBackend instances store lowered SparseParams, not public config objects.
  2. Centralize Skip Softmax Attention backend helpers: ModelOpt checkpoint parsing, calibration formula evaluation, scheduler state, kernel params, and SkipSoftmaxParams.
  3. Lower LLM and VisualGen Skip Softmax Attention configs through to_sparse_params() before backend construction, including ModelOpt ignore handling.
  4. Keep VisualGen checkpoint calibration per model component, so multi-transformer pipelines resolve each component from its own config.json.
  5. Add VisualGen normalized timestep cutoff support through disabled_until_timestep and include the resulting Skip Softmax Attention phase in CUDA graph keys.
  6. Refresh sparse attention docs and reorganize LLM/VisualGen tests around Python API, YAML API, checkpoint metadata, layer filtering, and timestep cutoff behavior.

Details

  1. Sparse runtime params boundary

  2. Shared Skip Softmax Attention backend logic

  3. LLM lowering path

  4. VisualGen per-layer lowering and checkpoint calibration

  5. VisualGen timestep cutoff and CUDA graph keys

  6. Docs and tests

Follow-ups

  • ModelOpt sparse-attention checkpoints use ignore in config.json; this PR treats that as the supported sparse layer-disable path. Existing hf_quant_config.json / exclude_modules handling should remain a quantization compatibility concern, not the primary sparse-attention interface.
  • The VisualGen sparse-attention doc is intentionally not indexed yet. It is a draft location for colleagues to continue VisualGen-specific sparse-attention documentation after this PR lands.

Test plan

  • Passed: pre-commit run --files tensorrt_llm/_torch/attention_backend/sparse/skip_softmax.py tensorrt_llm/_torch/modules/attention.py tensorrt_llm/llmapi/llm_args.py tests/unittest/_torch/visual_gen/sparse_attention/test_skip_softmax.py tests/unittest/llmapi/test_llm_args.py
  • Passed: commit-time pre-commit hooks for the latest commit.
  • Earlier syntax checks passed on the updated test files with python3 -m py_compile and git diff --check.
  • Not run locally: targeted pytest suites, because this local shell does not have the full TensorRT-LLM pytest/runtime dependency stack.
  • CI on this branch is pending.

@bobboli
bobboli force-pushed the bli/skip-softmax-decouple-llm-vg branch 26 times, most recently from 03da487 to 0472e42 Compare May 29, 2026 13:15
bobboli added 8 commits June 17, 2026 10:15
Signed-off-by: Bo Li <22713281+bobboli@users.noreply.github.com>
Signed-off-by: Bo Li <22713281+bobboli@users.noreply.github.com>
Signed-off-by: Bo Li <22713281+bobboli@users.noreply.github.com>
Signed-off-by: Bo Li <22713281+bobboli@users.noreply.github.com>
Signed-off-by: Bo Li <22713281+bobboli@users.noreply.github.com>
Signed-off-by: Bo Li <22713281+bobboli@users.noreply.github.com>
Signed-off-by: Bo Li <22713281+bobboli@users.noreply.github.com>
…cy tests

WanTransformer3DModel.forward expects a normalized timestep in [0, 1] and
rescales to the scheduler's 1000-step range internally. The direct-transformer
accuracy tests in test_wan21_t2v_pipeline.py passed a raw timestep (500), which
became 500000 after the internal rescale and drove the timestep embedding out
of its trained range. NVFP4's 4-bit dynamic range amplified the resulting
activation error, dropping NVFP4 end-to-end cosine similarity to 0.9426 (below
the 0.95 threshold); the FP8 paths masked the same issue under their 0.99
tolerance.

Pass a normalized timestep so the embedder receives the correct range. NVFP4
end-to-end cosine similarity recovers to 0.9643 and the FP8 paths are now
numerically correct as well.

Signed-off-by: Bo Li <22713281+bobboli@users.noreply.github.com>
@bobboli
bobboli force-pushed the bli/skip-softmax-decouple-llm-vg branch from c945bea to 6817fb2 Compare June 17, 2026 02:15
@bobboli

bobboli commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

/bot reuse-pipeline

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54722 [ reuse-pipeline ] triggered by Bot. Commit: 6817fb2 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #54722 [ reuse-pipeline ] completed with state SUCCESS. Commit: 6817fb2
Reusing PR_Github #54606 for commit 6817fb2

Link to invocation

@bobboli
bobboli merged commit 9a081b8 into NVIDIA:main Jun 17, 2026
7 checks passed
lowsfer added a commit to lowsfer/TensorRT-LLM that referenced this pull request Jun 17, 2026
Refactor NVIDIA#14687 (Skip Softmax Attention Interface) renamed the
AttentionMetadata field to sparse_metadata_params but left two stale
kwargs on main that break all T5/BART encoder-decoder tests (both kv-v1
and kv-v2), independent of KVCacheManagerV2:

- _util.py: the cross KV-cache _create_kv_cache_manager() call passed
  sparse_attn_config=None; the parameter is sparse_attention_config.
- model_engine.py: the encoder attention-metadata construction passed
  sparse_attention_config=..., but AttentionMetadata expects
  sparse_metadata_params. Convert via to_sparse_metadata_params() like
  the decoder path does.

This is a pre-existing main regression surfaced by this PR's CI; kept in
a dedicated commit separate from the KVCacheManagerV2 translation.

Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
lowsfer added a commit to lowsfer/TensorRT-LLM that referenced this pull request Jun 18, 2026
These are pre-existing bugs on main (not caused by the KVCacheManagerV2
work) that this PR's CI surfaces; grouped here, separate from the squashed
translation commit.

1) NVIDIA#14687 (Skip Softmax Attention Interface) renamed the AttentionMetadata
   field to sparse_metadata_params but left two stale kwargs that break all
   T5/BART encoder-decoder tests (both kv-v1 and kv-v2):
   - _util.py: cross KV-cache _create_kv_cache_manager() was passed
     sparse_attn_config=None; the parameter is sparse_attention_config.
   - model_engine.py: the encoder attention-metadata construction passed
     sparse_attention_config=...; AttentionMetadata expects
     sparse_metadata_params. Convert via to_sparse_metadata_params() like the
     decoder path.

2) create_perf_comparison_report.py raised FileNotFoundError when the sole
   perf test is skipped/waived (nvbugs/6329256) and no CSV is produced,
   failing the 'Create Perf Report' CI stage. Skip report generation
   gracefully when no perf CSVs exist, mirroring sanity_perf_check.py.

Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
lowsfer added a commit to lowsfer/TensorRT-LLM that referenced this pull request Jun 18, 2026
These are pre-existing bugs on main (not caused by the KVCacheManagerV2
work) that this PR's CI surfaces; grouped here, separate from the squashed
translation commit.

1) NVIDIA#14687 (Skip Softmax Attention Interface) renamed the AttentionMetadata
   field to sparse_metadata_params but left two stale kwargs that break all
   T5/BART encoder-decoder tests (both kv-v1 and kv-v2):
   - _util.py: cross KV-cache _create_kv_cache_manager() was passed
     sparse_attn_config=None; the parameter is sparse_attention_config.
   - model_engine.py: the encoder attention-metadata construction passed
     sparse_attention_config=...; AttentionMetadata expects
     sparse_metadata_params. Convert via to_sparse_metadata_params() like the
     decoder path.

2) create_perf_comparison_report.py raised FileNotFoundError when the sole
   perf test is skipped/waived (nvbugs/6329256) and no CSV is produced,
   failing the 'Create Perf Report' CI stage. Skip report generation
   gracefully when no perf CSVs exist, mirroring sanity_perf_check.py.

Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
xinhe-nv pushed a commit to tensorrt-cicd/TensorRT-LLM that referenced this pull request Jun 23, 2026
)

Signed-off-by: Bo Li <22713281+bobboli@users.noreply.github.com>
Signed-off-by: GitLab CI Bot <gitlab-ci@nvidia.com>
xinhe-nv pushed a commit to tensorrt-cicd/TensorRT-LLM that referenced this pull request Jun 24, 2026
)

Signed-off-by: Bo Li <22713281+bobboli@users.noreply.github.com>
Signed-off-by: GitLab CI Bot <gitlab-ci@nvidia.com>
liji-nv pushed a commit to liji-nv/TensorRT-LLM that referenced this pull request Jul 7, 2026
These are pre-existing bugs on main (not caused by the KVCacheManagerV2
work) that this PR's CI surfaces; grouped here, separate from the squashed
translation commit.

1) NVIDIA#14687 (Skip Softmax Attention Interface) renamed the AttentionMetadata
   field to sparse_metadata_params but left two stale kwargs that break all
   T5/BART encoder-decoder tests (both kv-v1 and kv-v2):
   - _util.py: cross KV-cache _create_kv_cache_manager() was passed
     sparse_attn_config=None; the parameter is sparse_attention_config.
   - model_engine.py: the encoder attention-metadata construction passed
     sparse_attention_config=...; AttentionMetadata expects
     sparse_metadata_params. Convert via to_sparse_metadata_params() like the
     decoder path.

2) create_perf_comparison_report.py raised FileNotFoundError when the sole
   perf test is skipped/waived (nvbugs/6329256) and no CSV is produced,
   failing the 'Create Perf Report' CI stage. Skip report generation
   gracefully when no perf CSVs exist, mirroring sanity_perf_check.py.

Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
liji-nv pushed a commit to liji-nv/TensorRT-LLM that referenced this pull request Jul 7, 2026
These are pre-existing bugs on main (not caused by the KVCacheManagerV2
work) that this PR's CI surfaces; grouped here, separate from the squashed
translation commit.

1) NVIDIA#14687 (Skip Softmax Attention Interface) renamed the AttentionMetadata
   field to sparse_metadata_params but left two stale kwargs that break all
   T5/BART encoder-decoder tests (both kv-v1 and kv-v2):
   - _util.py: cross KV-cache _create_kv_cache_manager() was passed
     sparse_attn_config=None; the parameter is sparse_attention_config.
   - model_engine.py: the encoder attention-metadata construction passed
     sparse_attention_config=...; AttentionMetadata expects
     sparse_metadata_params. Convert via to_sparse_metadata_params() like the
     decoder path.

2) create_perf_comparison_report.py raised FileNotFoundError when the sole
   perf test is skipped/waived (nvbugs/6329256) and no CSV is produced,
   failing the 'Create Perf Report' CI stage. Skip report generation
   gracefully when no perf CSVs exist, mirroring sanity_perf_check.py.

Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
liji-nv pushed a commit to liji-nv/TensorRT-LLM that referenced this pull request Jul 7, 2026
These are pre-existing bugs on main (not caused by the KVCacheManagerV2
work) that this PR's CI surfaces; grouped here, separate from the squashed
translation commit.

1) NVIDIA#14687 (Skip Softmax Attention Interface) renamed the AttentionMetadata
   field to sparse_metadata_params but left two stale kwargs that break all
   T5/BART encoder-decoder tests (both kv-v1 and kv-v2):
   - _util.py: cross KV-cache _create_kv_cache_manager() was passed
     sparse_attn_config=None; the parameter is sparse_attention_config.
   - model_engine.py: the encoder attention-metadata construction passed
     sparse_attention_config=...; AttentionMetadata expects
     sparse_metadata_params. Convert via to_sparse_metadata_params() like the
     decoder path.

2) create_perf_comparison_report.py raised FileNotFoundError when the sole
   perf test is skipped/waived (nvbugs/6329256) and no CSV is produced,
   failing the 'Create Perf Report' CI stage. Skip report generation
   gracefully when no perf CSVs exist, mirroring sanity_perf_check.py.

Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
liji-nv pushed a commit to liji-nv/TensorRT-LLM that referenced this pull request Jul 8, 2026
These are pre-existing bugs on main (not caused by the KVCacheManagerV2
work) that this PR's CI surfaces; grouped here, separate from the squashed
translation commit.

1) NVIDIA#14687 (Skip Softmax Attention Interface) renamed the AttentionMetadata
   field to sparse_metadata_params but left two stale kwargs that break all
   T5/BART encoder-decoder tests (both kv-v1 and kv-v2):
   - _util.py: cross KV-cache _create_kv_cache_manager() was passed
     sparse_attn_config=None; the parameter is sparse_attention_config.
   - model_engine.py: the encoder attention-metadata construction passed
     sparse_attention_config=...; AttentionMetadata expects
     sparse_metadata_params. Convert via to_sparse_metadata_params() like the
     decoder path.

2) create_perf_comparison_report.py raised FileNotFoundError when the sole
   perf test is skipped/waived (nvbugs/6329256) and no CSV is produced,
   failing the 'Create Perf Report' CI stage. Skip report generation
   gracefully when no perf CSVs exist, mirroring sanity_perf_check.py.

Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
liji-nv pushed a commit to liji-nv/TensorRT-LLM that referenced this pull request Jul 9, 2026
These are pre-existing bugs on main (not caused by the KVCacheManagerV2
work) that this PR's CI surfaces; grouped here, separate from the squashed
translation commit.

1) NVIDIA#14687 (Skip Softmax Attention Interface) renamed the AttentionMetadata
   field to sparse_metadata_params but left two stale kwargs that break all
   T5/BART encoder-decoder tests (both kv-v1 and kv-v2):
   - _util.py: cross KV-cache _create_kv_cache_manager() was passed
     sparse_attn_config=None; the parameter is sparse_attention_config.
   - model_engine.py: the encoder attention-metadata construction passed
     sparse_attention_config=...; AttentionMetadata expects
     sparse_metadata_params. Convert via to_sparse_metadata_params() like the
     decoder path.

2) create_perf_comparison_report.py raised FileNotFoundError when the sole
   perf test is skipped/waived (nvbugs/6329256) and no CSV is produced,
   failing the 'Create Perf Report' CI stage. Skip report generation
   gracefully when no perf CSVs exist, mirroring sanity_perf_check.py.

Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>
lowsfer added a commit to lowsfer/TensorRT-LLM that referenced this pull request Jul 9, 2026
These are pre-existing bugs on main (not caused by the KVCacheManagerV2
work) that this PR's CI surfaces; grouped here, separate from the squashed
translation commit.

1) NVIDIA#14687 (Skip Softmax Attention Interface) renamed the AttentionMetadata
   field to sparse_metadata_params but left two stale kwargs that break all
   T5/BART encoder-decoder tests (both kv-v1 and kv-v2):
   - _util.py: cross KV-cache _create_kv_cache_manager() was passed
     sparse_attn_config=None; the parameter is sparse_attention_config.
   - model_engine.py: the encoder attention-metadata construction passed
     sparse_attention_config=...; AttentionMetadata expects
     sparse_metadata_params. Convert via to_sparse_metadata_params() like the
     decoder path.

2) create_perf_comparison_report.py raised FileNotFoundError when the sole
   perf test is skipped/waived (nvbugs/6329256) and no CSV is produced,
   failing the 'Create Perf Report' CI stage. Skip report generation
   gracefully when no perf CSVs exist, mirroring sanity_perf_check.py.

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

Labels

LLM API <NV>High-level LLM Python API & tools (e.g., trtllm-llmapi-launch) for TRTLLM inference/workflows. SW Architecture VisualGen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants