-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The Venus host device shall always run with basic validation and every form of robustness you can enable. Issue vk_device_lost and break connection with guest upon first validation error. We can experiment with syncval and GPU AV in the future but that's for shipping things and subject to no performance bottlenecks.
Unfortunately IPC via sockets sucks
https://github.com/goldsborough/ipc-bench
Sure the machine sucks by today's standards but it's not like you'll get deviations by an order of magnitude.
In the context of 60fps rendering this means "only" 1000 messages with Websockets and you can only hope for 4-50x improvements with native messaging
https://codereview.stackexchange.com/questions/299482/native-messaging-performance-test
https://gist.github.com/TotallyNotChase/8c9e79ed967ae911869aec82545b21ae
https://github.com/TotallyNotChase/lib-native-messaging/tree/master?tab=readme-ov-file#connectionful-messaging-1
Given that your average Vulkan app does bazillions of calls per frame, we need to buffer up and delay certain calls so they can be batched and there's less small message spam. Check if Venus already does this.
The primary example of things which can be buffered up is command buffer recording, you should only send it over once end().
has been called. Or more extremely if it hasn't been sent since last end().call and it's used in a submit, although that incurs latency.
If you rename vulkan objects and give them different handles on the guest (which you should do for security), then you can escape having to send a message for things like image, buffer, etc creation right away. Map and unmap are also things which don't need serialising because you get your own copy of the range in wasm.
The only things you can't buffer up and defer are sync primitive operations, submits, device memory allocation, mapped range flushes and invalidations. Everything else I can see flushing in a deferred manner whenever these former operations run.
Default behaviour should be to not advertise any Coherent memory.
However because most Vulkan code in the wild won't work without coherent and we want Crysis in a browser, we need an override which allows coherent and deals with it by copying every mapped range (what Renderdoc used to do for coherent and persistent mappings in GL and VK) to the host upon a submit, and back when a fence or timeline sema is awaited on.
The architecture should allow range tracking (in page size increments of 16kb) to be implemented in the future so we can narrow down what to copy. Ranges bound to buffers with BDA must always be considered in use.
Without being able to track pages accessed by the guest (also with networked impl, when guest taps a mapped page it's already too late to start sending) every time a client performs a domain operation from device to host (vulkan host not host host I terms of Venus) you need to preemptively start a transfer of all mappings which could be dirty. This means tracking if dirty resources would have to be per queue, and every time you'd wait in a signal you'd have to do an analysis of what to pop not only from the signalling queues' dirty range list but also other queues because the signalling queue may have had a dependency in the past with them.
For now just send everything, well figure this out later if perf is needed.
P.S. for non-COHERENT memory we should report a pretty large nonCoherentAtomSize