Add RWByteAddressBuffer test to check for 16bit data clobbering#1120
Open
Alexander-Johnston wants to merge 2 commits into
Open
Add RWByteAddressBuffer test to check for 16bit data clobbering#1120Alexander-Johnston wants to merge 2 commits into
Alexander-Johnston wants to merge 2 commits into
Conversation
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.
bogner
approved these changes
Apr 24, 2026
manon-traverse
approved these changes
Apr 29, 2026
…r.test Co-authored-by: Justin Bogner <mail@justinbogner.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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