[all-commits] [llvm/llvm-project] 8c2f4e: [OPENMP50]Codegen for reduction clauses with 'task...

Alexey Bataev via All-commits all-commits at lists.llvm.org
Fri May 1 08:46:10 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8c2f4e0e855cd41c412cb1c824960a8adf938b8f
      https://github.com/llvm/llvm-project/commit/8c2f4e0e855cd41c412cb1c824960a8adf938b8f
  Author: Alexey Bataev <a.bataev at hotmail.com>
  Date:   2020-05-01 (Fri, 01 May 2020)

  Changed paths:
    M clang/include/clang/AST/StmtOpenMP.h
    M clang/lib/AST/StmtOpenMP.cpp
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M clang/lib/CodeGen/CGOpenMPRuntime.h
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M clang/lib/Sema/SemaOpenMP.cpp
    M clang/lib/Serialization/ASTReaderStmt.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp
    A clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
    A clang/test/OpenMP/for_reduction_task_codegen.cpp
    A clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
    A clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
    A clang/test/OpenMP/parallel_reduction_task_codegen.cpp
    A clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
    A clang/test/OpenMP/sections_reduction_task_codegen.cpp
    A clang/test/OpenMP/target_parallel_for_reduction_task_codegen.cpp
    A clang/test/OpenMP/target_parallel_reduction_task_codegen.cpp
    A clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_task_codegen.cpp
    A clang/test/OpenMP/teams_distribute_parallel_for_reduction_task_codegen.cpp

  Log Message:
  -----------
  [OPENMP50]Codegen for reduction clauses with 'task' modifier.

Summary:
Added codegen for reduction clause with task modifier.
```
  #pragma omp ... reduction(task, +: a)
  {
  #pragma omp ... in_reduction(+: a)
  }
```
is translated into something like this:
```
  #pragma omp ... reduction(+:a)
  {
    struct red_input_t {
      void *reduce_shar;
      void *reduce_orig;
      size_t reduce_size;
      void *reduce_init;
      void *reduce_fini;
      void *reduce_comb;
      unsigned flags;
    } r_var;
    r_var.reduce_shar = &a;
    r_var.reduce_orig = &original a;
    r_var.reduce_size = sizeof(a);
    r_var.reduce_init = [](void* l,void*){return *(int*)l=0;};
    r_var.reduce_fini = nullptr;
    r_var.reduce_comb = [](void* l,void* r){return *(int*)l += *(int)r;};
    void *tg = __kmpc_taskred_modifier_init(<loc_addr>,<gtid>,
      <flag - 0 for parallel, 1 for worksharing>,
      <1 - number of reduction elements>,
      &r_var);
    {
    #pragma omp ... in_reduction(+: a) firstprivate(tg)
    ...
    }
    __kmpc_task_reduction_modifier_fini(<loc_addr>,<gtid>,
      <flag - 0 for parallel, 1 for worksharing>);
  }
```

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, jfb, cfe-commits, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79034




More information about the All-commits mailing list