Skip to content

[PyTorch] Minor fixes for TE 2.2 - #1589

Merged
cyanguwa merged 17 commits into
NVIDIA:mainfrom
cyanguwa:skip_9.8
Mar 25, 2025
Merged

[PyTorch] Minor fixes for TE 2.2#1589
cyanguwa merged 17 commits into
NVIDIA:mainfrom
cyanguwa:skip_9.8

Conversation

@cyanguwa

@cyanguwacyanguwa commented Mar 19, 2025

Copy link
Copy Markdown
Collaborator

Description

This PR fixes a few things for TE 2.2:

  • truncate cu_seqlens to the actual_batch_size + 1 length for bshd/sbhd formats for cuDNN 9.8+
  • after the above 9.8+ fix, re-enable padding_causal_bottom_right and multi-layer tests for FusedAttention
  • revert the name change in InferenceParams's max_sequence_length parameter from max_seqlen_kv in Add KV cache for paged/non-paged attention #1355
  • rename test_paged_attn tests to test_kv_cache since it include both paged and non-paged tests
  • add :members: to InferenceParams in pytorch.rst docs
  • include CUDNN::cudnn_all in link libraries in CMakeLists.txt so that custom CUDNN_PATH would work
  • remove two redundant None returns in FusedAttnFunc.backward() which has been around for a few TE versions but didn't do any harm
  • add NVTE_DEBUG=1 NVTE_DEBUG_LEVEL=2 to the error message when no backend is found

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • See Description

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
@cyanguwa

cyanguwa commented Mar 19, 2025

Copy link
Copy Markdown
CollaboratorAuthor

/te-ci pytorch L0

cyanguwaand others added 7 commits March 19, 2025 16:50
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
@cyanguwa

Copy link
Copy Markdown
CollaboratorAuthor

/te-ci pytorch L1

Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
@cyanguwa

Copy link
Copy Markdown
CollaboratorAuthor

/te-ci pytorch L1

Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
@cyanguwa

cyanguwa commented Mar 21, 2025

Copy link
Copy Markdown
CollaboratorAuthor

/te-ci pytorch L1

@cyanguwacyanguwa changed the title [PyTorch] Skip cuDNN 9.8 for KV caching[PyTorch] Minor fixes for TE 2.2Mar 22, 2025
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
@cyanguwa

Copy link
Copy Markdown
CollaboratorAuthor

CI: 25860235 for 9.9, and 25863870 for 9.8. Both passed, with expected failures (unrelated to this PR).

@cyanguwacyanguwa mentioned this pull request Mar 22, 2025
13 tasks
@cyanguwa
cyanguwa requested review from ptrendx and removed request for ptrendxMarch 24, 2025 18:07
Comment threadtests/pytorch/test_numerics.py Outdated
Comment threadtransformer_engine/common/CMakeLists.txt Outdated
Comment threadtransformer_engine/pytorch/attention.py
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
@cyanguwa

Copy link
Copy Markdown
CollaboratorAuthor

/te-ci pytorch L0

@cyanguwa

Copy link
Copy Markdown
CollaboratorAuthor

/te-ci jax L0

@cyanguwa

Copy link
Copy Markdown
CollaboratorAuthor

CI looks good, expect some expected failures (unrelated to this PR).

@cyanguwa
cyanguwa merged commit 65c2798 into NVIDIA:mainMar 25, 2025
KshitijLakhani pushed a commit that referenced this pull request Mar 26, 2025
* skip cuDNN 9.8 for KV caching
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* revert from max_seqlen_kv to max_sequence_length for InferenceParams
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* rename test_paged_attn to test_kv_cache
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* remove redundant None returns in bwd
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* add debug flags when no backend is found
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* skip kv_cache_accuracy tests for cuDNN 9.8
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* truncate length of cu_seqlens for consistency with q/k/v shape
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* add back padding_brcm for fused attn tests
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* re-enable kv_cache_accuracy test for 9.8
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* fix cuDNN search dir
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* fixes based on review
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* remove extra empty line
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
---------
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
lhb8125 pushed a commit to lhb8125/TransformerEngine that referenced this pull request Apr 8, 2025
* skip cuDNN 9.8 for KV caching
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* revert from max_seqlen_kv to max_sequence_length for InferenceParams
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* rename test_paged_attn to test_kv_cache
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* remove redundant None returns in bwd
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* add debug flags when no backend is found
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* skip kv_cache_accuracy tests for cuDNN 9.8
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* truncate length of cu_seqlens for consistency with q/k/v shape
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* add back padding_brcm for fused attn tests
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* re-enable kv_cache_accuracy test for 9.8
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* fix cuDNN search dir
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* fixes based on review
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
* remove extra empty line
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
---------
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@cyanguwa@ptrendx@ksivaman