This is an archive of the discontinued LLVM Phabricator instance.

[openacc] Add dialect definition for acc declare
ClosedPublic

Authored by razvanlupusoru on Jul 14 2023, 11:34 AM.

Details

Summary

A declare directive is used to specify the creation of a visible device
copy of a variable for the duration of the implicit data region as it
relates to the scope in which the variable is declared.

In order to support this, the following new operations were added:

  1. acc.global_ctor and acc.global_dtor. These are used whenever the

declare directive applies to a global.

  1. acc.declare_enter and acc.declare_exit. These operations are

modeled similarly to acc.enter_data and acc.exit_data. The reason
they are not modeled like acc.data is so that these operations can be
used both for globals and regions like functions.

  1. acc.declare_device_resident and acc.declare_link. These

operations are modeled in a manner consistent with previously defined
data entry operation model.

The acc.getdeviceptr was generalized so that it can be used with
acc.declare_exit.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 11:34 AM
razvanlupusoru requested review of this revision.Jul 14 2023, 11:34 AM

Remove duplicated test entry in ops.mlir

clementval added a comment.EditedJul 14 2023, 11:42 AM

Looks great! Just a couple of comments.

mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
332

Is this \ needed?

1154

Looks like we never yield smth (at least in your example). We can use the simple acc.terminator in the region.

mlir/test/Dialect/OpenACC/ops.mlir
1542–1562

Seems like it is unrelated to this patch.

1639

Can we use the simple acc.terminator instead of acc.yield since we do not return anything.

razvanlupusoru marked an inline comment as done.Jul 14 2023, 11:45 AM
razvanlupusoru added inline comments.
mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
332

Yes. I intended to insert a line-break - because the rest of description from DataEntry captures the arguments which is unrelated to this text.

1154

OK!

clementval added inline comments.Jul 14 2023, 11:46 AM
mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
332

Ok makes sense!

Use acc.terminator

razvanlupusoru marked 2 inline comments as done.Jul 14 2023, 12:43 PM
This revision is now accepted and ready to land.Jul 14 2023, 12:58 PM

Rebase + format.

vzakhari accepted this revision.Jul 17 2023, 11:01 AM

Looks great! Thank you!

Rebase after seeing some unrelated buildbot failures.

This revision was automatically updated to reflect the committed changes.