-
Notifications
You must be signed in to change notification settings - Fork 896
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
Eagerly release GPU resources when we lose the device. #4834
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cwfitzgerald
requested changes
Dec 6, 2023
@@ -3317,7 +3321,8 @@ impl<A: HalApi> Device<A> { | |||
self.valid.store(false, Ordering::Release); | |||
|
|||
// 1) Resolve the GPUDevice device.lost promise. | |||
let closure = self.lock_life().device_lost_closure.take(); | |||
let mut life_lock = self.lock_life(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be holding the life lock across external closure invocations - this could potentially deadlock.
This prepares for introducing a similar test for global variables.
Co-authored-by: Nicolas Silva <nical@fastmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com> Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com> Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
…calls (gfx-rs#4726) * Add reusable buffer mappings for WASM * Run cargo fmt * Update CHANGELOG.md * Update web.rs * Add documentation for WebBuffer struct
* Remove expose-ids feature * Changelog
cbindgen spins out of control if wgpu_hal reexports a wgpu_types type using pub type in stead of pub use while keeping the same name.
…nUniform`, not just buffer binding arrays. Apply the `NonUniform` decoration to the results of all access chains rooted in binding arrays that use non-uniform values as indices, regardless of the binding array's element type and address space. Previously, Naga only decorated non-uniform access chains for binding arrays of buffers.
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.18.0 to 1.19.0. - [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md) - [Commits](matklad/once_cell@v1.18.0...v1.19.0) --- updated-dependencies: - dependency-name: once_cell dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Ugh, I botched the rebase/merge and I'm not sure how to recover. I'll resubmit as a new PR. |
New, non-borked PR is #4851. |
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Connections
N/A
Description
This destroys buffer objects whenever we "lose the device", including at the end of the
device.destroy
process. Destruction of the buffers triggers reclamation of GPU memory, rather than waiting for the garbage collector to drop the buffer. It would be ideal to also destroy texture objects, buttexture.destroy
is not implemented, as noted in a TODO.Testing
This is exercised by any bulk test execution, like the CTS, which relies on
device.destroy
(not waiting for the garbage collector) to free up GPU resources. Bulk test execution will have less failures due to full memory conditions.Checklist
cargo fmt
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.