Skip to content

Add Python decomposition for quantile/nanquantile to fix torch.export#174787

Open
tugsbayasgalan wants to merge 2 commits intogh/tugsbayasgalan/120/basefrom
gh/tugsbayasgalan/120/head
Open

Add Python decomposition for quantile/nanquantile to fix torch.export#174787
tugsbayasgalan wants to merge 2 commits intogh/tugsbayasgalan/120/basefrom
gh/tugsbayasgalan/120/head

Conversation

@tugsbayasgalan
Copy link
Copy Markdown
Contributor

@tugsbayasgalan tugsbayasgalan commented Feb 11, 2026

Stack from ghstack (oldest at bottom):

The C++ CompositeImplicitAutograd kernel for quantile calls
at::is_scalar_tensor_true (which uses at::equal, tagged
data_dependent_output) for input validation. During torch.export,
FakeTensor tracing cannot evaluate data-dependent ops, so export
fails with DataDependentOutputException.

Register Python decompositions with py_impl(CompositeImplicitAutograd)
so the Python implementation runs instead of the C++ kernel during
tracing. The Python version uses only sort, gather, lerp, and other
ops that work with FakeTensors.

Authored with Claude.

[ghstack-poisoned]
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Feb 11, 2026

🔗 Helpful Links

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

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

❌ 32 New Failures, 7 Unrelated Failures

As of commit 9e9bae6 with merge base f5fbedb (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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

tugsbayasgalan added a commit that referenced this pull request Feb 11, 2026
ghstack-source-id: 7c2aef2
Pull Request resolved: #174787
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Feb 11, 2026

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@tugsbayasgalan tugsbayasgalan changed the title Fix quantile meta impl Add Python decomposition for quantile/nanquantile to fix torch.export Feb 11, 2026
…orch.export"


The C++ CompositeImplicitAutograd kernel for quantile calls
at::is_scalar_tensor_true (which uses at::equal, tagged
data_dependent_output) for input validation. During torch.export,
FakeTensor tracing cannot evaluate data-dependent ops, so export
fails with DataDependentOutputException.

Register Python decompositions with py_impl(CompositeImplicitAutograd)
so the Python implementation runs instead of the C++ kernel during
tracing. The Python version uses only sort, gather, lerp, and other
ops that work with FakeTensors.

Authored with Claude.



[ghstack-poisoned]
tugsbayasgalan added a commit that referenced this pull request Feb 12, 2026
ghstack-source-id: 8c9f850
Pull Request resolved: #174787
@tugsbayasgalan
Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -i

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Feb 12, 2026
@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: inductor / unit-test / inductor-test / test (inductor_distributed, 1, 1, linux.g5.12xlarge.nvidia.gpu)

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

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@tugsbayasgalan
Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -f "Lintrunner error is unrelated"

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

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

@weifengpy
Copy link
Copy Markdown
Contributor

change test as well? otherwise ci fails

This PR added a Python decomposition for quantile/nanquantile and removed some xfail markers (the test_make_fx_* and
   test_proxy_tensor ones), but it didn't remove the xfail markers for:                                               
  - test_ops_unbacked::test_unbacked_op_db_nanquantile_cpu_float32                                                  
  - test_aotdispatch::test_aot_autograd_disable_functionalization_exhaustive_nanquantile_cpu_float32
  - test_aotdispatch::test_aot_autograd_disable_functionalization_exhaustive_quantile_cpu_float32

@seemethere
Copy link
Copy Markdown
Member

@pytorchbot revert -c nosignal -m "Looks like this is causing failures upstream see https://hud.pytorch.org/pytorch/pytorch/commit/4504c3dcee3c02886fae3340a8ee268717c6cb32"

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

pytorchmergebot added a commit that referenced this pull request Feb 14, 2026
@pytorchmergebot
Copy link
Copy Markdown
Collaborator

@tugsbayasgalan your PR has been successfully reverted.

@pytorchmergebot pytorchmergebot added Reverted ci-no-td Do not run TD on this PR labels Feb 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions Bot added the Stale label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td Do not run TD on this PR ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged Reverted Stale topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants