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

Make compute pass end consume the pass #5575

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Apr 21, 2024

Connections

Part of a series towards lifetime removal on compute passes:

Description

  • avoid copies on compute pass end:
    Some work in Separate out ComputeCommand id->arc resolve (a step towards no lifetimes on wgpu::ComputePass) #5432 highlighted that a compute pass (render pass as well, but let's ignore this for now) isn't fully consumed during pass ending which means we have to do a couple of copies despite the fact that a pass can not be consumed twice.
  • error on ending compute pass twice:
    Any operation on an ended compute pass now causes an validation error (as it should per spec!). As expected this allows to remove a few copies (including needless reference count increment + decrement!). Naturally, this means now that all operations on the compute pass are failable
  • rename run to end, make end operation part of compute pass:
    Previously, ending a pass was seen as an operation on the command encoder across the api/crate layers. Now it is part of the render/compute pass in accordance with the WebGPU spec. This is relatively minor but also comes with an error check.
  • improve error handling:
    Compute pass errors make now use of its label

Testing
Existing tests still pass, should be enough for this one.

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.

Copy link
Member

@ErichDonGubler ErichDonGubler left a comment

Choose a reason for hiding this comment

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

praise: These changes make sense to me. Glad to see them!

nitpick: I've taken the liberty of modifying history a bit here, so review is easier and that we might reasonably consider rebasing instead of squashing. I've made individual conversations where it made sense. For general changes, I've folded the following commits into parents: d781e30, e07ba12, 6315094

@@ -247,10 +247,16 @@ impl RenderPass {
}
}

#[inline]
Copy link
Member

Choose a reason for hiding this comment

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

question(non-blocking): Why add #[inline] here? Was it necessary to maintain some performance characteristic alongside these other changes?

wgpu-core/src/command/render.rs Show resolved Hide resolved
wgpu/src/backend/wgpu_core.rs Show resolved Hide resolved
wgpu-core/src/command/compute.rs Show resolved Hide resolved
wgpu-core/src/command/compute.rs Show resolved Hide resolved
@ErichDonGubler
Copy link
Member

I'll leave this PR un-merged for now, not because I'm not confident it'll land as-is, but because I want to give @Wumpf a chance to look over changes I've made to this PR's history before they enter mainline.

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.

None yet

2 participants