Page MenuHomePhabricator

[libomptarget] Add support for target update non-contiguous
Needs ReviewPublic

Authored by cchen on Jun 19 2020, 3:14 PM.

Details

Summary

This patch is the runtime support for https://reviews.llvm.org/D79972.

In order not to modify the tgt_target_data_update information but still be
able to pass the extra information for non-contiguous map item (offset,
count, and stride for each dimension), this patch overload arg when
the maptype is set as OMP_TGT_MAPTYPE_DESCRIPTOR. The origin arg is for
passing the pointer information, however, the overloaded arg is an
array of descriptor_dim:

struct descriptor_dim {
  int64_t offset;
  int64_t count;
  int64_t stride
};

and the array size is the dimension size. In addition, since we
have count and stride information in descriptor_dim, we can replace/overload the
arg_size parameter by using dimension size.

Diff Detail

Event Timeline

cchen created this revision.Jun 19 2020, 3:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2020, 3:14 PM

The test?

openmp/libomptarget/include/omptarget.h
128–130

clang part relies on unsigned types.

cchen updated this revision to Diff 272529.Jun 22 2020, 1:03 PM

Add test

ABataev added inline comments.Jun 22 2020, 1:06 PM
openmp/libomptarget/test/offloading/non_contiguous_update.c
1 ↗(On Diff #272529)

We don't have support for this in clang yet, better to add a test that uses runtime calls directly for the new features.

cchen marked an inline comment as done.Jun 22 2020, 1:23 PM
cchen added inline comments.
openmp/libomptarget/test/offloading/non_contiguous_update.c
1 ↗(On Diff #272529)

Is there any test file that I can refer to? The run line I wrote here is basically copied from other test files under libomptarget/test.

ABataev added inline comments.Jun 22 2020, 1:36 PM
openmp/libomptarget/test/offloading/non_contiguous_update.c
1 ↗(On Diff #272529)

Sure, check llvm-project/openmp/libomptarget/test/mapping/declare_mapper_api.cpp for example

cchen updated this revision to Diff 273134.Jun 24 2020, 12:59 PM

Update test

cchen updated this revision to Diff 273140.Jun 24 2020, 1:06 PM

Revert llvm pre-merge lint for existing code

cchen updated this revision to Diff 273161.Jun 24 2020, 2:26 PM

Update test so that it don't depends on compiler generated code

cchen updated this revision to Diff 273494.Jun 25 2020, 1:10 PM

Fix non_contig type

cchen added a project: Restricted Project.
cchen updated this revision to Diff 279327.Mon, Jul 20, 12:39 PM

Modify test for supporting stride in target update non-contiguous

cchen added a comment.Fri, Jul 24, 9:16 AM

Ping, compiler support is in this patch: https://reviews.llvm.org/D84192.

grokos added inline comments.Tue, Aug 4, 12:19 PM
openmp/libomptarget/include/omptarget.h
53

Maybe use a more descriptive name for the flag? Like OMP_TGT_MAPTYPE_NON_CONTIG?

openmp/libomptarget/src/omptarget.cpp
571

Maybe rename dim to current_dim - if it wasn't for the comment in the function call in line 629 I wouldn't have figured out what this argument describes.

579

alreay --> already
peice --> piece

584

return --> returns