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

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 10:53:19 PDT 2023


arsenm added a comment.

In D151341#4380716 <https://reviews.llvm.org/D151341#4380716>, @nhaehnle wrote:

> 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:

I think this program is illegal to begin with. The constraint isn't that helper runs with a single lane, it's that it only executes a workgroup of size 1. If the loop in tricky ever went over 1 iteration, that implies execution with a larger workgroup


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

https://reviews.llvm.org/D151341



More information about the llvm-commits mailing list