Add as_strided metadata views - #37
Merged
Merged
Conversation
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change registers
aten::as_stridedfor the PrivateUse1 backend so PyTorch composite view operations such as matrix transpose can create Infini tensors that share their source storage.The kernel follows PyTorch's native
TensorImpl::VIEWconstruction and usesat::native::setStridedfor symbolic metadata validation, negative-stride rejection, storage-offset handling, and storage-bound checks. It performs no data copy and provides no CPU fallback.The conformance coverage compares matrix transpose against the CPU numerical oracle and verifies explicit and inherited storage offsets, storage aliasing, invalid metadata behavior, and source-storage lifetime. This PR is stacked on #36 because the lifetime behavior depends on the storage ownership established there.
Testing
95c70080f9551e61241110497d163dfcdf9dc7e7and296271487beb594a248fd463e5fff14f7ab74293with CUDA architecture 80.