Skip to content

Conversation

eqy
Copy link
Collaborator

@eqy eqy commented Oct 8, 2025

Previously we hardcoded the assumption in cuDNN that the inputs would be dense which breaks when e.g., the user is chunking tensors yielding noncontig inputs

New test added to check this when TORCH_CUDNN_SDPA_NESTED_TENSOR_ENABLED=1 is set in test/test_transformers.py

One issue I noticed was that the old gating of nested tensor in sdp_utils.cpp seems to be a no-op? All of the inputs are reported as "dense" by the time that function is called in the nested tensor tests in test/test_nestedtensor.py -k sdpa

cc @csarofeen @ptrblck @xwang233 @cpuhrsch @jbschlosser @bhosmer @drisspg @soulitzer @davidberard98 @YuqingJ

@eqy eqy requested review from drisspg and liangel-02 October 8, 2025 18:02
@eqy eqy requested review from Aidyn-A and syed-ahmed as code owners October 8, 2025 18:02
@eqy eqy added module: cudnn Related to torch.backends.cudnn, and CuDNN support open source module: nestedtensor NestedTensor tag see issue #25032 topic: not user facing topic category module: sdpa All things related to torch.nn.functional.scaled_dot_product_attentiion labels Oct 8, 2025
Copy link

pytorch-bot bot commented Oct 8, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 0710feb with merge base f46ddb1 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@eqy eqy added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 8, 2025
{K, k.data_ptr()},
{V, v.data_ptr()},
{SCALE, &scaling_factor},
{O, o.data_ptr()},
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: data_ptr is deprecated, please use mutable or const_data_ptr

@eqy
Copy link
Collaborator Author

eqy commented Oct 9, 2025

@pytorchmergebot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: cudnn Related to torch.backends.cudnn, and CuDNN support module: nestedtensor NestedTensor tag see issue #25032 module: sdpa All things related to torch.nn.functional.scaled_dot_product_attentiion open source topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants