Running compute and render commands concurrently and with QoS

I need to render a scene at 60 FPS and at the same time run a Metal kernel function.

The problem is that while the rendering pipeline is fast (5 ms) and can easily target 60 FPS, the kernel however can take up to 90 ms to complete.


This obviously causes extreme stuttering.


I tried to create 2 MTLCommandQueues – one for the rendering pipeline and the second for the compute task, which didn't help at all with the concurrent execution problem – the execution order of render and compute tasks is sequential.


I think I'd need some kind of a QoS; given the 16.67 ms time budget per frame, always execute the rendering task and run the compute task for the (16.67-5) ms, effectively running the compute task through several frames.


Has anyone successfuly tackled this problem?

Replies

Only by splitting work into smaller chunks, and interleaving carefully. I don't think that commodity GPUs, especially mobile ones could do what you want soon. Regards Michal