Skip to content

[native-dsl] Use has_torch_function in place of check_has_torch_function in const_data_ptr - #199781

Closed
eqy wants to merge 1 commit into
pytorch:mainfrom
eqy:constagain
Closed

eqy wants to merge 1 commit into
pytorch:mainfrom
eqy:constagain

Conversation

@eqy

@eqy eqy commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

otherwise tests such as test/test_overrides.py::TestTorchFunctionRedispatchOpsDeviceCUDA::test_redispatch_topk_cutedsl_optimized_deterministic_cuda_float32 fail with e.g.,

test_overrides.py::TestTorchFunctionRedispatchOpsDeviceCUDA::test_redispatch_topk_cutedsl_optimized_deterministic_cuda_float32 - Exception: you cannot skip two levels of __torch_function__, you need to run one level of __torch_function__ before being able to skip again.
2026-10-05T08:02:28.466965Z 01E Exception raised from THPModule_skip_one_hop_torch_function at /opt/pytorch/pytorch/torch/csrc/utils/disable_torch_function.cpp:292 (most recent call first):
2026-10-05T08:02:28.466966Z 01E frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0xd0 (0xfffff4c13890 in /usr/local/lib/python3.12/dist-packages/torch/lib/libc10.so)
2026-10-05T08:02:28.466967Z 01E frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, char const*) + 0x7c (0xfffff48383c4 in /usr/local/lib/python3.12/dist-packages/torch/lib/libc10.so)
2026-10-05T08:02:28.466968Z 01E frame #2: <unknown function> + 0x12e2eec (0xffffeece2eec in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466969Z 01E frame #3: /usr/bin/python() [0x503fec]
2026-10-05T08:02:28.466969Z 01E frame #4: _PyObject_MakeTpCall + 0x78 (0x4c2c48 in /usr/bin/python)
2026-10-05T08:02:28.466970Z 01E frame #5: _PyEval_EvalFrameDefault + 0x8a0 (0x564354 in /usr/bin/python)
2026-10-05T08:02:28.466971Z 01E frame #6: /usr/bin/python() [0x4c6d6c]
2026-10-05T08:02:28.466971Z 01E frame #7: /usr/bin/python() [0x4c3a84]
2026-10-05T08:02:28.466972Z 01E frame #8: PyObject_CallFunctionObjArgs + 0x80 (0x4c3944 in /usr/bin/python)
2026-10-05T08:02:28.466972Z 01E frame #9: <unknown function> + 0x1e394cc (0xffffef8394cc in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466973Z 01E frame #10: torch::handle_torch_function_no_python_arg_parser(c10::ArrayRef<_object*>, _object*, _object*, char const*, _object*, char const*, torch::TorchFunctionName) + 0x1c (0xffffef802d5c in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466974Z 01E frame #11: <unknown function> + 0x1e11904 (0xffffef811904 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466975Z 01E frame #12: <unknown function> + 0x6c8e80 (0xffffee0c8e80 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466976Z 01E frame #13: /usr/bin/python() [0x4cc00c]
2026-10-05T08:02:28.466976Z 01E frame #14: <unknown function> + 0x12e2e28 (0xffffeece2e28 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466977Z 01E frame #15: /usr/bin/python() [0x503fec]
2026-10-05T08:02:28.466978Z 01E frame #16: _PyObject_MakeTpCall + 0x78 (0x4c2c48 in /usr/bin/python)
2026-10-05T08:02:28.466978Z 01E frame #17: _PyEval_EvalFrameDefault + 0x8a0 (0x564354 in /usr/bin/python)
2026-10-05T08:02:28.466979Z 01E frame #18: /usr/bin/python() [0x4c6d6c]
2026-10-05T08:02:28.466979Z 01E frame #19: /usr/bin/python() [0x4c3a84]
2026-10-05T08:02:28.466980Z 01E frame #20: PyObject_CallFunctionObjArgs + 0x80 (0x4c3944 in /usr/bin/python)
2026-10-05T08:02:28.466981Z 01E frame #21: <unknown function> + 0x1e394cc (0xffffef8394cc in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466981Z 01E frame #22: torch::handle_torch_function_no_python_arg_parser(c10::ArrayRef<_object*>, _object*, _object*, char const*, _object*, char const*, torch::TorchFunctionName) + 0x1c (0xffffef802d5c in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466983Z 01E frame #23: <unknown function> + 0x1e11904 (0xffffef811904 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466983Z 01E frame #24: <unknown function> + 0x6c8e80 (0xffffee0c8e80 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466984Z 01E frame #25: /usr/bin/python() [0x4cc00c]
2026-10-05T08:02:28.466985Z 01E frame #26: PyObject_Vectorcall + 0x4c (0x4c37fc in /usr/bin/python)
2026-10-05T08:02:28.466985Z 01E frame #27: _PyEval_EvalFrameDefault + 0x8a0 (0x564354 in /usr/bin/python)
2026-10-05T08:02:28.466986Z 01E frame #28: PyObject_Vectorcall + 0x4c (0x4c37fc in /usr/bin/python)
2026-10-05T08:02:28.466989Z 01E frame #29: <unknown function> + 0x9cf8e4 (0xffffee3cf8e4 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466989Z 01E frame #30: <unknown function> + 0x1fd39f0 (0xffffef9d39f0 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466990Z 01E frame #31: <unknown function> + 0x1e38644 (0xffffef838644 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466991Z 01E frame #32: <unknown function> + 0x2179b44 (0xffffe4179b44 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cpu.so)
2026-10-05T08:02:28.466992Z 01E frame #33: <unknown function> + 0xab0f6f8 (0xffffecb0f6f8 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cpu.so)
2026-10-05T08:02:28.466993Z 01E frame #34: <unknown function> + 0xa47ada0 (0xffffec47ada0 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cpu.so)
2026-10-05T08:02:28.466993Z 01E frame #35: <unknown function> + 0xa47ab7c (0xffffec47ab7c in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cpu.so)
2026-10-05T08:02:28.466994Z 01E frame #36: at::_ops::topk::call(at::Tensor const&, c10::SymInt, long, bool, bool) + 0x160 (0xffffec47aa78 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cpu.so)
2026-10-05T08:02:28.466995Z 01E frame #37: <unknown function> + 0x2014450 (0xffffefa14450 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466996Z 01E frame #38: /usr/bin/python() [0x503fb4]
2026-10-05T08:02:28.466997Z 01E frame #39: PyObject_Call + 0x6c (0x4c512c in /usr/bin/python)
2026-10-05T08:02:28.466997Z 01E frame #40: <unknown function> + 0x12e2e28 (0xffffeece2e28 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466998Z 01E frame #41: /usr/bin/python() [0x503fec]
2026-10-05T08:02:28.466998Z 01E frame #42: _PyObject_MakeTpCall + 0x78 (0x4c2c48 in /usr/bin/python)
2026-10-05T08:02:28.466999Z 01E frame #43: _PyEval_EvalFrameDefault + 0x8a0 (0x564354 in /usr/bin/python)
2026-10-05T08:02:28.467000Z 01E frame #44: /usr/bin/python() [0x4c6d6c]
2026-10-05T08:02:28.467000Z 01E frame #45: /usr/bin/python() [0x4c3a84]
2026-10-05T08:02:28.467001Z 01E frame #46: PyObject_CallFunctionObjArgs + 0x80 (0x4c3944 in /usr/bin/python)
2026-10-05T08:02:28.467001Z 01E frame #47: <unknown function> + 0x1e394cc (0xffffef8394cc in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.467002Z 01E frame #48: torch::handle_torch_function_no_python_arg_parser(c10::ArrayRef<_object*>, _object*, _object*, char const*, _object*, char const*, torch::TorchFunctionName) + 0x1c (0xffffef802d5c in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.467003Z 01E frame #49: <unknown function> + 0x1e33f78 (0xffffef833f78 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.467004Z 01E frame #50: <unknown function> + 0x201428c (0xffffefa1428c in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.467005Z 01E frame #51: /usr/bin/python() [0x503fb4]
2026-10-05T08:02:28.467005Z 01E frame #52: PyObject_Call + 0x6c (0x4c512c in /usr/bin/python)
2026-10-05T08:02:28.467006Z 01E frame #53: _PyEval_EvalFrameDefault + 0x3f1c (0x5679d0 in /usr/bin/python)
2026-10-05T08:02:28.467006Z 01E frame #54: _PyObject_Call_Prepend + 0xc4 (0x4c4724 in /usr/bin/python)
2026-10-05T08:02:28.467007Z 01E frame #55: /usr/bin/python() [0x5294d0]
2026-10-05T08:02:28.467007Z 01E frame #56: PyObject_Call + 0x6c (0x4c512c in /usr/bin/python)
2026-10-05T08:02:28.467008Z 01E frame #57: _PyEval_EvalFrameDefault + 0x3f1c (0x5679d0 in /usr/bin/python)
2026-10-05T08:02:28.467009Z 01E frame #58: /usr/bin/python() [0x4c6de4]
2026-10-05T08:02:28.467009Z 01E frame #59: _PyEval_EvalFrameDefault + 0x3f1c (0x5679d0 in /usr/bin/python)
2026-10-05T08:02:28.467010Z 01E frame #60: /usr/bin/python() [0x4c6de4]
2026-10-05T08:02:28.467010Z 01E frame #61: _PyEval_EvalFrameDefault + 0x3f1c (0x5679d0 in /usr/bin/python)
2026-10-05T08:02:28.467013Z 01E frame #62: /usr/bin/python() [0x4c6e48]
2026-10-05T08:02:28.467014Z 01E 
2026-10-05T08:02:28.467014Z 01E 
2026-10-05T08:02:28.467014Z 01E Caused by sample input at index 0: SampleInput(input=Tensor[size=(256, 4096), device="cuda:0", dtype=torch.float32], args=(64), kwargs={}, broadcasts_input=False, name='')
2026-10-05T08:02:28.467015Z 01E 
2026-10-05T08:02:28.467016Z 01E To execute this test, run the following from the base repo dir:
2026-10-05T08:02:28.467016Z 01E     PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=0 python test/test_overrides.py TestTorchFunctionRedispatchOpsDeviceCUDA.test_redispatch_topk_cutedsl_optimized_deterministic_cuda_float32
2026-10-05T08:02:28.467017Z 01E 
2026-10-05T08:02:28.467017Z 01E This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
2026-10-05T08:02:28.467018Z 01E !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
2026-10-05T08:02:28.467019Z 01E ===================== 1 failed, 13903 deselected in 2.03s ======================
2026-10-05T08:02:28.467019Z 01E Got exit code 1
2026-10-05T08:02:28.467020Z 01E FAILED CONSISTENTLY: test/test_overrides.py::TestTorchFunctionRedispatchOpsDeviceCUDA::test_redispatch_topk_cutedsl_optimized_deterministic_cuda_float32

authored with codex

@eqy
eqy requested review from albanD and soulitzer as code owners October 5, 2026 16:46
@pytorch-bot

pytorch-bot Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

✅ No Failures

As of commit 12d290b with merge base 96879fd (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 requested a review from slayton58 October 5, 2026 16:46
@github-actions github-actions Bot added bot-triaged This is a label only to be used by the auto triage bot triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Oct 5, 2026
@Skylion007

Copy link
Copy Markdown
Collaborator

@claude review this PR

@claude

claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Claude finished @Skylion007's task in 1m 41s —— View job


LGTM: the fix is correct and small, and the new test hits the regression.

Review details

Root cause

THPVariable_const_data_ptr was the only hand-written method in python_variable_methods.cpp that called check_has_torch_function(self_) directly. Its siblings (get_device, data_ptr, storage_offset, …) call has_torch_function(self_), defined in torch/csrc/utils/disable_torch_function.h:31:

return !consume_should_skip_torch_function() && check_has_torch_function(obj);

check_has_torch_function never reads or clears the one-hop skip flag that torch.overrides.redispatch_function sets. So when a __torch_function__ subclass redispatched const_data_ptr, the call went back into __torch_function__. On the second redispatch_function the flag was still set, which raised you cannot skip two levels of __torch_function__. The cutedsl topk path calls const_data_ptr() on its inputs, so it hit this. The one-line change makes const_data_ptr match data_ptr.

Test (test/test_overrides.py:1998)

  • RedispatchTensor.__torch_function__ logs the call, then calls redispatch_function. Before the fix, the inner call re-entered and raised the same "two levels" error, so the test does catch the regression.
  • assertEqual(len(wrapped.call_log), 1) confirms only one hop of __torch_function__ ran. The class tearDown also checks that the skip flag didn't leak.
  • Nit (optional): the other tests in this class pass call_log=call_log explicitly. Using the default list via wrapped.call_log works fine, though.

Other call sites

No other check_has_torch_function(self…) calls remain in tools/autograd/templates/. The two calls in torch/csrc/autograd/python_variable_indexing.cpp (lines 420 and 636) are the __getitem__/__setitem__ paths. They have their own skip handling and are out of scope here.

BC / perf

  • No BC impact.
  • Perf: one extra TLS read, the same cost as data_ptr.

@eqy

eqy commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchmergebot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 6, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 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.

Details for Dev Infra team Raised by workflow job

@eqy

eqy commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchmergebot merge

@pytorchmergebot

Copy link
Copy Markdown
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

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 9 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

@eqy

eqy commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchmergebot rebase

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased constagain onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout constagain && git pull --rebase)

@eqy

eqy commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorchmergebot merge

@pytorchmergebot

Copy link
Copy Markdown
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

cyyever pushed a commit to BakeLab/pytorch that referenced this pull request Oct 11, 2026
…nction` in `const_data_ptr` (pytorch#199781)

otherwise tests such as `test/test_overrides.py::TestTorchFunctionRedispatchOpsDeviceCUDA::test_redispatch_topk_cutedsl_optimized_deterministic_cuda_float32` fail with e.g.,

```
test_overrides.py::TestTorchFunctionRedispatchOpsDeviceCUDA::test_redispatch_topk_cutedsl_optimized_deterministic_cuda_float32 - Exception: you cannot skip two levels of __torch_function__, you need to run one level of __torch_function__ before being able to skip again.
2026-10-05T08:02:28.466965Z 01E Exception raised from THPModule_skip_one_hop_torch_function at /opt/pytorch/pytorch/torch/csrc/utils/disable_torch_function.cpp:292 (most recent call first):
2026-10-05T08:02:28.466966Z 01E frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0xd0 (0xfffff4c13890 in /usr/local/lib/python3.12/dist-packages/torch/lib/libc10.so)
2026-10-05T08:02:28.466967Z 01E frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, char const*) + 0x7c (0xfffff48383c4 in /usr/local/lib/python3.12/dist-packages/torch/lib/libc10.so)
2026-10-05T08:02:28.466968Z 01E frame #2: <unknown function> + 0x12e2eec (0xffffeece2eec in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466969Z 01E frame #3: /usr/bin/python() [0x503fec]
2026-10-05T08:02:28.466969Z 01E frame #4: _PyObject_MakeTpCall + 0x78 (0x4c2c48 in /usr/bin/python)
2026-10-05T08:02:28.466970Z 01E frame #5: _PyEval_EvalFrameDefault + 0x8a0 (0x564354 in /usr/bin/python)
2026-10-05T08:02:28.466971Z 01E frame #6: /usr/bin/python() [0x4c6d6c]
2026-10-05T08:02:28.466971Z 01E frame #7: /usr/bin/python() [0x4c3a84]
2026-10-05T08:02:28.466972Z 01E frame #8: PyObject_CallFunctionObjArgs + 0x80 (0x4c3944 in /usr/bin/python)
2026-10-05T08:02:28.466972Z 01E frame #9: <unknown function> + 0x1e394cc (0xffffef8394cc in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466973Z 01E frame #10: torch::handle_torch_function_no_python_arg_parser(c10::ArrayRef<_object*>, _object*, _object*, char const*, _object*, char const*, torch::TorchFunctionName) + 0x1c (0xffffef802d5c in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466974Z 01E frame #11: <unknown function> + 0x1e11904 (0xffffef811904 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466975Z 01E frame #12: <unknown function> + 0x6c8e80 (0xffffee0c8e80 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466976Z 01E frame #13: /usr/bin/python() [0x4cc00c]
2026-10-05T08:02:28.466976Z 01E frame #14: <unknown function> + 0x12e2e28 (0xffffeece2e28 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466977Z 01E frame #15: /usr/bin/python() [0x503fec]
2026-10-05T08:02:28.466978Z 01E frame #16: _PyObject_MakeTpCall + 0x78 (0x4c2c48 in /usr/bin/python)
2026-10-05T08:02:28.466978Z 01E frame #17: _PyEval_EvalFrameDefault + 0x8a0 (0x564354 in /usr/bin/python)
2026-10-05T08:02:28.466979Z 01E frame #18: /usr/bin/python() [0x4c6d6c]
2026-10-05T08:02:28.466979Z 01E frame #19: /usr/bin/python() [0x4c3a84]
2026-10-05T08:02:28.466980Z 01E frame #20: PyObject_CallFunctionObjArgs + 0x80 (0x4c3944 in /usr/bin/python)
2026-10-05T08:02:28.466981Z 01E frame #21: <unknown function> + 0x1e394cc (0xffffef8394cc in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466981Z 01E frame #22: torch::handle_torch_function_no_python_arg_parser(c10::ArrayRef<_object*>, _object*, _object*, char const*, _object*, char const*, torch::TorchFunctionName) + 0x1c (0xffffef802d5c in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466983Z 01E frame #23: <unknown function> + 0x1e11904 (0xffffef811904 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466983Z 01E frame #24: <unknown function> + 0x6c8e80 (0xffffee0c8e80 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466984Z 01E frame #25: /usr/bin/python() [0x4cc00c]
2026-10-05T08:02:28.466985Z 01E frame #26: PyObject_Vectorcall + 0x4c (0x4c37fc in /usr/bin/python)
2026-10-05T08:02:28.466985Z 01E frame #27: _PyEval_EvalFrameDefault + 0x8a0 (0x564354 in /usr/bin/python)
2026-10-05T08:02:28.466986Z 01E frame #28: PyObject_Vectorcall + 0x4c (0x4c37fc in /usr/bin/python)
2026-10-05T08:02:28.466989Z 01E frame #29: <unknown function> + 0x9cf8e4 (0xffffee3cf8e4 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466989Z 01E frame #30: <unknown function> + 0x1fd39f0 (0xffffef9d39f0 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466990Z 01E frame #31: <unknown function> + 0x1e38644 (0xffffef838644 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466991Z 01E frame #32: <unknown function> + 0x2179b44 (0xffffe4179b44 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cpu.so)
2026-10-05T08:02:28.466992Z 01E frame #33: <unknown function> + 0xab0f6f8 (0xffffecb0f6f8 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cpu.so)
2026-10-05T08:02:28.466993Z 01E frame #34: <unknown function> + 0xa47ada0 (0xffffec47ada0 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cpu.so)
2026-10-05T08:02:28.466993Z 01E frame #35: <unknown function> + 0xa47ab7c (0xffffec47ab7c in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cpu.so)
2026-10-05T08:02:28.466994Z 01E frame #36: at::_ops::topk::call(at::Tensor const&, c10::SymInt, long, bool, bool) + 0x160 (0xffffec47aa78 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_cpu.so)
2026-10-05T08:02:28.466995Z 01E frame #37: <unknown function> + 0x2014450 (0xffffefa14450 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466996Z 01E frame #38: /usr/bin/python() [0x503fb4]
2026-10-05T08:02:28.466997Z 01E frame #39: PyObject_Call + 0x6c (0x4c512c in /usr/bin/python)
2026-10-05T08:02:28.466997Z 01E frame #40: <unknown function> + 0x12e2e28 (0xffffeece2e28 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.466998Z 01E frame #41: /usr/bin/python() [0x503fec]
2026-10-05T08:02:28.466998Z 01E frame #42: _PyObject_MakeTpCall + 0x78 (0x4c2c48 in /usr/bin/python)
2026-10-05T08:02:28.466999Z 01E frame #43: _PyEval_EvalFrameDefault + 0x8a0 (0x564354 in /usr/bin/python)
2026-10-05T08:02:28.467000Z 01E frame #44: /usr/bin/python() [0x4c6d6c]
2026-10-05T08:02:28.467000Z 01E frame #45: /usr/bin/python() [0x4c3a84]
2026-10-05T08:02:28.467001Z 01E frame #46: PyObject_CallFunctionObjArgs + 0x80 (0x4c3944 in /usr/bin/python)
2026-10-05T08:02:28.467001Z 01E frame #47: <unknown function> + 0x1e394cc (0xffffef8394cc in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.467002Z 01E frame #48: torch::handle_torch_function_no_python_arg_parser(c10::ArrayRef<_object*>, _object*, _object*, char const*, _object*, char const*, torch::TorchFunctionName) + 0x1c (0xffffef802d5c in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.467003Z 01E frame #49: <unknown function> + 0x1e33f78 (0xffffef833f78 in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.467004Z 01E frame #50: <unknown function> + 0x201428c (0xffffefa1428c in /usr/local/lib/python3.12/dist-packages/torch/lib/libtorch_python.so)
2026-10-05T08:02:28.467005Z 01E frame #51: /usr/bin/python() [0x503fb4]
2026-10-05T08:02:28.467005Z 01E frame #52: PyObject_Call + 0x6c (0x4c512c in /usr/bin/python)
2026-10-05T08:02:28.467006Z 01E frame #53: _PyEval_EvalFrameDefault + 0x3f1c (0x5679d0 in /usr/bin/python)
2026-10-05T08:02:28.467006Z 01E frame #54: _PyObject_Call_Prepend + 0xc4 (0x4c4724 in /usr/bin/python)
2026-10-05T08:02:28.467007Z 01E frame #55: /usr/bin/python() [0x5294d0]
2026-10-05T08:02:28.467007Z 01E frame #56: PyObject_Call + 0x6c (0x4c512c in /usr/bin/python)
2026-10-05T08:02:28.467008Z 01E frame #57: _PyEval_EvalFrameDefault + 0x3f1c (0x5679d0 in /usr/bin/python)
2026-10-05T08:02:28.467009Z 01E frame #58: /usr/bin/python() [0x4c6de4]
2026-10-05T08:02:28.467009Z 01E frame #59: _PyEval_EvalFrameDefault + 0x3f1c (0x5679d0 in /usr/bin/python)
2026-10-05T08:02:28.467010Z 01E frame #60: /usr/bin/python() [0x4c6de4]
2026-10-05T08:02:28.467010Z 01E frame #61: _PyEval_EvalFrameDefault + 0x3f1c (0x5679d0 in /usr/bin/python)
2026-10-05T08:02:28.467013Z 01E frame #62: /usr/bin/python() [0x4c6e48]
2026-10-05T08:02:28.467014Z 01E
2026-10-05T08:02:28.467014Z 01E
2026-10-05T08:02:28.467014Z 01E Caused by sample input at index 0: SampleInput(input=Tensor[size=(256, 4096), device="cuda:0", dtype=torch.float32], args=(64), kwargs={}, broadcasts_input=False, name='')
2026-10-05T08:02:28.467015Z 01E
2026-10-05T08:02:28.467016Z 01E To execute this test, run the following from the base repo dir:
2026-10-05T08:02:28.467016Z 01E     PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=0 python test/test_overrides.py TestTorchFunctionRedispatchOpsDeviceCUDA.test_redispatch_topk_cutedsl_optimized_deterministic_cuda_float32
2026-10-05T08:02:28.467017Z 01E
2026-10-05T08:02:28.467017Z 01E This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
2026-10-05T08:02:28.467018Z 01E !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
2026-10-05T08:02:28.467019Z 01E ===================== 1 failed, 13903 deselected in 2.03s ======================
2026-10-05T08:02:28.467019Z 01E Got exit code 1
2026-10-05T08:02:28.467020Z 01E FAILED CONSISTENTLY: test/test_overrides.py::TestTorchFunctionRedispatchOpsDeviceCUDA::test_redispatch_topk_cutedsl_optimized_deterministic_cuda_float32
```

authored with codex
Pull Request resolved: pytorch#199781
Approved by: https://github.com/Skylion007, https://github.com/albanD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-triaged This is a label only to be used by the auto triage bot ciflow/trunk Trigger trunk jobs on your pull request Merged open source topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants