Skip to content

[inductor][NVGEMM] Support CuTeDSL compilation under runtime monitors - #194648

Closed
mlazos wants to merge 10 commits into
gh/mlazos/307/basefrom
gh/mlazos/307/head
Closed

mlazos wants to merge 10 commits into
gh/mlazos/307/basefrom
gh/mlazos/307/head

Conversation

@mlazos

@mlazos mlazos commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Support CuTeDSL compilation when runtime monitoring wraps cute.compile with an ordinary function. NVGEMM follows the wrapper's __wrapped__ chain, temporarily restores the underlying subscriptable compiler for serialized kernel compilation, and reinstalls the monitor afterward.

Keep the compatibility shim under the NVGEMM compilation lock because cute.compile is process-global. Add coverage for wrapper restoration, direct-epilogue cache signatures, and separation of the generated local reduction result from ordinary epilogue outputs.

Test Plan

PYTORCH_WORKTREE=$PWD env -u PYTHONPATH python agent_space/run_worktree_python.py test/inductor/test_nv_universal_gemm.py TestNVUniversalGemm.test_compile_preserves_wrapped_cute_compile_protocol TestNVUniversalGemm.test_direct_epilogue_cache_signature_distinguishes_wrapped_tensors TestNVUniversalGemm.test_direct_epilogue_schema_separates_local_reduce_result -v
lintrunner -a

Description drafted with an AI assistant.

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194648

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures, 2 Unrelated Failures

As of commit 5e64a3b with merge base aebbfec (image):

NEW FAILURES - The following jobs have failed:

UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@mlazos

mlazos commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor Author

AI-Review

Automated multi-agent review (architecture, correctness, simplification, generalization, and GPT-5.6 final approval). This is AI-generated — please verify findings manually.


Verified Issues

  • [high] Missing threading import crashes NVGEMM launches — Location: nv_universal_gemm_kernel.py:1096. Trigger: the first GEMM or SCALED_GEMM execution. Failure sequence: _update_reuse_args_tensors() returns true, then threading.Lock() executes after the import was removed, raising NameError before kernel.run(). Impact: non-grouped NVGEMM kernels cannot launch. Reviewers: Architecture, Correctness, Generalization.

  • [medium] Global unwrapping bypasses monitors for concurrent CuTeDSL compilation — Location: nv_universal_gemm_kernel.py:313-317. Trigger: an NVGEMM compile runs under a wrapped cute.compile while another thread starts an unlocked native CuTeDSL compile, such as torch.topk. Failure sequence: NVGEMM replaces the process-global binding with the raw compiler; the concurrent caller resolves that binding and invokes it directly. Impact: the installed monitor misses that compilation event. Reviewers: Architecture, Generalization.

[ghstack-poisoned]
[ghstack-poisoned]
mlazos added 2 commits August 28, 2026 14:08
[ghstack-poisoned]
[ghstack-poisoned]
mlazos added 2 commits August 28, 2026 19:08
[ghstack-poisoned]
[ghstack-poisoned]
mlazos added 2 commits August 31, 2026 21:56
[ghstack-poisoned]
[ghstack-poisoned]
@mlazos mlazos changed the title [inductor][NVGEMM] Preserve CuTeDSL compile protocol under monitors [inductor][NVGEMM] Support CuTeDSL compilation under runtime monitors Sep 18, 2026
[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant