[PATCH] D70781: AMDGPU: Fix handling of infinite loops in fragment shaders

Connor Abbott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 08:05:57 PST 2019


cwabbott added a comment.

In D70781#1764809 <https://reviews.llvm.org/D70781#1764809>, @critson wrote:

>   The extra export is for not great for performance as it introduces an unnecessary stall at the end of the shader.


I don't expect this specific case (an otherwise-infinite loop with a discard) to happen often enough with "real" shaders for performance to matter. After all, this went completely unnoticed until it showed up in a CTS test that was created by a fuzzer.

>   The extra export overwrites the set of active lanes set by a correct export done earlier in the shader.

I think this isn't an issue because the exec mask at the end of the program is going to be the same as the mask when the last "real" export happens. The way `kill` is implemented means that control flow never reconverges for a killed thread, so it stays dead until the very end. I've done some manual tests with the aforementioned CTS test, and it does seem to be properly discarding the right pixels too. But that's a good question :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70781/new/

https://reviews.llvm.org/D70781





More information about the llvm-commits mailing list