Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
Recently, I decided to measure the performance of DX12 root descriptors using this project. The first step was to port it to DX12. After doing so, I noticed a performance difference between the DX11 and DX12 versions on Nvidia GPUs. Specifically, there were significant discrepancies in:
For example, here are the timings from DX11:
And here from DX12:
As you can see, uniform access in DX12 performs similarly to linear and random access, which is quite different from DX11 behavior.
It turns out this difference occurs when shaders are compiled with DXC and Shader Model 6.x. DX12 also supports shaders compiled with FXC and Shader Model 5.1—in that case, the timings are similar to DX11:
I inspected the generated SASS code, and it seems that in the case of DX11+FXC and DX12+FXC, the driver’s compiler aggressively unrolls loops for uniform typed buffer loads, cbuffer loads and uniform texture loads. FXC and DXC preserve loops in resulting DXBC/DXIL. In case of DX12+DXC loops are preserved in the final ISAs.
The resulting ISAs from DX11+FXC and DX12+FXC aren’t exactly the same—perhaps this explains some differences in the timing of other access patterns, although they’re not as dramatic.
I tested it on 2060(driver 572.83 March 2025) and on 3060(driver 576.02 April 2025).