-
Notifications
You must be signed in to change notification settings - Fork 319
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
Generate a validation error on mapAsync early-reject #4786
Conversation
Previews, as seen when this build job started (e3d8478): |
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.
LGTM
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.
I have some concerns about introducing this pattern because I couldn"t find another instance in WebGPU where we have both an early reject and a device timeline validation error.
It does not seem consistent with the rest of error handling in WebGPU, unless I am missing a key point? Do we have another instance where we have both early reject and a device timeline validation error? Presumably the device validation error will occur sometime after the early reject?
If we already have this pattern then I think it should be ok, but seems odd having both the early rejection and the validation error.
Yes, we do it for all of the device-timeline error cases of mapAsync (which is most of them):
|
None of those are early rejection cases on the content timeline that I"m aware of. I couldn"t find any early rejection cases on the content timeline which also generate a device validation error on the device timeline. |
Ah, on the content timeline, no, I think this is the first where the spec actually specifies that. But since the errors are always delivered asynchronously, to an application the timeline barely matters - the only observable behavior difference is whether a .then callback resolves in a microtask off the current task, or later in a regular task. I think it"s more important to have consistent behavior across different error scenarios of mapAsync. As for the implementation burden, there are several places where I think in practice an implementation needs to have a way to InjectError anyway, for example in writeTexture to avoid copying the entire source buffer to the GPU process (which is very important):
|
Indeed, we can inject the error and we do this in other places (such as GPUQueue.writeBuffer/writeTexture in the above case). My primary concern is more the uniqueness to the early rejection and combined device timeline error. But perhaps the argument is, apologies if already stated, having this early rejection + validation error is preferable over simply having an early rejection? Initially, I was not convinced the new pattern warrants the likely zero impact breaking change. But if we think this provides greater consistency, I am happy to switch my review to an approval ✅ |
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.
Thinking about it more and discussion with @kainino0x I am convinced this change is better than what exists today, despite the technically breaking change as it likely impacts no one
Thanks! |
This is currently a proposal.Approved!Fixes #4690