Skip to content

[ET-VK] Call destructor explicitly when move constructing Value #3148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented Apr 19, 2024

Stack from ghstack (oldest at bottom):

Context

Inspecting code for ATen and ExecuTorch's Value classes (e.g. IValue and EValue respectively) I noticed that the destructor is called explicitly when move constructing with non-trivial types. In practice I don't think calling the destructor explicitly is necessary because move constructing typically sets the moved from object to an inactive state, but since we use Value to encapsulate STL types (i.e. types for which we do not implement the destructor) it's best to call the destructor explicitly to be safe.

Differential Revision: D56357187

Copy link

pytorch-bot bot commented Apr 19, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 4eca1f5 with merge base 269b6ad (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 Apr 19, 2024
@facebook-github-bot
Copy link
Contributor

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

…`Value`"


## Context

Inspecting code for ATen and ExecuTorch's `Value` classes (e.g. `IValue` and `EValue` respectively) I noticed that the destructor is called [explicitly when move constructing with non-trivial types](https://github.com/pytorch/pytorch/blob/main/aten/src/ATen/core/ivalue.h#L409). In practice I don't think calling the destructor explicitly is necessary because move constructing typically sets the moved from object to an inactive state, but since we use `Value` to encapsulate STL types (i.e. types for which we do not implement the destructor) it's best to call the destructor explicitly to be safe.

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

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 825db6c.

@mergennachin mergennachin mentioned this pull request Apr 26, 2024
@SS-JIA SS-JIA deleted the gh/SS-JIA/39/head branch January 24, 2025 19:39
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 Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants