Modeled as operand on the operation or done by the frontend?

We are currently in the process of modeling some of the OpenACC dialect operations and some of the construct in OpenACC have an if clause.

This if condition can be modeled directly on the operation with an optional operand.

acc.enter_data create(%a : memref<10x10xf32>) if(%ifCond : i1)

Or it could be handled directly by the frontend when it creates the operation and wrap it in a scf.if

scf.if %ifCond {
  acc.enter_data create(%a : memref<10x10xf32>)
}

Are there any recommendations on which solution to choose from? Any guidelines?

I would probably try to model it as close to the source language as possible. If you wanted to convert it to the second form as part of lowering, then you could do it in the same dialect by setting the condition to constant true. I’d be interesting in seeing progress on interfaces for expressing predicated instructions like what you have be incorporated into core MLIR.