This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][MLIR] Prevent constant hoisting out of target regions
ClosedPublic

Authored by skatrak on Apr 14 2023, 9:30 AM.

Details

Summary

This patch prevents constant operations defined inside omp.target from being
hoisted out and into their parent functions by canonicalization passes.

Diff Detail

Event Timeline

skatrak created this revision.Apr 14 2023, 9:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2023, 9:30 AM
skatrak requested review of this revision.Apr 14 2023, 9:30 AM

Nice find. LGTM.

This revision is now accepted and ready to land.Apr 14 2023, 9:36 AM

An alternative approach to solve this issue would be to mark the omp.target operation with the IsolatedFromAbove trait. I decided against it to allow implicit mapping of outside values to target regions, but this would be a simple change if that's a preferable approach.

An alternative approach to solve this issue would be to mark the omp.target operation with the IsolatedFromAbove trait. I decided against it to allow implicit mapping of outside values to target regions, but this would be a simple change if that's a preferable approach.

Yes, Isolated from Above would mean there are no live-ins into the region. So this looks good to me.

An alternative approach to solve this issue would be to mark the omp.target operation with the IsolatedFromAbove trait. I decided against it to allow implicit mapping of outside values to target regions, but this would be a simple change if that's a preferable approach.

Yes, Isolated from Above would mean there are no live-ins into the region. So this looks good to me.

Thank you for the quick review, Kiran. I'll wait until Monday to land this patch, in case someone else has any further suggestions.