Indeed. I discussed this with a bunch of my GPU buddies, and we came to the conclusion that this code is not safe in the face of lack of forward progress guarantees. Also, shameless self-promotion, I have an extensive discussion of GPU forward progress in my recent blog:
https://raphlinus.github.io/gpu/2020/04/30/prefix-sum.html