Page MenuHomePhabricator

[OPENMP50]Initial codegen for 'affinity' clauses.

Authored by ABataev on May 19 2020, 1:48 PM.



Added initial codegen for 'affinity' clauses on task directives.
Emits next code:

kmp_task_affinity_info_t affs[<num_elems>];

void *td = __kmpc_task_alloc(..);

affs[<i>].base = &data_i;
affs[<i>].size = sizeof(data_i);
__kmpc_omp_reg_task_with_affinity(&loc, <gtid>, td, <num_elems>, affs);

The result returned by the call of __kmpc_omp_reg_task_with_affinity
function is ignored currently sincethe runtime currently ignores args
and returns 0 uncoditionally.

Diff Detail

Event Timeline

ABataev created this revision.May 19 2020, 1:48 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 19 2020, 1:48 PM

Few comments, the alloca question is my only real concern. Parts of this are trivial NFC and can go in to make the patch smaller. Parts won't be needed after D80222 landed :)


This will clash with D80222. I guess once that one is in you can just remove these parts and it will still work fine :)


Feel free to commit the code movement parts separately as an NFC commit to make the diff cleaner.


We really need to move these into OMPKinds.def as well. Not in this patch but soon.


I'm not so sure about dynamic allocas (without stack save/restore). If this happens in a loop we can run into problems fast, right?


Does it make sense to use the script to auto-generate the check lines? Makes updates way easier and cleaner. We could have the "C-code" explanation as comment above the pragma still.

ABataev marked an inline comment as done.May 29 2020, 1:22 PM
ABataev added inline comments.

There are stack saves and restores for this alloca, see the calls of @llvm.stacksave() and @llvm.stackrestore()

jdoerfert accepted this revision.May 29 2020, 1:48 PM

LGTM. Let's wait until D80222 landed :)


Just a comment, not necessarily related to this review:
@clementval @DavidTruby @fghanim @jhuber6
We want to have all "internal" struct definitions in OMPKinds.def (as we have now), but also build boilerplate code for each of them once we use TableGen. We want to build a class STRUCT_TY which offers to create a local/global struct value, inspect the members, modify the members, create the IR type for it, etc.


Right, missed them. Thx.

This revision is now accepted and ready to land.May 29 2020, 1:48 PM
This revision was automatically updated to reflect the committed changes.