Open kainino0x opened 1 year ago
After a bunch of discussion in the webgpu.h meeting we've decided we'll tentatively go forward with my proposal, except for the OS-interop bits that are very tricky and may or may not turn out to be necessary. (Chromium will most likely end up with interesting answers about what we decide to do.)
Slide-deck version of the WGPUFuture proposal: https://docs.google.com/presentation/d/1_0lZlaja_9IJxBMZaQGKvAV8bPZoOosNouiF1WiuEBw/edit?usp=sharing Full 14-page document with lots of implementation details, links about how things work in backend APIs and OSes, alternatives considered, etc.: https://docs.google.com/document/d/1qJRTJRY318ZEqhK6ryw4P-91FumYQfOnNP6LpANYy6A/edit?usp=sharing
EDIT: Forgot to paste the meeting notes from aug 10:
Making some tweaks to make it so we can choose not to polyfill and incrementally improve later:
- Move these features/limits out to a substruct of instance descriptor, add a top-level function that can populate that struct with the supported features.
Just a note: This struct has to be extensible, but WGPUInstanceDescriptor is also extensible, so we end up with:
typedef struct WGPUInstanceFeatures {
WGPUChainedStruct const * nextInChain;
} WGPUInstanceFeatures WGPU_STRUCTURE_ATTRIBUTE;
typedef struct WGPUInstanceDescriptor {
WGPUChainedStruct const * nextInChain;
WGPUInstanceFeatures features;
} WGPUInstanceDescriptor WGPU_STRUCTURE_ATTRIBUTE;
WGPU_EXPORT WGPUSomeStatusEnum wgpuGetInstanceFeatures(WGPUInstanceFeatures* features) WGPU_FUNCTION_ATTRIBUTE;
This is kind of redundant but I guess it's fine? We could extend only one or the other, and/or make wgpuGetInstanceFeatures take a WGPUInstanceDescriptor, but those solutions seem worse.
meeting:
error reporting for invalid CallbackModes
naming: CallbackMode / CallbackModeFlags
We forgot to revisit the question of how to report errors but I think one of the points of always returning a future (as I did in an earlier version of the proposal already) was that now we can return the null future when there's an error, so I propose that being our error mechanism. (With implementation-defined logging for the details.)
Oh, Loko pointed out that if it's an enum (rather than flags that have invalid combinations) then we can probably just crash if you pass (WGPUCallbackMode)1337
Dec 21 meeting
Jan 11 meeting:
Mar 7 meeting:
Issues @lokokung raised during implementation of DeviceLost:
Mar 28 meeting:
Docs were added in #314!
Docs were added in https://github.com/webgpu-native/webgpu-headers/pull/314!
It looks like that pr also adds new functions to the spec. What part of WGPUFuture is still missing now? I'm curious to what extent I can already start implementing async support in wgpu-py 😊
I don't remember for sure, probably WGPUFuture is more or less landed, though there are some changes we need to make to the async functions' signatures for various reasons. I'll review at some point soon....
That said, this header doesn't yet match wgpu-native or Dawn, so please use the header that corresponds with your implementation. (Dawn has implemented WGPUFuture hasn't done all the signature changes yet either.)
Thanks for your reply!
this header doesn't yet match wgpu-native or Dawn
It's on the way 🚀 https://github.com/gfx-rs/wgpu-native/pull/427
Reading through some of the docs referenced here, I saw that if one uses the futures for all events (once its implemented) its not longer necessary to call wgpuInstanceProcessEvents()
. But I also read somewhere that process events
"check in-flight GPU work and free resources no longer used by GPU". Is the latter no longer the case?
It's on the way 🚀 gfx-rs/wgpu-native#427
Just FYI, my PR doesn't really implement WGPUFuture
as I don't think wgpu currently has the necessary infrastructure. wgpuInstanceWaitAny
is just unimplemented!()
right now.
But I also ready somewhere that process events "check in-flight GPU work and free resources no longer used by GPU". Is the latter no longer the case?
IIRC we want to guarantee that stuff like this happens periodically as long as you're submitting work (e.g. in queue.submit()).
Though I did have an unused proposal for a function that would do this, if we find it's needed: https://docs.google.com/document/d/1qJRTJRY318ZEqhK6ryw4P-91FumYQfOnNP6LpANYy6A/edit#heading=h.l3149w38ebmt
I've been working on this for a while, but haven't filed a tracking issue until now.
The main problem is that ProcessEvents is a polling-based API, so there's no way to get notified/woken when an event happens (like posix
poll
, orvkWaitForFences
). A bunch of other issues also crop up around:Expect more from me on this soon.
This issue also subsumes:
TODO: