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

Metal encoder & pass timestamp support #4008

Merged
merged 13 commits into from
Sep 16, 2023
Merged

Metal encoder & pass timestamp support #4008

merged 13 commits into from
Sep 16, 2023

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Aug 6, 2023

Checklist

  • Run cargo clippy.
  • Run cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections

Description
Implements timer queries via write_timestamp on Metal for encoders (whenever timer queries are available) and passes (for Intel/AMD GPUs, where we should advertise TIMESTAMP_QUERY_INSIDE_PASSES now).

Due to some bugs in Metal this was a lot harder than expected. I believe the solution is close to optimal with the current restrictions in place. For details see code comments.

Testing

Tested on an Apple Silicon device - this always goes a slow path and does not have TIMESTAMP_QUERY_INSIDE_PASSES available.

TODO: Test on AMD or Intel device where we have TIMESTAMP_QUERY_INSIDE_PASSES and can go the fast & simple path.

@Wumpf Wumpf marked this pull request as draft August 6, 2023 20:20
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Code is absolutely cursed, but explained well, seems we just need testing and we'll be good

wgpu-hal/src/metal/command.rs Outdated Show resolved Hide resolved
@cwfitzgerald cwfitzgerald marked this pull request as ready for review September 14, 2023 22:17
@cwfitzgerald
Copy link
Member

Pulling this out of draft - @Wumpf can you rebase and then let's land this thing.

@Wumpf Wumpf enabled auto-merge (squash) September 16, 2023 19:54
@Wumpf Wumpf merged commit 0ffdae3 into trunk Sep 16, 2023
39 checks passed
@Wumpf Wumpf deleted the metal-encoder-timestamps branch September 16, 2023 20:01
bradwerth pushed a commit to bradwerth/wgpu that referenced this pull request Sep 19, 2023
Implements timer queries via write_timestamp on Metal for encoders (whenever timer queries are available) and passes (for Intel/AMD GPUs, where we should advertise TIMESTAMP_QUERY_INSIDE_PASSES now).

Due to some bugs in Metal this was a lot harder than expected. I believe the solution is close to optimal with the current restrictions in place. For details see code comments.
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.

Implement Timestamp Queries on Metal
2 participants