Page MenuHomePhabricator

[MLIR][OpenMP] Added OMPIRBuilder support for use_device_ptr clause
Changes PlannedPublic

Authored by TIFitis on Mar 22 2023, 11:14 AM.

Details

Summary

This patch adds OpenMP IRBuilder support for the use_device_ptr clause for Target Data directive.

Depends on D146557

Diff Detail

Event Timeline

TIFitis created this revision.Mar 22 2023, 11:14 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
TIFitis requested review of this revision.Mar 22 2023, 11:14 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
TIFitis added inline comments.Mar 22 2023, 11:29 AM
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
4069–4070

use_dev_ptr operands must always be pointer types so I think it is safe to always just create a ptr for them.

However if we want to support typed pointers then we would have to create something like:
Builder.CreateAlloca(UseDeviceOp.first->getType()->getPointerElementType())

This is not possible as getPointerElementType is deprecated and I couldn't find any alternative for this.

4175–4185

I have commented out some code in OpenMPToLLVMIRTranslation.cpp::1489. I think that is a better way of generating code for the use_dev_ptr, but the mapValue doesn't allow remapping.

This I am stuck with letting it use the old value inside the region and replacing it later here.

llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
5017–5025

This unit test fails because of opaque pointer mismatch, The unit test runs with opaque pointers disabled however the my code only runs with it enabled.

I could not find a reasonable way to support typed pointers, I have explained this in another comment.

TIFitis updated this revision to Diff 507452.Mar 22 2023, 11:40 AM

Split use_dev_ptr test into two.

TIFitis marked an inline comment as not done.Apr 14 2023, 9:01 AM
TIFitis planned changes to this revision.Thu, May 18, 3:00 AM

Need to change this patch to account for all the clang migration changes and make use of those functions.