This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] [Semantics] [Flang] Adding more semantic checks for USE_DEVICE_PTR and USE_DEVICE_ADDR clauses.
ClosedPublic

Authored by raghavendhra on Jul 12 2023, 3:51 PM.

Details

Summary

The following restrictions for USE_DEVICE_PTR and USE_DEVICE_ADDR clauses on OMP TARGET DATA directive are implemented in this patch.

  • A list item may not be specified more than once in use_device_ptr clauses that appear on the directive.
  • A list item may not be specified more than once in use_device_addr clauses that appear on the directive.
  • A list item may not be specified in both a use_device_addr clause and a use_device_ptr clause on the directive.
  • A list item that appears in a use_device_ptr or use_device_addr clause must not be a structure element.
  • A list item that appears in a use_device_ptr must be of type C_PTR.

Diff Detail

Event Timeline

raghavendhra created this revision.Jul 12 2023, 3:51 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
raghavendhra requested review of this revision.Jul 12 2023, 3:52 PM

Rebasing and fixed formatting.

Fixed formatting and rebasing.

clementval added inline comments.Jul 17 2023, 1:12 PM
flang/lib/Semantics/check-omp-structure.cpp
235

Wouldn't it be nicer to have a function per directive to check for their specific semantic instead of this if (directive) pattern. checkMultipleOcurrence can be extracted as a function if you want to reuse it.

Looks mostly OK. A few minor comments.

flang/lib/Semantics/check-omp-structure.cpp
235

+1

251

This was supported prior to OpenMP 5.1. Keep in mind that there might be some old code that might need this. No change requested here.

2651–2667

You could move this check into a new function and share it with UseDevicePtr, CheckDependList function.

raghavendhra marked 3 inline comments as done.Jul 27 2023, 12:51 PM

Addressed review comments by moving CheckMultipleOccurences() from lambda to function. Rebased the patch.

kiranchandramohan accepted this revision.Aug 2 2023, 3:24 PM

LG.

Nit: Spell out types if the type is not immediately clear from the local context.

This revision is now accepted and ready to land.Aug 2 2023, 3:24 PM

Final rebase before commit.

vdonaldson added inline comments.
flang/lib/Semantics/check-omp-structure.cpp
2630

I'm seeing an error: unused variable ‘dataRef’ [-Werror=unused-variable] build error on this line.

Sorry! Let me try to fix that ASAP!

Addressed this unused variable build error by submitting a new patch https://reviews.llvm.org/D157126

Sorry for inconvenience caused. Thanks!