[PATCH] D151341: AMDGPU: Special case uniformity info for singlethreaded workitem IDs

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 06:48:34 PDT 2023


nhaehnle added a comment.

In D151341#4368708 <https://reviews.llvm.org/D151341#4368708>, @jhuber6 wrote:

> We should be able to remove every `convergent` attribute under this special case, right.

I'm not convinced that this is true. Consider:

  uint64_t helper() {
    return ballot(true);
  }
  
  uint64_t tricky() {
    for (int i = 0; i < 64; ++i)
      if (thread == i)
        return helper();
    unreachable();
  }

We can miscompile this as follows:

- Mark `helper` as being "single lane only"
- Remove `convergent` attributes based on that
- Inline and eliminate the loop, reducing everything down to:

  uint64_t tricky() {
    return ballot(true);
  }


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

https://reviews.llvm.org/D151341



More information about the llvm-commits mailing list