Skip to content

Conversation

@Gasoonjia
Copy link
Contributor

@Gasoonjia Gasoonjia commented Dec 24, 2025

Stack from ghstack (oldest at bottom):

This diff introduces the foundation for tensor storage management in the SlimTensor migration:

  • util/SharedPtr.h - A lightweight, non-thread-safe shared pointer optimized for single-threaded tensor operations.
  • core/Storage.h - The MaybeOwningStorage class that manages tensor data memory:
    • DeviceTraits specialization with allocate(), free(), memcpy() using malloc/free
    • Owning mode for CPU device (CUDA and non-owning mode added later)
    • Storage type alias as SharedPtr
    • Move semantics for efficient resource transfer
    • clone() and copy_() methods for data management

Differential Revision: D89747980

This diff introduces the foundation for tensor storage management in the SlimTensor migration:

- util/SharedPtr.h - A lightweight, non-thread-safe shared pointer optimized for single-threaded tensor operations.
- core/Storage.h - The MaybeOwningStorage class that manages tensor data memory:
    - DeviceTraits<CPU> specialization with allocate(), free(), memcpy() using malloc/free
    - Owning mode for CPU device (CUDA and non-owning mode added later)
    - Storage type alias as SharedPtr<MaybeOwningStorage>
    - Move semantics for efficient resource transfer
    - clone() and copy_() methods for data management

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

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Dec 24, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 7 Unrelated Failures

As of commit 169c8f2 with merge base 9ba1b5d (image):

NEW FAILURE - The following job has failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@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.

This diff introduces the foundation for tensor storage management in the SlimTensor migration:

- util/SharedPtr.h - A lightweight, non-thread-safe shared pointer optimized for single-threaded tensor operations.
- core/Storage.h - The MaybeOwningStorage class that manages tensor data memory:
    - DeviceTraits<CPU> specialization with allocate(), free(), memcpy() using malloc/free
    - Owning mode for CPU device (CUDA and non-owning mode added later)
    - Storage type alias as SharedPtr<MaybeOwningStorage>
    - Move semantics for efficient resource transfer
    - clone() and copy_() methods for data management

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

[ghstack-poisoned]
This diff introduces the foundation for tensor storage management in the SlimTensor migration:

- util/SharedPtr.h - A lightweight, non-thread-safe shared pointer optimized for single-threaded tensor operations.
- core/Storage.h - The MaybeOwningStorage class that manages tensor data memory:
    - DeviceTraits<CPU> specialization with allocate(), free(), memcpy() using malloc/free
    - Owning mode for CPU device (CUDA and non-owning mode added later)
    - Storage type alias as SharedPtr<MaybeOwningStorage>
    - Move semantics for efficient resource transfer
    - clone() and copy_() methods for data management

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

[ghstack-poisoned]
Copy link
Contributor

@JacobSzwejbka JacobSzwejbka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

This diff introduces the foundation for tensor storage management in the SlimTensor migration:

- util/SharedPtr.h - A lightweight, non-thread-safe shared pointer optimized for single-threaded tensor operations.
- core/Storage.h - The MaybeOwningStorage class that manages tensor data memory:
    - DeviceTraits<CPU> specialization with allocate(), free(), memcpy() using malloc/free
    - Owning mode for CPU device (CUDA and non-owning mode added later)
    - Storage type alias as SharedPtr<MaybeOwningStorage>
    - Move semantics for efficient resource transfer
    - clone() and copy_() methods for data management

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

[ghstack-poisoned]
This diff introduces the foundation for tensor storage management in the SlimTensor migration:

- util/SharedPtr.h - A lightweight, non-thread-safe shared pointer optimized for single-threaded tensor operations.
- core/Storage.h - The MaybeOwningStorage class that manages tensor data memory:
    - DeviceTraits<CPU> specialization with allocate(), free(), memcpy() using malloc/free
    - Owning mode for CPU device (CUDA and non-owning mode added later)
    - Storage type alias as SharedPtr<MaybeOwningStorage>
    - Move semantics for efficient resource transfer
    - clone() and copy_() methods for data management

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

[ghstack-poisoned]
This diff introduces the foundation for tensor storage management in the SlimTensor migration:

- util/SharedPtr.h - A lightweight, non-thread-safe shared pointer optimized for single-threaded tensor operations.
- core/Storage.h - The MaybeOwningStorage class that manages tensor data memory:
    - DeviceTraits<CPU> specialization with allocate(), free(), memcpy() using malloc/free
    - Owning mode for CPU device (CUDA and non-owning mode added later)
    - Storage type alias as SharedPtr<MaybeOwningStorage>
    - Move semantics for efficient resource transfer
    - clone() and copy_() methods for data management

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

[ghstack-poisoned]
@meta-codesync meta-codesync bot merged commit eed3c04 into gh/gasoonjia/74/base Jan 12, 2026
165 of 175 checks passed
@meta-codesync meta-codesync bot deleted the gh/gasoonjia/74/head branch January 12, 2026 22:23
Gasoonjia added a commit that referenced this pull request Jan 12, 2026
This PR was created by the merge bot to help merge the original PR into
the main branch.
ghstack PR number: #16383 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/74/base
ghstack PR head:
https://github.com/pytorch/executorch/tree/gh/gasoonjia/74/head
Merge bot PR base:
https://github.com/pytorch/executorch/tree/gh/gasoonjia/73/orig
Merge bot PR head:
https://github.com/pytorch/executorch/tree/gh/gasoonjia/74/orig
Differential Revision:
[D89747980](https://our.internmc.facebook.com/intern/diff/D89747980/)
@diff-train-skip-merge

---------

Co-authored-by: gasoonjia <[email protected]>
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. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants