[all-commits] [llvm/llvm-project] bd1c03: [OPENMP50]Codegen for inscan reductions in worksha...

Alexey Bataev via All-commits all-commits at lists.llvm.org
Thu Jun 4 13:36:52 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bd1c03d7b7c8bdd80b534cf2fa956c36a2f8249f
      https://github.com/llvm/llvm-project/commit/bd1c03d7b7c8bdd80b534cf2fa956c36a2f8249f
  Author: Alexey Bataev <a.bataev at hotmail.com>
  Date:   2020-06-04 (Thu, 04 Jun 2020)

  Changed paths:
    M clang/include/clang/AST/OpenMPClause.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/lib/AST/OpenMPClause.cpp
    M clang/lib/AST/StmtProfile.cpp
    M clang/lib/CodeGen/CGStmt.cpp
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/lib/Sema/SemaOpenMP.cpp
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    A clang/test/OpenMP/for_scan_codegen.cpp
    M clang/test/OpenMP/scan_messages.cpp
    M clang/tools/libclang/CIndex.cpp

  Log Message:
  -----------
  [OPENMP50]Codegen for inscan reductions in worksharing directives.

Summary:
Implemented codegen for reduction clauses with inscan modifiers in
worksharing constructs.

Emits the code for the directive with inscan reductions.
The code is the following:
```
size num_iters = <num_iters>;
<type> buffer[num_iters];
for (i: 0..<num_iters>) {
  <input phase>;
  buffer[i] = red;
}
for (int k = 0; k != ceil(log2(num_iters)); ++k)
for (size cnt = last_iter; cnt >= pow(2, k); --k)
  buffer[i] op= buffer[i-pow(2,k)];
for (0..<num_iters>) {
  red = InclusiveScan ? buffer[i] : buffer[i-1];
  <scan phase>;
}
```

Reviewers: jdoerfert

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

Tags: #clang

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




More information about the All-commits mailing list