This is an archive of the discontinued LLVM Phabricator instance.

[mlir][OpenMP] omp.parallel side effects
ClosedPublic

Authored by shraiysh on Jul 27 2022, 12:24 PM.

Details

Diff Detail

Event Timeline

shraiysh created this revision.Jul 27 2022, 12:24 PM
shraiysh requested review of this revision.Jul 27 2022, 12:24 PM
ftynse requested changes to this revision.Jul 28 2022, 1:34 AM
ftynse added inline comments.
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
55

This looks contradictory to have both recursive side effects and no side effects.

This revision now requires changes to proceed.Jul 28 2022, 1:34 AM
shraiysh added inline comments.Jul 28 2022, 1:55 AM
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
55

Hmm, the way I understood this would work is -

  • omp.parallel in itself does not add any side effects. (NoSideEffect)
  • While calculating side effects for a particular omp.parallel operation, include the side effects on the containing region. (Recursive Side effects).

That means omp.parallel only has side effects when the operations under it have side effects.

I got this understanding from one of River's replies with lambda in https://reviews.llvm.org/D74439. (Phabricator doesn't let me copy link to comment, but its on the file mlir/include/mlir/IR/OpDefinition.h)Please let me know if I have misunderstood something here.

shraiysh updated this revision to Diff 448346.Jul 28 2022, 8:28 AM

Removed NoSideEffect.

ftynse accepted this revision.Jul 29 2022, 4:46 AM
ftynse added inline comments.
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
55

I guessed how you wanted to interpret that mix of traits, but I still think it is highly confusing to denote it that way. Note that dropping the trait gives you the same behavior and all your tests still pass.

River's comment on that diff needs slight clarification. I suppose it was meant to illustrate the difference between a loop-like operation that would have RecursiveSideEffects and a lambda-like operation that itself would not.

This revision is now accepted and ready to land.Jul 29 2022, 4:46 AM
This revision was automatically updated to reflect the committed changes.