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

Properly Deal with Timeouts #7030

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

Conversation

cwfitzgerald
Copy link
Member

@cwfitzgerald cwfitzgerald commented Jan 30, 2025

Connections

Close #3601
Close #4589

Description
Describe what problem this is solving, and how it's solved.

Testing
Explain how this change is tested.

Checklist

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

@cwfitzgerald cwfitzgerald requested review from crowlKats and a team as code owners January 30, 2025 02:40
@cwfitzgerald cwfitzgerald marked this pull request as draft January 30, 2025 05:09
@cwfitzgerald cwfitzgerald marked this pull request as ready for review January 30, 2025 20:19
@Wumpf Wumpf self-requested a review January 31, 2025 09:40
@teoxoy
Copy link
Member

teoxoy commented Jan 31, 2025

I looked at the wgpu-core changes and they looked good to me. 👍

Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

marvelous! <3

gl: wgpu::GlBackendOptions::from_env_or_default(),
gl: wgpu::GlBackendOptions {
fence_behavior: if cfg!(target_family = "wasm") {
wgpu::GlFenceBehavior::AutoFinish
Copy link
Member

Choose a reason for hiding this comment

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

where in the tests are we relying on this, what would break if we use Normal. Plz add comment

Comment on lines +1881 to +1882
// After the wait, the queue should be empty.
break 'error E::GpuWaitTimeout;
Copy link
Member

Choose a reason for hiding this comment

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

worth a debug assert since this would be an implementation error, no?

let result = if queue_empty {
if let Some(wait_submission_index) = wait_submission_index {
// Assert to ensure that if we received a queue empty status, the fence shows the correct value.
// This is defencive, as this should never be hit.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// This is defencive, as this should never be hit.
// This is defensive, as this should never be hit.

@@ -370,73 +370,133 @@ impl Device {
assert!(self.queue.set(Arc::downgrade(queue)).is_ok());
}

Copy link
Member

Choose a reason for hiding this comment

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

added comments in this file help a lot, thanks!

}
}
}

/// Result of a maintain operation.
pub enum MaintainResult {
/// Error states after a poll
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Error states after a poll
/// Error states after a device poll

Timeout,
}

/// Status of poll operation.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Status of poll operation.
/// Status of device poll operation.

Self::Wait => Maintain::Wait,
Self::Poll => Maintain::Poll,
Self::WaitForSubmissionIndex(i) => PollType::WaitForSubmissionIndex(func(i)),
Self::Wait => PollType::Wait,
Copy link
Member

Choose a reason for hiding this comment

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

I'm kinda tempted to take the opportunity and bake the "non-webgpu-ness" of those wait operations into the names, but I don't know how to do so without making things worse 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants