GitHub Repo
PyTorch 2.14 in-place transpose errors reported, implicating CUDA compiler fusion
An RTX 4070 reproducer shows incorrect results for certain tensor sizes after torch.compile. The report points to loop reordering and read/write dependencies; a fix and the impact across environments remain unconfirmed.

On September 22, a PyTorch community report described incorrect numerical results in certain in-place matrix transposes through the CUDA compilation path in version 2.14.0. The reproducer uses an RTX 4070 and CUDA 13.0. Eager execution produces correct results, while results after `torch.compile` vary with tensor size. The public issue remains open. [Issue report](https://github.com/pytorch/pytorch/issues/198280)
The reproducer transposes the last two dimensions, multiplies by one, then writes the result back to the original tensor using `copy_`. When testing 80,000 five-by-five matrices, the reporter found thousands to more than ten thousand mismatched elements in each of five runs. Their analysis points to an interaction between dependency checks and loop reordering: the compiler first removes a read/write ordering constraint, then reorders the loops, and finally fuses the transpose reads and in-place writes into a single kernel. [Reproducer and compilation analysis](https://github.com/pytorch/pytorch/issues/198280)
The issue concerns whether compilation preserves program semantics. Official documentation states that `torch.compile` uses Inductor by default and can produce different compiled variants depending on input conditions. The engineering inference is that passing tests with small tensor sizes does not guarantee correctness for actual batches. Merely confirming that the program raises no exceptions also does not validate its numerical output. [Compilation API](https://docs.pytorch.org/docs/2.14/generated/torch.compile.html)
The official documentation defines `clone` as creating a copy of its input and states that, by default, it preserves the memory format of tensors that meet the relevant conditions. Engineering validation must still check whether compiled numerical results conform to copy semantics; checking only whether the source code calls a copy function is insufficient. [Clone API](https://docs.pytorch.org/docs/2.14/generated/torch.clone.html)
Rewrites using `clone()` and `contiguous()` in the report exhibited the same problem, so they cannot simply be treated as fixes. Disabling loop reordering restored correct behavior in the reporter’s case, but this internal setting cannot yet be considered a generally effective deployment solution. [Report details](https://github.com/pytorch/pytorch/issues/198280)
For troubleshooting, the official guidance recommends using the `eager`, `aot_eager`, and Inductor backends separately to narrow down the source of the failure. Results can then be compared against the uncompiled version across multiple shapes and repeated runs. For workflows that repeatedly update the same buffer, this article recommends comparing intermediate tensors as well and recording software versions, driver details, and a minimal reproducer, rather than checking only the final output shape. These are diagnostic techniques; effects across GPUs, other data types, and models still require testing. [Official troubleshooting guide](https://docs.pytorch.org/docs/2.14/user_guide/torch_compiler/torch.compiler_troubleshooting.html)
The 2.14.1 tracking issue, opened the same day, lists silent numerical errors among the categories eligible for critical fixes, but requires individual commits to go through a request, testing, and approval process. As of this review, that does not establish that this issue has been fixed or is confirmed for inclusion in the next release. Follow-up should track the fix commit, regression tests, and official release records. [Release tracking](https://github.com/pytorch/pytorch/issues/198239)