Skip to content
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

Remove latest_submission_index #5976

Merged
merged 4 commits into from
Jul 18, 2024

Conversation

cwfitzgerald
Copy link
Member

Description

This PR flips how latest_submission_index is computed. Previously every submit told each resource that it was used. Now we run through the list of active submissions to see if any of them contain the buffer.

The act of incrementing the value for all resources was quite expensive for the few times we actually needed to know it.

Testing

Tests pass, wrote comments explaining my code

Checklist

  • Run cargo fmt.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@cwfitzgerald cwfitzgerald requested a review from a team as a code owner July 17, 2024 19:14
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff! It's not as expensive as I thought either👍

wgpu-core/src/device/life.rs Outdated Show resolved Hide resolved
@teoxoy
Copy link
Member

teoxoy commented Jul 18, 2024

@cwfitzgerald should we merge this now to get it in the release? Even more perf improvements for .submit() 👀

@cwfitzgerald cwfitzgerald enabled auto-merge (squash) July 18, 2024 16:33
@cwfitzgerald cwfitzgerald merged commit 3c3b532 into gfx-rs:trunk Jul 18, 2024
25 checks passed
@cwfitzgerald cwfitzgerald deleted the remove-submission-ids branch July 31, 2024 20:29
jimblandy added a commit to jimblandy/wgpu that referenced this pull request Sep 23, 2024
As of gfx-rs#5976, we no longer mark resources with the index of the latest
queue submission at which they were used, so in
`wgpu_core::Global::queue_submit`, rather than allocating a new
submission index from `Device::active_submission_index` before
processing all the command buffers, allocate it afterwards.
This shrinks the criticial section between submission index allocation
and actual submission, making gfx-rs#5978 easier to address.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants