[PATCH] D21564: [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'

Carlo Bertolli via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 12:09:33 PDT 2016


carlo.bertolli created this revision.
carlo.bertolli added reviewers: ABataev, kkwli0.
carlo.bertolli added subscribers: cfe-commits, sfantao, arpith-jacob, caomhin.
carlo.bertolli set the repository for this revision to rL LLVM.

This patch is an initial implementation for #distribute parallel for.
The main differences that affect other pragmas are:

  # The implementation of 'distribute parallel for' requires blocking of the associated loop, where blocks are "distributed" to different teams and iterations within each block are scheduled to parallel threads within each team. To implement blocking, sema creates two additional worksharing directive fields that are used to pass the team assigned block lower and upper bounds through the outlined function resulting from 'parallel'. In this way, scheduling for 'for' to threads can use those bounds.

  # As a consequence of blocking, the stride of 'distribute' is not 1 but it is equal to the blocking size. This is returned by the runtime and sema prepares a DistIncrExpr variable to hold that value.

  # As a consequence of blocking, the global upper bound (EnsureUpperBound) expression of the 'for' is not the original loop upper bound (e.g. in for(i = 0 ; i < N; i++) this is 'N') but it is the team-assigned block upper bound. Sema creates a new expression holding the calculation of the actual upper bound for 'for' as UB = min(UB, PrevUB), where UB is the loop upper bound, and PrevUB is the team-assigned block upper bound.


Repository:
  rL LLVM

http://reviews.llvm.org/D21564

Files:
  include/clang-c/Index.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/AST/StmtOpenMP.h
  include/clang/Basic/OpenMPKinds.def
  include/clang/Basic/OpenMPKinds.h
  include/clang/Basic/StmtNodes.td
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/StmtOpenMP.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Basic/OpenMPKinds.cpp
  lib/CodeGen/CGStmt.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Parse/ParseOpenMP.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/OpenMP/distribute_parallel_for_ast_print.cpp
  test/OpenMP/distribute_parallel_for_collapse_messages.cpp
  test/OpenMP/distribute_parallel_for_copyin_messages.cpp
  test/OpenMP/distribute_parallel_for_default_messages.cpp
  test/OpenMP/distribute_parallel_for_dist_schedule_messages.cpp
  test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp
  test/OpenMP/distribute_parallel_for_if_messages.cpp
  test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp
  test/OpenMP/distribute_parallel_for_num_threads_messages.cpp
  test/OpenMP/distribute_parallel_for_private_messages.cpp
  test/OpenMP/distribute_parallel_for_proc_bind_messages.cpp
  test/OpenMP/distribute_parallel_for_reduction_messages.cpp
  test/OpenMP/distribute_parallel_for_schedule_messages.cpp
  test/OpenMP/distribute_parallel_for_shared_messages.cpp
  test/OpenMP/nesting_of_regions.cpp
  tools/libclang/CIndex.cpp
  tools/libclang/CXCursor.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21564.61416.patch
Type: text/x-patch
Size: 221586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160621/be30938f/attachment-0001.bin>


More information about the cfe-commits mailing list