[Openmp-dev] Possibility of combining __kmpc_omp_task_with_deps and __kmpc_omp_task_begin/complete_if0

Joachim Protze via Openmp-dev openmp-dev at lists.llvm.org
Fri Aug 20 01:02:38 PDT 2021


Hi Bran,

the runtime performance for task if(0) would be way less important, if
we get better codegen for mergeable tasks. I think this code

#pragma omp task if(cond) mergeable
{BLOCK}

could translate to something like:

if(cond)
#pragma omp task
{BLOCK}
else
{BLOCK}


>From my perspective, programmers expect performance gain from just using
task if(0) that simply cannot be met. Nevertheless the runtime tries to
optimize the cost for this code path.
A combination of if(0) and mergeable could really provide the expected
performance gain, because it completely avoids the task creation cost.
Furthermore, merging the task will allow for more optimization.

Best
Joachim


Am 20.08.21 um 01:20 schrieb Bran Hagger via Openmp-dev:
> Hello,
> 
> I noticed that Giorgis Georgakoudis had done some work to simplify the
> code gen for #pragma omp parallel and #pragma omp parallel if()
> with https://reviews.llvm.org/D95976
> <https://reviews.llvm.org/D95976> so that both cases generate a call to
> __kmpc_parallel_51 and the if condition is handled in the runtime.
> 
> Like #pragma omp parallel, #pragma omp task supports an if clause and
> the runtime calls generated for #pragma omp task if(false) are very
> different than the runtime calls generated for a task without an if
> condition or in the case where the condition evaluates to true.
> 
> Are there any plans or interest in simplifying the code generation for
> #pragma omp task as well?
> 
> There are definitely reasons why keeping the code generation as it is
> right now might be preferable. There is certain optimization information
> (such as interference, for example) which can be applied only when the
> task is not deferred - that is, in the #pragma omp task if(false) case -
> but the same is true for the #pragma omp parallel if(false) case.
> 
> Best,
> Bran Hagger (he/him)
> 
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
> 



More information about the Openmp-dev mailing list