[PATCH] D51969: [AMDGPU] Add an AMDGPU specific atomic optimizer.

Neil Henning via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 25 01:56:00 PDT 2018


sheredom added a comment.

In https://reviews.llvm.org/D51969#1244238, @mareko wrote:

> What happens if a shader already does "if (threadID == 0) { do_atomic(); }"? Is the optimization skipped in this case?


It is not skipped - the optimization would be applied twice. To be able to skip that kind of thing we need to track a further axis for a given value - we need to know if the value is divergent, uniform, or **scalar**. A scalar value would be like the one in the if statement of your example, its a value that is known to be only active for a single lane of the wavefront.

That is a much bigger change, and so we deemed it better to get this in as is - even if it will apply the optimization twice if the user had applied it, rather than not doing the optimization at all (which is a much worse performance penalty).


https://reviews.llvm.org/D51969





More information about the llvm-commits mailing list