Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes and bugs and unexpected results #29

Open
danilw opened this issue Sep 18, 2022 · 2 comments
Open

Crashes and bugs and unexpected results #29

danilw opened this issue Sep 18, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@danilw
Copy link
Contributor

danilw commented Sep 18, 2022

I have this repo https://github.com/danilw/GPU-my-list-of-bugs
In this my "List of shader bugs" some shaders with UB and other "edge-cases".
I tested shaders from this my lit with this project spvm.

Using spvm_shadertoy of this project to test.

To test with llvmpipe I use https://github.com/danilw/vulkan-shadertoy-launcher GPU detected as
Vulkan GPU - CPU: llvmpipe (LLVM 14.0.4, 256 bits) (id: 0x0000) from vendor 0x10005 [driver version: 0x0001, API version: 0x4030D3]

(I list only "broken" results, correct not listed)
(multi-channel shaders not tested, just few where I copy Buf code as Image shader code)

Shadertoy link llvmpipe(CPU) result spvm result
https://www.shadertoy.com/view/wdVyWD freeze, can not render frame crash segfault, even removing texture function from code
https://www.shadertoy.com/view/7ddfzr 1 2
https://www.shadertoy.com/view/ftXXW4 works as expected crash segfault, even removing texture function from code
https://www.shadertoy.com/view/7lt3Rl 11 22
https://www.shadertoy.com/view/NsBBDW 111 222
https://www.shadertoy.com/view/ftlcDS works, screenshot in Shadertoy comments crash segfault
https://www.shadertoy.com/view/slsXzs white black (not bug, its UB)
https://www.shadertoy.com/view/NsXBWr works (use BufA as Image shader) crash segfault, even removing texture function from code (use BufA as Image shader)

More:

https://github.com/danilw/card-game-GLSL

Using original_bufA.glsl as Image shader (rename iChannel3 to iChannel0 for spvm_shadertoy). Expected result - background should be rendered. llvmpipe(CPU) result - render single frame after 1 min of "loading shader". spvm result - crash segfault.

Using unrolled_bufA.glsl as Image shader (same rename). llvmpipe result - render single frame after 1 min of "loading shader". spvm result - crash segfault.

My public shaders:

Shadertoy link llvmpipe(CPU) result spvm result
https://www.shadertoy.com/view/NslGRN works(after 1 min of shader loading) crash segfault
https://www.shadertoy.com/view/sldGDf works crash segfault
https://www.shadertoy.com/view/4lKcDD works crash segfault
https://www.shadertoy.com/view/NljfzV works as expected, 2-3 fps 1 frame per 3 min.... and visual result does not look correct , to test I set #define iTime 2.0 and #define iMouse vec4(0.) 333
https://www.shadertoy.com/view/lttfR8 works as expected incorrect visual result 4444
https://www.shadertoy.com/view/wt2fWw works as expected crash segfault
https://www.shadertoy.com/view/4sdBDn works as expected crash segfault
https://www.shadertoy.com/view/4dGBWy (shader had one not initialized variable, this why result in llvmpile was incorrect) works as expected after fix crash segfault (tested again, same crash)

Surprisingly, this shader https://www.shadertoy.com/view/Nt2Szm works in spvm when it complex enough.
And this same shader GLES2 port https://www.shadertoy.com/view/fdc3Dn works in spvm. (1 frame per min)
When this same shader unrolled version https://www.shadertoy.com/view/sdcGDr - does not work in spvm. spvm result - crash segfault. llvmpipe(CPU) result - works as expected.


I made this "test" just for fun, idk if it can be considered "useful".
Result is - most of my shaders dont work with spvm.
llvmpipe is still best option to launch your shaders on CPU.

@keith2018 keith2018 added the bug Something isn't working label Sep 19, 2022
@keith2018
Copy link
Owner

Thx for the testing !
I will check and fix all the cases list above

@keith2018
Copy link
Owner

keith2018 commented Sep 24, 2022

After several bugfix, most of the shader will not crash segfault any more, but some of the instructions still work different with GPU, and performance is still very slow, I'm going to reimplement the interpreter with SIMD support and maybe enable JIT/AOT support using llvm.

Test result update :
(MacBook Pro (16-inch, 2019) AMD Radeon Pro 5300M 4 GB)

Shadertoy link WebGL result SPVM result
https://www.shadertoy.com/view/4dGBWy 4dGBWy2 4dGBWy
https://www.shadertoy.com/view/4sdBDn 4sdBDn2 4sdBDn
https://www.shadertoy.com/view/wt2fWw wt2fWw2 wt2fWw
https://www.shadertoy.com/view/lttfR8 lttfR82 lttfR8
https://www.shadertoy.com/view/NljfzV NljfzV crash
https://www.shadertoy.com/view/4lKcDD 4lKcDD2 4lKcDD
https://www.shadertoy.com/view/sldGDf sldGDf2 sldGDf
https://www.shadertoy.com/view/NslGRN NslGRN NslGRN2
https://www.shadertoy.com/view/slsXzs slsXzs2 slsXzs
https://www.shadertoy.com/view/ftlcDS ftlcDS2 ftlcDS
https://www.shadertoy.com/view/NsBBDW NsBBDW2 NsBBDW
https://www.shadertoy.com/view/ftXXW4 ftXXW4 ftXXW42
https://www.shadertoy.com/view/7ddfzr 7ddfzr2 7ddfzr
https://www.shadertoy.com/view/wdVyWD wdVyWD wdVyWD2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants