[PATCH] D125669: Adding support for target in_reduction

Ritanya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 16 01:16:57 PDT 2022


RitanyaB created this revision.
RitanyaB added reviewers: soumitra, koops, ssquare08, cchen, dreachem.
Herald added a project: All.
RitanyaB requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, cfe-commits, sstefan1.
Herald added projects: clang, LLVM.

Implementing target in_reduction by wrapping target task with host task with in_reduction and if clause. This is in compliance with OpenMP 5.0 section: 2.19.5.6.
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
  }


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125669

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/target_in_reduction_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMP.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125669.429631.patch
Type: text/x-patch
Size: 59985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220516/fb987fcc/attachment-0001.bin>


More information about the cfe-commits mailing list