Hello!
We have observed some garbage vertex data fed into vertex shaders, where garbage is located at the very end of vertex buffers. This causes a 100% reproducible GPU crash. Vertex buffers are allocated in the non coherent memory.
This happens on Pixel 6 which has a Mali-G78 MP20 chip.
For now, the workaround is to align up the VkBufferCreateInfo size field to a multiple of nonCoherentAtomSize, and this fixes the GPU crash bug.
Mapping the buffer and reading data back from it on the CPU produces correct data, so it seems that only GPU is not seeing the correct data at the end of the buffer.
We are doing vkFlushMappedMemoryRanges() after memcpy() to the aligned & allocated buffer memory, and there are no Vulkan debug layer errors displayed during the app execution.
I would be curious to know if this is perhaps a known bug on your side?
Thank you in advance for your help,Milan
Hi Pete,
Thank you for the detailed analysis, it makes the context of the bug much clearer.
The interesting part which I've noticed is that if we request buffer size to be "4 vertices aligned", then we see no bug. If buffer size is less then 4 vertices aligned then we observe the bug.
Note that the actual allocation of memory inside our 16MB Vulkan memory buffer remains the same in both cases (because in this specific case, "4 vertices aligned" and nonCoherentAtomSize alignments are exactly the same) and contents of the memory just outside of the buffer are the same.
So my theory is that there is something in the driver / GPU which prevents accesses outside of the less then "4 vertices aligned" allocated VkBuffer, but feeds junk data instead. While in the case of "4 vertices aligned" allocated buffer, it reads the actual memory which we provide, and which, by chance, contains values which don't crash the GPU (maybe all zeros, so GPU accesses array element 0 and does not crash).
Thanks,Milan