This is an archive of the discontinued LLVM Phabricator instance.

[flang][openacc] Generate the declare register function
ClosedPublic

Authored by clementval on Aug 7 2023, 3:04 PM.

Details

Summary

Generate the register function for global declare
variable. This function is meant to be called after the
actual data is allocated. Patch to insert the function call
and attribute will follow.

Depends on D157338

Diff Detail

Event Timeline

clementval created this revision.Aug 7 2023, 3:04 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 7 2023, 3:04 PM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Aug 7 2023, 3:04 PM

The "register" function looks great - but it is incomplete.
The descriptor itself should be updated - possibly through using an implicit "update device" clause.

Also, attachment needs to happen - aka the device descriptor needs to point to the device data. From an IR perspective, to achieve this we need to generate the varPtrPtr. No need to do it in this change since this is not declare clause specific - but seems this functionality will need added at some point.

razvanlupusoru added inline comments.Aug 8 2023, 10:04 AM
flang/lib/Lower/OpenACC.cpp
2355

As I thought more about this today, I prefer the following naming:

The routines should be suffixed with something more descriptive like "_acc_declare_update_box_post_alloc" and "_acc_declare_update_box_post_dealloc"
The attribute can either be names "acc.declare_register"/"acc.declare_unregister" or "acc.declare_inform"/"acc.declare_renounce"

vzakhari added inline comments.
flang/lib/Lower/OpenACC.cpp
2355

I would like to suggest not using box word for names that are user visible to certain extent. desc may be more appropriate.

razvanlupusoru added inline comments.Aug 8 2023, 10:48 AM
flang/lib/Lower/OpenACC.cpp
2355

Agreed. desc also seems OK to me.

Technically these functions should not be "user-visible" but likely there is a chance these names will leak. From debugging perspective, the location should be the declare clause which will be the original function name. But I am not sure how well this information is preserved when converting to LLVM.

clementval updated this revision to Diff 548388.Aug 8 2023, 4:01 PM
  • Update function's name
  • Add implicit update device for the descriptor
clementval marked 3 inline comments as done.Aug 8 2023, 4:08 PM
razvanlupusoru accepted this revision.Aug 8 2023, 5:31 PM

Thank you!

This revision is now accepted and ready to land.Aug 8 2023, 5:31 PM
clementval updated this revision to Diff 548650.Aug 9 2023, 9:23 AM

clang-format

This revision was landed with ongoing or failed builds.Aug 9 2023, 10:25 AM
This revision was automatically updated to reflect the committed changes.