[PATCH] D46470: [AMDGPU] Fixed a couple of SIFixWWMLiveness problems

Connor Abbott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 4 14:37:49 PDT 2018


cwabbott added inline comments.


================
Comment at: lib/Target/AMDGPU/SIFixWWMLiveness.cpp:40
+/// 1. A definition of the variable reaches the WWM instruction (and dominates
+///    it).
 /// 2. The variable would be live at the WWM instruction if all its defs were
----------------
Unfortunately, this won't work in general. Consider something like:

```
while (non_uniform_condition) {
    BEGIN_WWM;
    bar = ...;
    EXIT_WWM;
    foo = ...;
}
... = foo;
```

The definition of foo doesn't dominate the WWM instructions earlier in the loop body, but the use of foo can potentially "see" the result of many different iterations of the loop, since the loop trip count is non-uniform, and any WWM instructions will clobber everything but the last iteration. Hence we need to add an artificial interference with foo here. Of course, if you removed the use of foo outside the loop, then we wouldn't need to do anything... it's the actual use that is crucial here.

We also ran into the issue of SIFixWWMLiveness being too conservative (as well as the liveness issue) when enabling AMD_shader_ballot for radv, but I haven't been able to come up with a good solution for it. It seems that we have to treat loops, and registers live out of a loop, specially somehow.


Repository:
  rL LLVM

https://reviews.llvm.org/D46470





More information about the llvm-commits mailing list