Page MenuHomePhabricator

[MLIR][OpenMP] Added target data, exit data, and enter data operation definition for MLIR.
Needs ReviewPublic

Authored by abidmalikwaterloo on Jun 30 2021, 6:42 PM.

Details

Summary

This includes a basic implementation for the OpenMP target data, exit data, and enter data constructs
operation.

Diff Detail

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
clementval requested changes to this revision.Jul 20 2021, 8:42 AM
clementval added inline comments.
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
608

There is still an indent problem here.

722

Is AnyType really what we want here? Should be an enum or an integer encoding the value. As a side not, we could also have a single $map_operands argument and have a second vector to encode the map-type but that just a thought.

This revision now requires changes to proceed.Jul 20 2021, 8:42 AM
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
597

Need to wor

608

Need to check my editor

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
722
  • Based on the previous patches, I have the impression that the community prefers to make operations flexible and adaptable as things are fluid at a higher level. I would prefer enum
  • I tried to make the operation in line with the acc. data operations. Single vector to hold map_type and operand to hold all map operands should work as in the case of map_type_modifier
clementval added inline comments.Jul 21 2021, 8:30 AM
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
722
  • Based on the previous patches, I have the impression that the community prefers to make operations flexible and adaptable as things are fluid at a higher level. I would prefer enum

I think we try to be permissive where we have actual data but here is smith that we have to encode so I would make it more strict otherwise the translation will be complicated.

  • I tried to make the operation in line with the acc. data operations. Single vector to hold map_type and operand to hold all map operands should work as in the case of map_type_modifier

Sure it is just a suggestion. It is totally fine to keep it the way you have it now. OpenACC has multiple clauses to represent the different map-types so that's why it was done like that.

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
722
  • Based on the previous patches, I have the impression that the community prefers to make operations flexible and adaptable as things are fluid at a higher level. I would prefer enum

I think we try to be permissive where we have actual data but here is smith that we have to encode so I would make it more strict otherwise the translation will be complicated.

  • I tried to make the operation in line with the acc. data operations. Single vector to hold map_type and operand to hold all map operands should work as in the case of map_type_modifier

Sure it is just a suggestion. It is totally fine to keep it the way you have it now. OpenACC has multiple clauses to represent the different map-types so that's why it was done like that.

722

VectorOf<[AnyInteger]>:$map_type_modifier should be fine. Whatever the coding we adapt, it will be translated to an integer number for storing.

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
722

Does this make sence?

clementval added inline comments.Sep 9 2021, 2:45 AM
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
587

Longer than 80

589

Longer than 80

722

Yeah it should work. I would go ahead and even restrict the type of integer you use here.

abidmalikwaterloo marked 7 inline comments as done.Sep 15 2021, 10:53 AM
abidmalikwaterloo marked an inline comment as done.
abidmalikwaterloo marked 6 inline comments as done.Sep 15 2021, 10:58 AM
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
722

<IntOrIndex> should be Okay

Made changes to alignment
Made AnyType to AnyInteger for map_type_modifier

clementval added inline comments.Sep 23 2021, 6:16 AM
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
151

Extra line doesn't seem to fit the file format.

466

Extra line doesn't seem to fit the file format.

565

Extra line doesn't seem to fit the file format.

674

What's the purpose of the region on enter data?

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
674

If I am correct, it is defining the region within which the scope exit.

Remove space as mentioned by the reviewer

clementval requested changes to this revision.Sep 24 2021, 5:39 AM
clementval added inline comments.
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
674

I'm pretty sure enter data does not need an attached region. It's a standalone directive so no other operation will be nested inside its region. target exit data does not have one so these two operations are very close and it should be reflected in their MLIR design.

This revision now requires changes to proceed.Sep 24 2021, 5:39 AM
abidmalikwaterloo marked 5 inline comments as done.Oct 18 2021, 6:01 PM

made changes in the data enter operation

clementval added inline comments.Oct 19 2021, 12:08 AM
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
584

There still lines exceeding the 80 characters limit. Can you double check the whole patch so we can approve it.

abidmalikwaterloo marked an inline comment as done.Oct 22 2021, 12:00 PM

Correct indentation for comments

I have kind of lost track on this. Is this up to date and ready to go?

Will try to finalize this week.

Sorry for the delay. Will work on it

Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2022, 8:08 AM
shraiysh added a comment.EditedApr 25 2022, 7:40 PM

Looks okay to me, please wait for Kiran/Valentin's comments. Also, will you be adding assembly format/verifier for this later?

The summary says map clause is not supported but there are map operands in the patch. Can we get these two in sync - we should either update summary or remove map-related operands.

Also, please rebase before further reviews.

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
588

please put variables in documentation within backticks(`). This is because when the documentation is rendered on mlir.llvm.org, $ and _ interact to give unexpected text if backticks are not used.

Looks okay to me, please wait for Kiran/Valentin's comments. Also, will you be adding an assembly format/verifier for this later?

Yes

The summary says the map clause is not supported but there are map operands in the patch. Can we get these two in sync - we should either update the summary or remove map-related operands.

Also, please rebase before further reviews.

Will do

Looks okay to me, please wait for Kiran/Valentin's comments. Also, will you be adding an assembly format/verifier for this later?

Yes

The summary says the map clause is not supported but there are map operands in the patch. Can we get these two in sync - we should either update the summary or remove map-related operands.

Also, please rebase before further reviews.

Will do

Do you or did you work on the rest of the lowering to OpenMPIRBuilder/LLVM IR? Might be good to have the broader pictures sometime before designing the operation.

Looks okay to me, please wait for Kiran/Valentin's comments. Also, will you be adding an assembly format/verifier for this later?

Yes

The summary says the map clause is not supported but there are map operands in the patch. Can we get these two in sync - we should either update the summary or remove map-related operands.

Also, please rebase before further reviews.

Will do

Do you or did you work on the rest of the lowering to OpenMPIRBuilder/LLVM IR? Might be good to have the broader pictures sometime before designing the operation.

I put the line of action that we had in mind ( based on the OpenACC translation) in the FLANG meeting with other team members. I will work on the same line. My thinking is to work on translation and see what we need to change in the operation API at this level. But, I will clean and update the patch based on the feedback as it is hanging around too long.

abidmalikwaterloo edited the summary of this revision. (Show Details)May 3 2022, 12:08 PM

Looks okay to me, please wait for Kiran/Valentin's comments. Also, will you be adding an assembly format/verifier for this later?

Yes

The summary says the map clause is not supported but there are map operands in the patch. Can we get these two in sync - we should either update the summary or remove map-related operands.

Also, please rebase before further reviews.

Will do

I have updated the summary.

I have updated the summary.

Do we have any comments on this? I can submit the "assembly format" later. Need the operation definition for the next step : lowering to LLVM IR

Please rebase, I cannot download this patch because it is too old :(

abidmalikwaterloo edited the summary of this revision. (Show Details)

Rebase the patch and clean some formatting as needed

Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2022, 7:21 AM

Minor nits about documentation.

LGTM given that verifier and assembly format will be added soon for each of these as a separate patch soon. Please wait for atleast one more +1.

The OpenMP IRBuilder work does not have to wait for this patch to merge. You can start working on that while keeping this patch as a dependency.

clang/lib/Testing/CMakeLists.txt
6 ↗(On Diff #429235)

nit: Merge conflict. Please remove.

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
588

nit: Ping on this comment. The variable names have not been put in backticks and this is going to cause issues with autogenerated documentation.

594

Data mapping is very similar to data privatization. Would it be a good idea to push this to the frontends while we have not concretely decided on openmp dialect privatization/mapping? If you have an idea on how to implement mapping in OpenMP Dialect to LLVM IR maybe we can go ahead with this.

CC @kiranchandramohan for suggestions regarding privatization.

661

It is not clear which element in this list corresponds to which map type. It would be nice if we could either document that here, or have separate operands for each map type. (same for other two constructs too)

shraiysh requested changes to this revision.May 18 2022, 2:15 AM
This revision now requires changes to proceed.May 18 2022, 2:15 AM
clang/lib/Testing/CMakeLists.txt
33 ↗(On Diff #429235)

Are these okay? In D105584 these were not

shraiysh added inline comments.May 26 2022, 7:30 PM
clang/lib/Testing/CMakeLists.txt
33 ↗(On Diff #429235)

No, this is not okay. There is some issue with these patches and I don't know what it is, but these unrelated changes should not be seen here. Thank you for pointing this out :)

abidmalikwaterloo marked 2 inline comments as done.Mon, Jun 13, 11:51 AM
abidmalikwaterloo added inline comments.
clang/lib/Testing/CMakeLists.txt
6 ↗(On Diff #429235)

removed

33 ↗(On Diff #429235)

removed them manually

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
594

@kiranchandramohan @raghavendhra I would like to keep it like this! Any comments

661

I feel keeping it in vector makes more sense. I will document it here. As per OpenMP Specifications:
The map-type can be to, from, tofrom, or alloc.

718

will document map type here as wekk

abidmalikwaterloo marked 2 inline comments as done.Mon, Jun 13, 5:57 PM
abidmalikwaterloo added inline comments.
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
661

Correction: map_type_modifier can be "always, close, and mapper"

Revised the patcg according to the reviews of the reviewers.
clean the code and add some comments