nvpro-samples / vk_mini_samples

Collection of Vulkan samples
Apache License 2.0
222 stars 12 forks source link

Performance delta with SER active between GLSL / HLSL / SLANG modes #9

Open BattleAxeVR opened 7 months ago

BattleAxeVR commented 7 months ago

Hi, thanks for adding support for Vulkan SER for all the main shader languages! I got it all running and it's helping me tremendously to integrate it into my own HLSL-based engine.

I did some comparisons on my RTX 4090 and was wondering why there is still a significant performance delta between GLSL and HLSL or SLANG shader pipelines. I guess they aren't doing the exact same work, which is fine, but I'd like to see ideally a much closer difference between them, or at least understand why GLSL still appears to benefit from SER significantly more (2x) than HLSL/SLANG do. And has a higher base framerate too, which is less significant but still nearly 10%:

On an RTX 4090:

132 -> 263 FPS WITH SER ON in GLSL

121 -> 191 FPS with SER ON in HLSL

122 -> 195 FPS with SER ON in SLANG

I was careful not to move the cameras because the framerate is highly view-dependent. This is in Release build.

191 vs 263 FPS is still a big performance delta

mklefrancois commented 7 months ago

Thanks for the comments.

Regarding the difference in speed, this is a known issue, and I should be able to verify in the next week or so if this will be fixed in the next driver.

BattleAxeVR commented 7 months ago

@mklefrancois Hi, I was wondering if there was any news about driver updates to fix the performance delta.

I'm excited to get to performance parity with DX12. thanks

BattleAxeVR commented 6 months ago

I just tested the latest RTXGI 2.0 sample and Vulkan now runs as fast or even slightly faster as DX12. Was the SER issue fixed in the latest driver? I'll re-test this repo again to make sure (unless the RTXGI sample doesn't use SER for either API, I doubt it given how fast it runs).

https://twitter.com/BattleAxeVR/status/1770667238133026970

BattleAxeVR commented 6 months ago

Just re-did the tests, it's still the same as before. I wonder whether the RTXGI 2.0 sample uses SER at all, since VK + DX12 have performance parity. Not sure how that relates to GLSL vs HLSL shaders vs SER perf, but DX12 certainly uses HLSL DXR shaders.

ser_pathtrace test results using latest drivers and Vulkan SDK (as of today), Nvidia RTX 4090, CPU = 13900KS

GLSL:

SER ON: 260 FPS SER OFF: 134 FPS

HLSL:

SER ON: 189 FPS SER OFF: 121 FPS

SLANG:

SER ON: 198 FPS SER OFF: 122 FPS

BattleAxeVR commented 6 months ago

BTW HLSL doesn't compile right now.

Had to add this code to get it to compile, not sure if it's right.

image