Skip to content

Conversation

@swolchok
Copy link
Contributor

@swolchok swolchok commented Sep 26, 2024

Stack from ghstack (oldest at bottom):

The actual deletion operation is not custom. Writing our own TensorPtr class avoids the confusing deleter and allows us to forbid the bugprone release() operation, which would likely cause the Tensor to dangle.

It also highlights that I'm not sure why the Tensor in TensorPtr needs to be on the heap -- now that we don't need the deleter mechanism, it seems like we could put the Tensor inline and perhaps rename TensorPtr to OwningTensor.

Differential Revision: D63467583

The actual deletion operation is not custom. Writing our own TensorPtr class avoids the confusing deleter and allows us to forbid the bugprone release() operation, which would likely cause the Tensor to dangle.

It also highlights that I'm not sure why the Tensor in TensorPtr needs to be on the heap -- now that we don't need the deleter mechanism, it seems like we could put the Tensor inline and perhaps rename TensorPtr to OwningTensor.

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

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Sep 26, 2024

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit bc8bc21 with merge base d2ba238 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@facebook-github-bot facebook-github-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 Sep 26, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63467583

@swolchok
Copy link
Contributor Author

folding into #5684

@swolchok swolchok closed this Sep 26, 2024
kedarnath03 pushed a commit to kedarnath03/executorch that referenced this pull request Jun 25, 2025
The actual deletion operation is not custom. Writing our own TensorPtr class avoids the confusing deleter and allows us to forbid the bugprone release() operation, which would likely cause the Tensor to dangle.

It also highlights that I'm not sure why the Tensor in TensorPtr needs to be on the heap -- now that we don't need the deleter mechanism, it seems like we could put the Tensor inline and perhaps rename TensorPtr to OwningTensor.

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

ghstack-source-id: 244865772
Pull Request resolved: pytorch/executorch#5683
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants