User understanding, compiler or driver problem? #3950
Replies: 6 comments 4 replies
-
I was not able to reproduce the problem on my RTX-3090.
I saved it as a file "tests/d3950.slang", and tested it with a following command,
The result is passing,
What is your graphics driver version? |
Beta Was this translation helpful? Give feedback.
-
Thanks for taking a look. With your test, the issue doesn't happen, though it's not exactly the same: it doesn't use push constants for example. I haven't checked yet if I can easily make it the same with the test framework. I've extracted a 'minimal' repro here (not sure you're gonna like it though, it's in Rust and I never tried to run it on Windows since I don't have a physical instance...): https://gist.github.com/kevinboulain/282b6a5d24571ddd97324527254e27d7
The latest available on Linux: 550.67. The graphics card model, driver, kernel are in the readme.md of the repository linked above. |
Beta Was this translation helpful? Give feedback.
-
Does this look like a same issue as reported in 3946? |
Beta Was this translation helpful? Give feedback.
-
I don't think so. You can see the examples I've posted always use a struct for the push constants (not sure how that's mapped to SPIR-V by Slang but Vulkan GLSL requires a block). And in the repro code you can see I've also enabled the validation layers, including the GPU-assisted validation, so it would have caught an issue in the SPIR-V. |
Beta Was this translation helpful? Give feedback.
-
I've made a mess out of the test framework to pass the buffer address as a push constant: master...kevinboulain:slang:master
|
Beta Was this translation helpful? Give feedback.
-
Silly me, I forgot the driver selection depends on what function the application calls to get the devices, so Slang test framework's picks my Intel graphics card by default. So, on the Intel graphics card:
And on the Nvidia graphics card:
Same behavior as in the OP and the repro code I posted. Would like to try out the branch I've linked? |
Beta Was this translation helpful? Give feedback.
-
This question might not be strictly related to Slang but to be honest, I'm not quite sure where the problem lies so I figured I could open a discussion (if I'm not wrong, it might be of interest to Slang that something might be broken in some configurations), apologies if I'm being too spammy. I did ask a similar question on the Vulkan Discord (focused on semantics) a few days ago but haven't gotten any answer.
I have this minimal repro:
It's compiled like this (v2024.1.7):
And the resulting SPIR-V is:
It's dispatched with a single instance so a single invocation is doing the store, the atomic operation and the load (my understanding is that mixing these operations is okay in this particular context).
On Intel,
device_memory[0]
is21
. On Nvidia, it's0xffffffff
so theatomicMin
is somehow lost.As a comparison point, I tried out GLSL:
Compiled like this:
And the resulting SPIR-V is:
It produces the expected result on both Nvidia and Intel.
I spotted two differences:
The atomic operation can easily be made the same, just in case:
And the SPIR-V:
Unfortunately, same results (the Nvidia graphics cards seem to ignore the
atomicMin
).Now, I'm surprised that the device scope is used but it shouldn't harm, right? That's just requesting a larger scope than necessary, so I'm gonna change it to workgroup:
GLSL:
Same results.
In the real shader, I would need to synchronize the invocations in this way:
The corresponding Slang:
Same results...
Finally, I resort to try this out:
GLSL:
The
atomicMin
is still ignored on Nvidia for the Slang shader only.So I have a few questions now:
atomicMin
in theglsl.meta.slang
module different on purpose? Is it generally safe to sprinkle SPIR-V assembly in a Slang program, especially for sensitive operations like that (e.g.: risk of reordering)?Beta Was this translation helpful? Give feedback.
All reactions