pytorch - ✅(Solved) Fix `linalg_cholesky_ex_out` contains some dubious logic [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#179152Fetched 2026-04-08 02:33:02
View on GitHub
Comments
1
Participants
2
Timeline
28
Reactions
0
Author
Participants
Timeline (top)
mentioned ×12subscribed ×12labeled ×3commented ×1

PR fix notes

PR #81316: Small optimisation to linalg.cholesky

Description (problem / solution / changelog)

Stack from ghstack:

  • -> #81316

I figured we could save one kernel call in linalg.cholesky

Changed files

  • aten/src/ATen/native/BatchLinearAlgebra.cpp (modified, +18/-5)
RAW_BUFFERClick to expand / collapse

🐛 Describe the bug

See https://github.com/pytorch/pytorch/blob/382011c0ec1ee029d79e88723575638c9ae02b8d/aten/src/ATen/native/BatchLinearAlgebra.cpp#L1832-L1852

That was introduced by https://github.com/pytorch/pytorch/pull/81316 with no good explanation about either perf gains nor why it is guaranteed that all potrf implementations are not allowed to use other part of the matrix as a stratch space (looks like MAGMA does, and so may be some cuBLAS implementation and this time around Apple's Accelerate as well), although per https://www.netlib.org/lapack/lug/node121.html, elements that are "not referenced" are "never read, written to, or otherwise accessed."

Versions

2.11/nightly

cc @jianyuh @nikitaved @mruberry @walterddr @xwang233 @Lezcano

extent analysis

TL;DR

The bug can be potentially fixed by re-examining the changes introduced in pull request #81316 and ensuring that the potrf implementations do not use other parts of the matrix as scratch space.

Guidance

  • Review the code changes in https://github.com/pytorch/pytorch/pull/81316 to understand the reasoning behind the introduction of the bug.
  • Investigate the documentation of potrf implementations, such as MAGMA, cuBLAS, and Apple's Accelerate, to determine if they use other parts of the matrix as scratch space.
  • Verify that the elements marked as "not referenced" in the LAPACK documentation are indeed not accessed by the potrf implementations.
  • Consider adding additional checks or modifications to the code to ensure that the potrf implementations do not access other parts of the matrix.

Example

No code snippet is provided as the issue does not contain sufficient information to create a minimal example.

Notes

The fix may require a deep understanding of the LAPACK library and the specific implementations of potrf. Additionally, the issue may be specific to certain versions of PyTorch or the underlying libraries.

Recommendation

Apply workaround: The issue is likely related to a specific change in the code, and applying a workaround to revert or modify this change may be the most straightforward solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING