Skip to content

[Common, JAX] Enable CuTeDSL in JAX and pause GC when compiling CuTeDSL - #3832

Open
kainzhong wants to merge 1 commit into
NVIDIA:mainfrom
kainzhong:cutedsl_xla_debug
Open

kainzhong wants to merge 1 commit into
NVIDIA:mainfrom
kainzhong:cutedsl_xla_debug

Conversation

@kainzhong

@kainzhong kainzhong commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This enables CuTeDSL in JAX and fix the CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED error before by pausing python GC during CuTeDSL compilation.

This will only defer releasing allocated python objects during CuTeDSL compilation until the next time a GC is triggered, so it only affect peak CPU memory usage by a tiny bit (claude says a MB or so) and it shouldn't affect GPU memory since it's compilation only. No memory is truly leaked.

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:

  • Pause python GC when compiling CuTeDSL
  • Enable CuTeDSL in JAX

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>
@greptile-apps

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect CuTeDSL users who opt in, including JAX users.

The PR appears safe to merge, with a non-blocking request to test the new GC pause.

Findings

  1. P2 GC pause lacks regression tests ▶

Summary

This PR allows JAX to use the optional CuTeDSL backend without forcing it off at import.

  • CuTeDSL compilation pauses Python garbage collection until the compile call ends.
  • JAX can now use CuTeDSL when the backend flag is set.

Reviews (1) · Last reviewed commit: "[Common, JAX] Enable CuTeDSL in JAX and ..." · Reviewed by Greptile

Comment on lines +295 to +299
bool success = false;
{
PythonGCPause gc_pause;
success = cfg.retrieve_func_from_python(key);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 GC pause lacks regression tests

The new pause has no focused test. Existing JAX tests compare kernel outputs and check registration, but do not check that GC stays disabled during compilation or returns to its prior state afterward. Those tests could still pass if a later change brings back the CUDA capture error or leaves GC disabled.

Add tests for GC starting enabled and disabled, overlapping pauses, and a compilation failure.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@jberchtold-nvidia

Copy link
Copy Markdown
Collaborator

/te-ci L2

This branch has not been deployed

No deployments
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.

2 participants