Skip to content

Conversation

@pytorchbot
Copy link
Collaborator

This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #16455 by @Gasoonjia
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/gasoonjia/97/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/gasoonjia/97/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/gasoonjia/96/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/gasoonjia/97/orig
Differential Revision: D90126251
@diff-train-skip-merge

Pull Request resolved: #16454

Add SlimTensor-based implementations of basic property getter AOTI shim functions:

1. `aoti_torch_get_data_ptr()` - Returns pointer to tensor data
2. `aoti_torch_get_sizes()` - Returns pointer to sizes array (SlimTensor stores int64_t directly)
3. `aoti_torch_get_strides()` - Returns pointer to strides array (SlimTensor stores int64_t directly)
4. `aoti_torch_get_dtype()` - Returns the scalar type as int32_t
5. `aoti_torch_get_dim()` - Returns the number of dimensions

Key design:
- Create a new common_shim_slim.h for working on new API while not impact the current pipeline. Will use common_shim_slim.{h/cpp} to replace current common_shim.{h/cpp} when everything has been set up.
- Uses `#ifdef CUDA_AVAILABLE` conditional compilation to seperate the implementation between cuda backend and mps backend since SlimTensor hasn't have mps support yet. Will remove the branch once SlimTensor support mps.
- Refactored to a header-only library so the caller's preprocessor flags determine which tensor type is used. This design supports both CUDA backend (SlimTensor) and MPS backend (ETensor) from a single library.
ghstack-source-id: 336530252
@exported-using-ghexport

Differential Revision: [D90126254](https://our.internmc.facebook.com/intern/diff/D90126254/)
…slim

Pull Request resolved: #16455

Add storage and device property getter AOTI shim functions to the header-only common_shims_slim library:

1. `aoti_torch_get_storage_offset()` - Returns the storage offset (SlimTensor: real offset, ETensor: always 0)
2. `aoti_torch_get_storage_size()` - Returns storage size in bytes
3. `aoti_torch_get_device_type()` - Returns device type (SlimTensor: real type, ETensor: CPU=0)
4. `aoti_torch_get_device_index()` - Returns device index (SlimTensor: real index, ETensor: 0)
ghstack-source-id: 336530255
@exported-using-ghexport

Differential Revision: [D90126251](https://our.internmc.facebook.com/intern/diff/D90126251/)
@pytorch-bot
Copy link

pytorch-bot bot commented Jan 29, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/16991

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (2 Unrelated Failures)

As of commit a2da091 with merge base 0006c83 (image):

BROKEN TRUNK - The following jobs 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.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 29, 2026
Base automatically changed from gh/gasoonjia/96/orig to main January 29, 2026 01:41
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@Gasoonjia Gasoonjia merged commit 726dcea into main Jan 29, 2026
174 of 176 checks passed
@Gasoonjia Gasoonjia deleted the gh/gasoonjia/97/orig branch January 29, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants