-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WGSL: Intrinsics: atomics #5084
Comments
This task is related to functions listed in the WGSL spec document, |
Atomic operations for the global memory variables can be implemented with a workaround that aliases the memory address.
However, the variables in workgroup scope wouldn't be supported as a known limitation, because there is no way for us to translate it from Slang to WGSL due to the strict limitations on WGSL side. |
My thinking is that 1) for global memory atomics originating in Then we derive the offset into the atomic array from the index and offset into the original buffer, and write into that atomic element. This means that the And the then we have a pass that identifies all then we create an aliased buffer for that buffer. then we compute the offset from the accesschain operations. and then we modify the along the way you will need to use this should work for global memory atomics. For If we see If the question then is what if the user passes the array as argument to another function that expects an ordinary array. there isn't an easy way around other than just make a copy of the callee function and modify the array type into an atomic array there too. There is also the opposite question that is if a callee function with a groupshared array parameter is using atomics on the array, the callee should be converted into taking a atomic array parameter, and all its callsites must be modified to provide that atomic array. if the array argument at callsites can't be modified, it would be an error. This process will be recursive to handle nested calls. if the entire array is being stored into another array of ordinary ints, we need to make sure that is handled properly as well. so that's my thinking and I think this should give us decent coverage on atomics. I suggest we work on global memory atomics first, and worry about groupshared atomics later. Maybe we decide all this automatic rewrites on groupshared arrays is too messy to worth it and we given in and introduce the |
Update: after discussion with @tangent-vector , the latest decision is to introduce |
3 functions
The text was updated successfully, but these errors were encountered: