Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add support for kmpc_parallel for for pragma target teams distribute parallel do #51

Open
wants to merge 18 commits into
base: aomp-dev
Choose a base branch
from

Conversation

DominikAdamski
Copy link
Contributor

No description provided.

DominikAdamski and others added 17 commits May 6, 2022 03:46
Done:
   Added declaration of kmpc_parallel_51
   Set constant args
   Added logic for setting up size of array which will
     contain target symbols
   Calling kmpc_parallel_51
   Moved deinit function just after kmpc_parallel_51

Not done:
   Passing symbols to target array
   Creating separate function which will reflect kernel code

Signed-off-by: Dominik Adamski <[email protected]>
kmpc_parallel_51 requires that offloaded symbols are passed
as addresses inside pointer array

Signed-off-by: Dominik Adamski <[email protected]>
Flang generates new SPMD kernels which use kmpc_parallel_51
function.

Signed-off-by: Dominik Adamski <[email protected]>
Signed-off-by: Dominik Adamski <[email protected]>
Do not assign new dtype value for device symbols via
get_type function. Use macros PASSBYVALP PASSBYREFP instead.

Remove hack for load/store of the last symbol.

Signed-off-by: Dominik Adamski <[email protected]>
Fixed passing scalars which type is different than int64.

Fixed passing allocatable arrays.

Signed-off-by: Dominik Adamski <[email protected]>
If we generate initialization function for SPMD
kernels we need to store addresses of the arguments before
we call kmpc_parallel_51 function. We use ptrtoint instruction
for scalar variables. Before this patch the LLVM IR code was generated
wrongly for complex variables:

void kernel_func(<float, float> *Arg_c)
//some code
ptrtoint i64* %Arg_c //error Arg_c was declared as pair of floats
//some code
call kmpc_parallel_51()
//some code

This patch causes that LLVM IR contains correct ptrtoint instruction:
void kernel_func(<float, float> *Arg_c)
//some code
ptrtoint <float, float>* %Arg_c //ok, Arg_c was declared as pair of floats
//some code
call kmpc_parallel_51()
//some code

Signed-off-by: Dominik Adamski <[email protected]>
Fortran objects should be passed as i64*

Signed-off-by: Dominik Adamski <[email protected]>
Signed-off-by: Dominik Adamski <[email protected]>
Clang uses kmpc_parallel_51 function for handlig target parallel for
pragma.

Flang should use the same functions as Clang for pragma
target parallel

Signed-off-by: Dominik Adamski <[email protected]>
Pragma target teams distribute parallel for calls
kmpc_parallel_51 function in different way in comparison to
pragma target parallel.

Pragma target parallel calls kmpc_parallel_51 function
just after initialization procedure.

Pragma target teams distribute parallel for calls
kmpc_parallel_51 function in the body of the outer
loop.

Signed-off-by: Dominik Adamski <[email protected]>
Pragma target teams distribute parallel do consists of
two levels of parallelism (teams and threads).

Threads from one team should be launched in parallel
via __kmpc_parallel_51 function. The code which is
executed by threads should be outlined to separate function.

Signed-off-by: Dominik Adamski <[email protected]>
@DominikAdamski DominikAdamski force-pushed the kmpc_parallel_distribute_for branch from bcdf266 to 852a46c Compare May 6, 2022 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant