Alex Joel
Alex Joel

Reputation: 59

In any vulkan API program vkQueueSubmit and vkQueuePresent are very slow. How can we fix this?

I tried on GNU/Linux (on kms, wayland, x11 results are nearly same) on intel ivybrige to record time between function calls and it is

[example-vulkan.c:140] vkQueueSubmit time: 1.770588 ms
[example-vulkan.c:177] vkQueuePresentKHR time: 0.068330 ms 
[example-vulkan.c:140] vkQueueSubmit time: 2.454348 ms
[example-vulkan.c:177] vkQueuePresentKHR time: 0.060280 ms
[example-vulkan.c:140] vkQueueSubmit time: 0.092008 ms
[example-vulkan.c:177] vkQueuePresentKHR time: 0.076017 ms
[example-vulkan.c:140] vkQueueSubmit time: 0.082327 ms
[example-vulkan.c:177] vkQueuePresentKHR time: 0.072389 ms

In all cases it is slow or very slow. It is so slow that it can be seen on any video record of vulkan. On other drivers these functions are most likely slow too. In opengl noting like that happens.

full pastes https://pastebin.com/PQJdzcL9 https://pastebin.com/CjrPy6dJ I did this on this https://github.com/Unesty/swa

Upvotes: 1

Views: 888

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473447

Yes, vkQueueSubmit is slow. The specification even takes time out to say exactly that:

Submission can be a high overhead operation, and applications should attempt to batch work together into as few calls to vkQueueSubmit as possible.

There's nothing to fix; giving the GPU work simply requires time. OpenGL implementations typically hid this time from you by using another thread. But you're using Vulkan now. It's your job to decide on which thread this time is going to be spent.

Upvotes: 3

Related Questions