-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vecz] Add support for masking atomic RMW instructions
This commit allows the vectorizer to vectorize kernels in which there are atomic RMW instructions that need masked for control-flow purposes: in a divergent if/else or a loop, etc. It follows a fairly simple paradigm - similar to how we mask loads and stores - involving: * Control-flow conversion replacing the atomic with a call to an 'internal' vecz builtin * The packetizer widening this builtin, and replacing the call with another call (with packetized arguments) * The post-vectorization `DefineBuiltinsPass` running and providing function bodies for these masked atomic builtins The builtins themselves are simply loops over the entire vectorized arguments, conditionally doing an atomic operation one by one in sequence depending on the mask. This should be correct (i.e., not performing the whole atomic operation at once) since the results are undefined for how work-items run in parallel and which work-items would "win" if there was any contention in the atomic memory addresses. Note also that this is also essentially how plain atomics are vectorized: by scalarizing them. There isn't yet support for the atomic cmpxhg instructions - those will be done separately.
- Loading branch information
1 parent
65e6dfd
commit f188fe5
Showing
11 changed files
with
695 additions
and
160 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.