Repository navigation
Conversation
Summary: The CUDA shim `aoti_torch__reinterpret_tensor` treated its offset argument as an absolute storage offset. PyTorch's `_reinterpret_tensor` (torch/csrc/inductor/inductor_ops.cpp) adds it to the source tensor's existing storage offset. When the source already had a nonzero offset, the shim returned success but read the wrong elements. For example, with a source at offset 4 and increment 2, it read storage `[2, 3, 4]` instead of `[6, 7, 8]`. This change adds `self->storage_offset()` to the increment, matching PyTorch, and renames the parameter to `offset_increment`. `aoti_torch_as_strided` now passes an increment of 0, so it keeps the source offset without adding it twice. Differential Revision: D130858308
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24827
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 1 Unrelated Failure, 1 Unclassified FailureAs of commit a684f6a with merge base 0287ce1 ( NEW FAILURE - The following job has failed:
UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
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. |
|
@Gasoonjia has exported this pull request. If you are a Meta employee, you can view the originating Diff in D130858308. |
This PR needs a
|
|
@claude /pr-review |
|
Claude finished @Gasoonjia's task in 10m 57s —— View job This PR makes Detailed reviewPR Review: #24827SummaryThe PR makes
API Design
Code Quality
RecommendationApprove Nothing blocks merging. The |
Summary:
The CUDA shim
aoti_torch__reinterpret_tensortreated its offset argument as an absolute storage offset. PyTorch's_reinterpret_tensor(torch/csrc/inductor/inductor_ops.cpp) adds it to the source tensor's existing storage offset. When the source already had a nonzero offset, the shim returned success but read the wrong elements. For example, with a source at offset 4 and increment 2, it read storage[2, 3, 4]instead of[6, 7, 8].This change adds
self->storage_offset()to the increment, matching PyTorch, and renames the parameter tooffset_increment.aoti_torch_as_stridednow passes an increment of 0, so it keeps the source offset without adding it twice.Differential Revision: D130858308