Open ianromanick opened 2 years ago
We discussed this in the 2022-01-19 meeting. The built in atomic functions should not be allowed on readonly or writeonly memory. We'll clarify the spec to explicitly forbid them, but being careful to not contradict the Vulkan memory model extension which has atomicRead and atomicWrite which would be allowed on readonly and writeonly respectively.
The spec is unclear whether memory decorated with
writeonly
can be passed to, for example,atomicAdd
. The atomic operations are specifically described to read then write the memory in question, so it seem reasonable that eitherwriteonly
orreadonly
should be invalid. Section 8.11 (Atomic Memory Functions) goes to some effort to say thatrestrict
,coherent
, andvolatile
are valid, but it makes no mention ofreadonly
orwriteonly
.However, we have discovered that the GIANTS Editor does this in many of its shaders, and closed-source drivers from both AMD and NVIDIA accept the shaders.
See also https://gitlab.freedesktop.org/mesa/mesa/-/issues/5842.