GPU Caps Viewer 1.40: Vulkan - Tessellation v2 - sporadic TDR on Intel HD 620

Started by CK, November 14, 2018, 01:55:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

CK

This is a bit tricky one, since it does not happen always.

Repro is simple: just start the demo and close it (escape key).

There is no visible problem, but if you check the system log sometimes you see 4101 event being logged at the time of closing the app.
It looks like resources are destroyed by the application while being still referenced by command buffers on GPU.

When the demo is running it does something like this:
....
vkWaitForFences()
vkQueueSubmit()
vkWaitForFences()
vkQueueSubmit()
vkWaitForFences()
vkQueueSubmit()
....


When user closes demo, application stops above sequence and starts to destroy objects and free memory as below:

vkDestroyBuffer() usage 0x01 VK_BUFFER_USAGE_TRANSFER_SRC_BIT size 0x0000000000020000
vkFreeMemory size x0000000000020000
vkDestroyBuffer() usage 0x80 VK_BUFFER_USAGE_VERTEX_BUFFER_BIT size 0x0000000000004300
vkFreeMemory() size 0x0000000000004300
vkDestroyBuffer() usage 0x40 VK_BUFFER_USAGE_INDEX_BUFFER_BIT size 0x0000000000001000
vkFreeMemory() size 0x0000000000001000
vkDestroyImageView()
vkDestroyImage()
vkFreeMemory() size 0x0000000000020000
vkDestroyPipeline()
vkDeviceWaitIdle()


Destroying sequence starts right after last submit which perhaps shouldn't take place.

From VK spec:
QuotevkDestroyBuffer()            "All submitted commands that refer to buffer, either directly or via a VkBufferView, must have completed execution"
vkFreeMemory()       "All submitted commands that refer to memory (via images or buffers) must have completed execution"
vkDestroyImageView()   "All submitted commands that refer to imageView must have completed execution"
vkDestroyImage()           "All submitted commands that refer to image, either directly or via a VkImageView, must have completed execution"
vkDestroyPipeline()            "All submitted commands that refer to pipeline must have completed execution"


The simple fix in the demo would be just to add vkDeviceWaitIdle between the last vkQueueSubmit and first vkDestroy*


JeGX

Yes I will look at my Vulkan code in order to add a vkDeviceWaitIdle() somewhere.  I already call vkDeviceWaitIdle() but I should call it sooner  ;)

Now, one thing you can do, to see if it can improve things a bit,  is to add a wait_for_gpu() in the demo terminate script. Edit the file
gxldemos/vk-tessellation/main_vk.xml and add gh_renderer.wait_for_gpu() in the TERMINATE script:


<script name="terminate_scene" run_mode="TERMINATE" >
  <raw_data><![CDATA[

gh_renderer.wait_for_gpu()

gh_gpu_buffer.unmap(ub1)
gh_imgui.terminate()

  ]]></raw_data>
</script>


Let me know.


JeGX

Cool, I will release a new update as soon as possible. Thanks for your tests!

CK

I run the test several times with 1.40.1 and the problem was not happening. So it seems to be fixed  :)
Thanks!