How to debug a silent exit()

20 views
Skip to first unread message

Dov Grobgeld

unread,
May 13, 2021, 3:05:34 PM5/13/21
to swift...@googlegroups.com
Hello,

We're using the swiftshader Vulkan dll on a Windows 64 host . So far it has worked beautifully for our offscreen render target. But today I encountered a strange problem.

I've recently made some changes to our code and after the changes, the program is  working fine both on a Linux host with a NVidia Vulkan driver and on a Windows host with a NVidia driver. But when running the same program but after replacing the NVidia vulkan-1.dll file with the corresponding swiftshader DLL, the program silently exit() after calling vkWaitForFences(). This does not happen if I remove the call to vkCmdDraw().

What I'm immediately asking, is what would be a good way to debug this? Should I try to write a minimal working example that I can share with the list? Or should I try to run my program in the VS debugger? Or are there any environment variable flags that I can turn on that will make SwiftShade? What I have already tested is to run with validation layers (with my NVidia driver), and it runs cleanly.

Thanks a lot in advance!
Dov

Nicolas Capens

unread,
May 13, 2021, 4:34:26 PM5/13/21
to Dov Grobgeld, swiftshader
Hi Dov,

Thanks for contacting us about this. I would recommend creating a Debug build of SwiftShader. By default it will pop up a dialog box when the library is loaded by the application, which gives you the opportunity to attach to it with the VS debugger. Usually that should point you to where the crash is happening or where an assert is being hit.

One exception I've encountered where even a Debug build exists silently is when LLVM fails to compile the code we generate for the shaders. There are some specific LLVM functions where you could put a breakpoint to catch this. Let me know if you think you've hit such a case and I'll dig up the details.

Also feel free to open a bug at g.co/swiftshaderbugs and provide some info about what kind of application changes made it fail.

Cheers,
Nicolas

--
You received this message because you are subscribed to the Google Groups "swiftshader" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swiftshader...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swiftshader/CA%2B%2BfsGFLco9JT_FmS3fyb7QuSHGYWTHQE7Lk6NRWow_opOb%2B8A%40mail.gmail.com.

Dov Grobgeld

unread,
May 14, 2021, 12:33:51 AM5/14/21
to Nicolas Capens, swiftshader
Hi Nicolas,

Thanks a lot for the answer! By your suggestions, I compiled a debug build, attached the debugger and I found that it was the following assert in VkCommandBuffer.cpp that failed:
ASSERT(offset + size <= vk::MAX_PUSH_CONSTANT_SIZE);
My push constant block is 208 bytes which is greater than MAX_PUSH_CONSTANT_SIZE==128. This is indeed according to the spec, but apparently NVIDIA is using a larger value. Still, an error return code or some other orderly failure would be nicer than the silent shutdown of the ASSERT.

For my part, I'll just rewrite my code to use a uniform instead of the push constant and I'll probably be good to go.

Thanks again!

Dov

Nicolas Capens

unread,
May 14, 2021, 11:36:05 AM5/14/21
to Dov Grobgeld, swiftshader
Great to hear that a Debug build immediately pinpointed the problem.

Note that a push constant size of 128 bytes is very common, including for all AMD desktop GPUs: https://vulkan.gpuinfo.org/displaydevicelimit.php?name=maxPushConstantsSize.

Could you check that when using the Validation Layers, together with SwiftShader as the ICD, they catch the problem?
Reply all
Reply to author
Forward
0 new messages