[PATCH] D68994: [RFC] Redefine `convergent` in terms of dynamic instances

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 09:53:59 PDT 2020


nhaehnle added a comment.
Herald added a reviewer: jdoerfert.

> Can you expand on the issues that are present here?

The intrinsics are fine, the formal modeling using dynamic instances isn't because it prevents desirable optimizations. For example:

  %tok1 = @llvm.convergence.anchor()
  if (divergent_condition) {
     ...
  }
  v1 = ballot(..., %tok1)
  
  %tok2 = @llvm.convergence.anchor()
  v2 = ballot(..., %tok2)

The ballot for v1 enforces reconvergence of the dynamic instances after the divergent branch, which means the ballot for v2 also executes fully converged (relative to whatever dynamic instances we had when entering this snippet).

If v1 is unused, we would like to DCE the ballot. However, after doing this there is no longer anything that guarantees reconvergence formally before the second anchor. Which means the ballot for v2 is now allowed to execute in a way that's partitioned according to the divergent condition.

>> As a matter of pragmatism, I wonder whether we shouldn't just already disable those problematic optimizations today...
> 
> Do you mean disable them for the convergent functions?

Yes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68994





More information about the llvm-commits mailing list