Repository navigation
[inductor] Fix buffer reuse corrupting re-inplaced mutating fallback kernels - #189735
jbschlosser wants to merge 4 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/189735
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 6e873c8 with merge base 20aa640 ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| self.mutation_names.append(tensor_args[0].get_name()) | ||
| # Record aliasing relationship so memory planning doesn't wrongly | ||
| # reuse its storage. | ||
| self.alias_names.append(tensor_args[0].get_name()) |
There was a problem hiding this comment.
as stated in the comments above, this is only triggered if a lowering or pass introduced it, and in practice that pass is reinplacing. so this only affects ops that have a fallback + are reinplaced, which I think today is only the philox ops (unless #189080 lands)
|
@claude are the CI failures related? |
|
Claude finished @jbschlosser's task in 40s —— View job CI failure analysisNo, the CI failure is not related to this PR. The only failing job is:
Two independent signals confirm it's a pre-existing broken-trunk failure:
Recommendation: rebase onto |
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 1 checks: pull / linux-jammy-py3.10-gcc11 / test (backwards_compat, 1, 1, lf-l-x86iavx512-8-64) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 jobs have failed, first few of them are: trunk / linux-jammy-rocm-py3.10-mi350 / test (distributed, 3, 3, linux.rocm.gpu.gfx950.2) Details for Dev Infra teamRaised by workflow job |
|
@claude are the CI failures related? |
|
Claude finished @lucasb-eyer's task in 43s —— View job CI failure analysisNo — the CI failures are not related to this PR. There are two distinct failures in play here, both unrelated to the change: 1. This is the only failing check on the PR, and Dr. CI classified it as
2. Merge attempt — The
Recommendation: Rebase onto |
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 1 checks: pull / linux-jammy-py3.10-gcc11 / test (backwards_compat, 1, 1, lf-l-x86iavx512-8-64) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…kernels (pytorch#189735) Original repro in P2415048693. Found to affect the `_philox_uniform` / `_philox_normal` ops in practice, which currently utilize `FallbackKernel` and are re-inplaced as of pytorch#188495. `FallbackKernel` previously did not record that the returned buffer aliases the input for re-inplaced ops. As a result, memory planning treated the input buffer as dead after the op and wrongly reused its storage while the aliasing output was still live, corrupting results. This PR fixes this by recording the output <-> first-arg alias in `FallbackKernel` so memory planning keeps the buffer live. Pull Request resolved: pytorch#189735 Approved by: https://github.com/eellison ghstack dependencies: pytorch#189767
…kernels (pytorch#189735) Original repro in P2415048693. Found to affect the `_philox_uniform` / `_philox_normal` ops in practice, which currently utilize `FallbackKernel` and are re-inplaced as of pytorch#188495. `FallbackKernel` previously did not record that the returned buffer aliases the input for re-inplaced ops. As a result, memory planning treated the input buffer as dead after the op and wrongly reused its storage while the aliasing output was still live, corrupting results. This PR fixes this by recording the output <-> first-arg alias in `FallbackKernel` so memory planning keeps the buffer live. Pull Request resolved: pytorch#189735 Approved by: https://github.com/eellison ghstack dependencies: pytorch#189767
…kernels (pytorch#189735) Original repro in P2415048693. Found to affect the `_philox_uniform` / `_philox_normal` ops in practice, which currently utilize `FallbackKernel` and are re-inplaced as of pytorch#188495. `FallbackKernel` previously did not record that the returned buffer aliases the input for re-inplaced ops. As a result, memory planning treated the input buffer as dead after the op and wrongly reused its storage while the aliasing output was still live, corrupting results. This PR fixes this by recording the output <-> first-arg alias in `FallbackKernel` so memory planning keeps the buffer live. Pull Request resolved: pytorch#189735 Approved by: https://github.com/eellison ghstack dependencies: pytorch#189767
…kernels (pytorch#189735) Original repro in P2415048693. Found to affect the `_philox_uniform` / `_philox_normal` ops in practice, which currently utilize `FallbackKernel` and are re-inplaced as of pytorch#188495. `FallbackKernel` previously did not record that the returned buffer aliases the input for re-inplaced ops. As a result, memory planning treated the input buffer as dead after the op and wrongly reused its storage while the aliasing output was still live, corrupting results. This PR fixes this by recording the output <-> first-arg alias in `FallbackKernel` so memory planning keeps the buffer live. Pull Request resolved: pytorch#189735 Approved by: https://github.com/eellison ghstack dependencies: pytorch#189767
Stack from ghstack (oldest at bottom):
Original repro in P2415048693.
Found to affect the
_philox_uniform/_philox_normalops in practice, which currently utilizeFallbackKerneland are re-inplaced as of #188495.FallbackKernelpreviously did not record that the returned buffer aliases the input for re-inplaced ops. As a result, memory planning treated the input buffer as dead after the op and wrongly reused its storage while the aliasing output was still live, corrupting results.This PR fixes this by recording the output <-> first-arg alias in
FallbackKernelso memory planning keeps the buffer live.cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo