Skip to content

Conversation

@junpi3
Copy link
Contributor

@junpi3 junpi3 commented Nov 19, 2024

Stack from ghstack (oldest at bottom):

Issue

Runtime is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
~Runtime() > ~Adapter() > ~ComputePipelineCache() > save_cache().\

Solution

Move cache saving to VulkanBackend.cpp's model destroy. This makes sense since the cache is tied to the model and not the runtime.

Resources

https://medium.com/@martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195

Differential Revision: D66179917

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/@martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195

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

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 19, 2024

🔗 Helpful Links

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

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 5af5944 with merge base 711f1c2 (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 Nov 19, 2024
junpi3 pushed a commit that referenced this pull request Nov 19, 2024
## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195

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

ghstack-source-id: 254419629
Pull Request resolved: #6974
@facebook-github-bot
Copy link
Contributor

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

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195

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

[ghstack-poisoned]
junpi3 pushed a commit that referenced this pull request Nov 19, 2024
Pull Request resolved: #6974

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/@martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195
ghstack-source-id: 254427379
@exported-using-ghexport

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

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

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195

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

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

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

junpi3 pushed a commit that referenced this pull request Nov 19, 2024
Pull Request resolved: #6974

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/@martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195
ghstack-source-id: 254427928
@exported-using-ghexport

Differential Revision: [D66179917](https://our.internmc.facebook.com/intern/diff/D66179917/)
## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195

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

[ghstack-poisoned]
junpi3 pushed a commit that referenced this pull request Nov 19, 2024
Pull Request resolved: #6974

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/@martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195
ghstack-source-id: 254451659
@exported-using-ghexport

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

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

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195

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

[ghstack-poisoned]
junpi3 pushed a commit that referenced this pull request Nov 20, 2024
Pull Request resolved: #6974

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/@martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195
ghstack-source-id: 254586045
@exported-using-ghexport

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

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

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195

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

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

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

junpi3 pushed a commit that referenced this pull request Nov 20, 2024
Pull Request resolved: #6974

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/@martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195
ghstack-source-id: 254592628
@exported-using-ghexport

Differential Revision: [D66179917](https://our.internmc.facebook.com/intern/diff/D66179917/)
## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195

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

[ghstack-poisoned]
junpi3 pushed a commit that referenced this pull request Nov 20, 2024
Pull Request resolved: #6974

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/@martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195
ghstack-source-id: 254601628
@exported-using-ghexport

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

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

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.\

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195

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

[ghstack-poisoned]
junpi3 pushed a commit that referenced this pull request Nov 21, 2024
Pull Request resolved: #6974

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/@martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195
ghstack-source-id: 254701488
@exported-using-ghexport

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

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

@facebook-github-bot facebook-github-bot merged commit d9d5055 into gh/jorgep31415/126/base Nov 21, 2024
42 checks passed
@facebook-github-bot facebook-github-bot deleted the gh/jorgep31415/126/head branch November 21, 2024 03:09
kirklandsign pushed a commit that referenced this pull request Nov 21, 2024
Pull Request resolved: #6974

## Issue
`Runtime` is a local static variable. Hence we'd expect the Runtime dtor to be called on program exit. But on Android devices it's not being invoked. This behavior is different than that seen 6 months ago (D57085281). It's unclear what changed.

This means the cache is not saved due to the following chain never being invoked.
`~Runtime()`  > `~Adapter()` > `~ComputePipelineCache()` > `save_cache()`.

## Solution
Move cache saving to `VulkanBackend.cpp`'s model destroy. This makes sense since the cache is tied to the model and not the runtime.

## Resources
https://medium.com/@martin00001313/mastering-static-objects-in-c-initialization-destruction-and-best-practices-760b17734195
ghstack-source-id: 254701488
@exported-using-ghexport

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

---------

Co-authored-by: jorgep31415 <[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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants