r/GraphicsProgramming • • 29d ago

Question Compute shader running slower on better GPU?

Hi, I am learning Vulkan, and I have just finished book 1 of RTIOW recently by implementing the book in Vulkan compute shader.
How is the simplified flow of how the program works:

  1. Create the Scene data on the CPU
  2. Upload it to the GPU via an SSBO
  3. For each SPP (1 frame), dispatch the compute shader with max bounces of 50
  4. Use the result as a sample to present on the window
  5. Accumulate the result and repeat from steps 3

I tested the program on 2 of my system (both running at 1280x720)

  1. Ryzen 7 7840HS with Radeon 780M running Arch Linux
  2. Ryzen 5 5600G with RTX 3060 12GB running Windows 10

I thought the RTX 3060 will beat the 780M by a significant margin, but in reality, it's even slower (around 80ms on my 780M and around 127ms on my 3060). These are measured with Renderdoc using the on-screen stats. I'm still relatively new to graphics programming, so I'm not entirely sure if this is the correct way to measure.

I am still learning so if there is anything wrong with my code, feel free to criticize me. Also, how/where can I learn more about optimizing/debugging my code? Thanks

Here is the repo: repo

15 Upvotes

13 comments sorted by

View all comments

Show parent comment

1

u/trntndug 29d ago

Thanks for the reply, I'll definitely give the blog post a read, although I'm not sure if I will understand everything yet lol

I think I will finish the 2nd book first before diving deeper into shader optimization and profiling. Do you think that is a reasonable approach?

2

u/S48GS 29d ago

learn by doing - optimizing your shaders you will learn faster than with "book"

1

u/trntndug 29d ago

That's a fair point! I guess I'm a bit intimidated by shader optimization since my fundamentals are still very weak. I don't even know what a BVH is yet lol.

2

u/S48GS 29d ago

bvh https://www.shadertoy.com/view/Xs2czK

shaders are very simple - focus on optimizing what you have now - youl learn