[PATCH] D125669: Adding support for target in_reduction

Sunil Shrestha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 23 08:24:32 PDT 2022

ssquare08 added a comment.

In D125669#3604452 <https://reviews.llvm.org/D125669#3604452>, @ABataev wrote:

> In D125669#3604302 <https://reviews.llvm.org/D125669#3604302>, @RitanyaB wrote:
>> In D125669#3599134 <https://reviews.llvm.org/D125669#3599134>, @ABataev wrote:
>>> What about the description? Shall we still emit ` if(0)`?
>> Can you please elaborate for more clarity?
> The description of the patch 
> So, this
> #pragma omp target in_reduction(+:res)
>   for (int i=0; i<N; i++) {
>     res = res+i
>   }
> will become
> #pragma omp task in_reduction(+:res) if(0)
> #pragma omp target map(res)
> for (int i=0; i<N; i++) {
>   res = res+i
> }
> So, the question is is this still true?

The idea here is to wrap the target task with a host task and move in_reduction to that new host task with if(0) condition, making it an undeferred task. The approach here is basically using the framework that is in place for the host in_reduction.



More information about the cfe-commits mailing list