Skip to content

Add RWByteAddressBuffer test to check for 16bit data clobbering#1120

Open
Alexander-Johnston wants to merge 2 commits into
llvm:mainfrom
Alexander-Johnston:16bitClobber
Open

Add RWByteAddressBuffer test to check for 16bit data clobbering#1120
Alexander-Johnston wants to merge 2 commits into
llvm:mainfrom
Alexander-Johnston:16bitClobber

Conversation

@Alexander-Johnston
Copy link
Copy Markdown
Collaborator

The new test writes across all threads to a buffer, each to the next half of the word. While none of the writes overlap the 16bits, if implemented using a load/mask/store pattern the resulting writes can lead to race conditions between the threads and clobber data across the 32bit values underpinning the RWByteAddressBuffer.

Importantly this test reveals a bug in the RWByteAddressBuffer implementation in DXC. I suspect the solution to this in Clang (and to some other related issues) is to implement the RWByteAddressBuffer as untyped pointers if possible. See microsoft/DirectXShaderCompiler#8172

The new test writes across all threads to a buffer, each to the next half of the word.
While none of the writes overlap the 16bits, if implemented using a load/mask/store pattern
the resulting writes can lead to race conditions between the threads and clobber data
across the 32bit values underpinning the RWByteAddressBuffer.
Comment thread test/Feature/ByteAddressBuffer/ByteAddressBuffers-16bit-clobber.test Outdated
…r.test

Co-authored-by: Justin Bogner <mail@justinbogner.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants