[Mlir-commits] [mlir] [OpenMP Dialect] Add omp.canonical_loop operation. (PR #65380)

Jan Leyonberg llvmlistbot at llvm.org
Mon Sep 11 08:30:06 PDT 2023


jsjodin wrote:

> > > If an optimization makes a change that violates the invariant will the compiler assert?
> > 
> > 
> > Yes, that will be a compilation failure. @Meinersbur would it be okay if we do loop transforms within MLIR in the very beginning to avoid such optimization issues? I understand that it is not in line with the aim of using OpenMPIRBuilder for common OpenMP stuff, but it would ensure correctness.
> 
> It is not clear which transformation/optimization would cause this issue. Can this be fixed by: 
> -> Performing the transformation at the location of the canonical loop?

This seems like a reasonable approach, since the loop ops don't really execute.

> -> Adding appropriate side-effects to ensure operations do not come in between the transform operations and the canonical loop?

The problem I see with this approach is that ops that might be inserted between the loop transform ops might not have any side effects.

> 
> In general, choosing a flow other than the OpenMPIRBuilder should be the last resort. It will require a discussion outside this Pull Request involving the llvm OpenMP folks (who pushed for this flow) and the MLIR team (who agreed to this flow).

I think it can be made to work. I am just trying to think potential issues so that we have more confidence that things will work. Reducing the number of invariants is also a goal, because it is makes it more difficult to reason about the correctness of code, because of a bunch extra rules of rules that need to be kept track of.

https://github.com/llvm/llvm-project/pull/65380


More information about the Mlir-commits mailing list