This is my third bugreport about Vulkan SPIR-V shaders bugs in AMD:
Hardware AMD Vega 8(Ryzen 3200)
This is not hardware bug, why - because this shader work without problems in same AMD hardware in OpenGL.
OS Windows10, AMD drivers latest, everything latest, tested on two PC
Examples(exe) linked in end of this post. (code do not have validation errors at all)
Problem is :
1. using something more complicated then single linear function in AMD SPIR-V shader, with single exit(single return for whole logic) result UB or unpredictable result. Having any code after first single return function will result UB.
2. using any loops in AMD SPIR-V shaders trigger UB almost always.
Example code that 100% ruin GLSL any shader just call main2() function in your shader
void main2()
{
int i=0;
if(i==0)return;
else return;
// BUG ??? I have no idea how and why it work, it work only with loop(while or for)
for (int i=0; i < 1; i++) {
}
return;
}
How this bug ruin real shader:
in this shader I use 128bytes push constant and reat them bit by bit in shader, and print all bits as Number and as red lines. this is single shader, nothing else
on AMD:
same shader on Nvidia
Source code of this shader https://www.shadertoy.com/view/3sXyW2
(change var bits to push constant array)
zip contain three tests, with single shader.
Shader source in test_<X>\shaders\src\main.frag
test_1 - shader that display 128 bytes(UINT) push_contants (same as on screenshot), bug happened
test_2 - shader from shadertoy that dispaly 128 bytes that build in to shader, no bug
test_3 - code with Example code from this post, call only main2() that ruin shader
Other download Vulkan code from SaschaWillems triangle.cpp
Download valid_AMD_ub_test.zip
valid_AMD_ub_test.zip has two folder, NO_BUG and BUG
launcheing triangle.exe from BUG folder make app crash on AMD GPU
Solved! Go to Solution.
NOT Fixed in latest Adrenalin 21.5.1
Bug with "noise" still exist on the AMD Vega8 GPU (Ryzen 3200)
Maybe this is hardware limitation/bug so can be closed I think.
this bug works in the Linux AMD driver on the same hardware (same as on Windows10)
(I have multiple PC with Ryzen Vega8 and every of it have same bug, this is not single PC hardware problem)
this why I think it hardware limitation
I have update `*.exe` of my code, that single validaton error fixed now, so this error had no effect, bug still exist... my code valid
Hi danilw, I have found the root cause, great thanks for your report, I will fix it soon!
NOT Fixed in latest Adrenalin 21.5.1
Bug with "noise" still exist on the AMD Vega8 GPU (Ryzen 3200)
Maybe this is hardware limitation/bug so can be closed I think.
this bug works in the Linux AMD driver on the same hardware (same as on Windows10)
(I have multiple PC with Ryzen Vega8 and every of it have same bug, this is not single PC hardware problem)
this why I think it hardware limitation
I can assume:
(I can be wrong it still can be my application problem(I do not see the problem but maybe), idk)
by Vulkan specs size of Push Constant is >= 128 bytes
when I use 64 bytes - everything fine
when I use 128 bytes-data become "with noise bug" like on the screenshot (tested today on latest AMD drivers)
So "maybe" this is hardware limitation for some AMD GPU, I used Vega 8 integrated Ryzen GPU, and some other AMD GPU also confirm it.
And real size of push-const on AMD is 64 bytes. (for that reason in my apps I dont use more than 64 bytes of push const)