Commit 792ef43
[ET-VK] Move
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]>save_cache from Runtime dtor to model destroy (#7002)1 parent 0dc25e5 commit 792ef43
File tree
3 files changed
+6
-3
lines changed- backends/vulkan/runtime
- vk_api
3 files changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
621 | 621 | | |
622 | 622 | | |
623 | 623 | | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
624 | 628 | | |
625 | 629 | | |
626 | 630 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | | - | |
410 | | - | |
411 | 409 | | |
412 | 410 | | |
413 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
272 | 274 | | |
273 | 275 | | |
274 | | - | |
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
| |||
0 commit comments