MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.
It seems that MoltenVK executes OpAtomicSMax as its unsigned counterpart, and similarly for OpAtomicSMin. I discovered this while triaging vkd3d test failures (specifically, test_atomic_instructions()), but I also created a "minimal" (in the Vulkan sense) example which is attached (it doesn't properly do the portability subset extension dance, but hopefully that shouldn't be relevant). I current don't know any "real life" application impacted by the problem.
On MoltenVK (Apple Silicon M2 MacBook) the test program prints:
Final value: ffffffff
while I would expect (and I can see on other implementations) zero.
Hopefully the Vulkan boilerplate is obvious enough and you only need to care about the SPIR-V source and main function. The attachment has extension .txt because for some reason .cpp is not allowed.
I noticed that the generated MSL code indeed changes if I change the SPIR-V operator, but the result ends up being the same; with OpAtomicSMax I can see:
It seems that MoltenVK executes
OpAtomicSMax
as its unsigned counterpart, and similarly forOpAtomicSMin
. I discovered this while triaging vkd3d test failures (specifically,test_atomic_instructions()
), but I also created a "minimal" (in the Vulkan sense) example which is attached (it doesn't properly do the portability subset extension dance, but hopefully that shouldn't be relevant). I current don't know any "real life" application impacted by the problem.On MoltenVK (Apple Silicon M2 MacBook) the test program prints:
while I would expect (and I can see on other implementations) zero.
Hopefully the Vulkan boilerplate is obvious enough and you only need to care about the SPIR-V source and main function. The attachment has extension .txt because for some reason .cpp is not allowed.
I noticed that the generated MSL code indeed changes if I change the SPIR-V operator, but the result ends up being the same; with
OpAtomicSMax
I can see:and with
OpAtomicUMax
:I don't know enough about Metal to say whether the first result is correct.