Skip to content

[Common] Make CI fail if CuTeDSL kernels with supported configs are not used - #3746

Merged
ptrendx merged 9 commits into
NVIDIA:mainfrom
kainzhong:warn_or_fail_when_cutedsl_not_chosen
Nov 6, 2026
Merged

ptrendx merged 9 commits into
NVIDIA:mainfrom
kainzhong:warn_or_fail_when_cutedsl_not_chosen

Conversation

@kainzhong

@kainzhong kainzhong commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Description

We need fail cases where we expect CuTeDSL kernels are used to avoid silent fallbacks like #3743 catches. This also introduces a breaking change that NVTE_WARN_IF_CUTEDSL_BACKEND_NOT_CHOSEN is changed to NVTE_REPORT_IF_CUTEDSL_BACKEND_NOT_CHOSEN which can warn or fail the test.

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:

  • Report CuTeDSL kernels falling back with a warn or fail option based on the env var
  • 2D quantization is currently unsupported so for this it won't trigger warn or fail and I added a TODO to remind me of adding this kernel later
  • Add cuda-bindings in setup.py since it's used by quantize_mxfp8.py and fused_mla_q_uproj
  • Make CI scripts fail if falling back to CUDA

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: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
@greptile-apps

greptile-apps Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were established.

Summary

Adds opt-in warnings or errors when an enabled CuTeDSL backend falls back to CUDA.

  • CuTeDSL misses can now warn or stop instead of silently falling back.
  • C++, JAX, and PyTorch test runs stop when CuTeDSL fallback is reported.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[MXFP8 request] --> B{CuTeDSL enabled?}
  B -->|No| C[Use CUDA]
  B -->|Yes| D{2D quantization?}
  D -->|Yes| C
  D -->|No| E{CuTeDSL kernel available?}
  E -->|Yes| F[Use CuTeDSL]
  E -->|No| G{Report setting}
  G -->|Unset| C
  G -->|WARN| H[Warn and use CUDA]
  G -->|ERROR| I[Raise an error]
Loading

Reviews (6) · Last reviewed commit: "Merge branch 'main' into warn_or_fail_wh..." · Reviewed by Greptile

Comment thread qa/L0_pytorch_unittest/test.sh Resolved
Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
@kainzhong

Copy link
Copy Markdown
Collaborator Author

/te-ci

1 similar comment
@kainzhong

Copy link
Copy Markdown
Collaborator Author

/te-ci

Comment thread docs/envvars.rst
If these requirements are not met, Transformer Engine will fall back to using CUDA C++ kernels if possible.

.. envvar:: NVTE_WARN_IF_CUTEDSL_BACKEND_NOT_CHOSEN
.. envvar:: NVTE_REPORT_IF_CUTEDSL_BACKEND_NOT_CHOSEN

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a breaking change due to the envvar change, so we should mark that in the description box, which would be later useful for relnotes

Comment thread setup.py Outdated
"pydantic",
"importlib-metadata>=1.0",
"packaging",
"cuda-bindings",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's used by quantize_mxfp8.py and fused_mla_q_uproj.py. nvidia-cutlass-dsl should always depends on this but I think it's clearer to explicitly mark this as a dependency

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In that case we should also mark nvidia-cutlass-dsl and tvi-ffi as required dependencies. Currently those are user installed, which is fine because this is an optional backend. So for consistency either all or none should be included.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Actually fused_mla_q_uproj.py uses cuda-bindings for passing the stream to cudnn-fe's kernel so I guess we can make this a dependency for all. For nvidia-cutlass-dsl and tvm-ffi, you can use CUDA kernels if you don't install these so I think we should make them dependency when we move to 3.0 and get rid of CUDAS kernels?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

OK I removed this

Signed-off-by: Kaining Zhong <kainingz@nvidia.com>

@ksivaman ksivaman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGtM

@ksivaman

Copy link
Copy Markdown
Member

/te-ci

@kainzhong

Copy link
Copy Markdown
Collaborator Author

Actually we should merge #3743 first

@kainzhong

Copy link
Copy Markdown
Collaborator Author

/te-ci

1 similar comment
@kainzhong

Copy link
Copy Markdown
Collaborator Author

/te-ci

@ptrendx
ptrendx merged commit 1bb3f10 into NVIDIA:main Nov 6, 2026
37 of 38 checks passed
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.

3 participants