[all-commits] [llvm/llvm-project] a66f77: [OpenMPIRBuilder] Implement static-chunked worksha...

Michael Kruse via All-commits all-commits at lists.llvm.org
Mon Feb 28 16:18:55 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a66f7769a3df711ff96f3832f5c71899ac671218
      https://github.com/llvm/llvm-project/commit/a66f7769a3df711ff96f3832f5c71899ac671218
  Author: Michael Kruse <llvm-project at meinersbur.de>
  Date:   2022-02-28 (Mon, 28 Feb 2022)

  Changed paths:
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M clang/test/OpenMP/cancel_codegen.cpp
    M clang/test/OpenMP/irbuilder_for_iterator.cpp
    M clang/test/OpenMP/irbuilder_for_rangefor.cpp
    M clang/test/OpenMP/irbuilder_for_unsigned.c
    A clang/test/OpenMP/irbuilder_for_unsigned_auto.c
    M clang/test/OpenMP/irbuilder_for_unsigned_down.c
    A clang/test/OpenMP/irbuilder_for_unsigned_dynamic.c
    A clang/test/OpenMP/irbuilder_for_unsigned_dynamic_chunked.c
    A clang/test/OpenMP/irbuilder_for_unsigned_runtime.c
    A clang/test/OpenMP/irbuilder_for_unsigned_static_chunked.c
    M clang/test/OpenMP/irbuilder_nested_parallel_for.c
    M clang/test/OpenMP/irbuilder_unroll_partial_factor_for.c
    M clang/test/OpenMP/irbuilder_unroll_partial_heuristic_constant_for.c
    M clang/test/OpenMP/irbuilder_unroll_partial_heuristic_for_collapse.c
    M clang/test/OpenMP/irbuilder_unroll_partial_heuristic_runtime_for.c
    M clang/test/OpenMP/irbuilder_unroll_unroll_partial_factor.c
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    M llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Target/LLVMIR/openmp-llvm.mlir

  Log Message:
  -----------
  [OpenMPIRBuilder] Implement static-chunked workshare-loop schedules.

Add applyStaticChunkedWorkshareLoop method implementing static schedule when chunk-size is specified. Unlike a static schedule without chunk-size (where chunk-size is chosen by the runtime such that each thread receives one chunk), we need two nested loops: one for looping over the iterations of a chunk, and a second for looping over all chunks assigned to the threads.

This patch includes the following related changes:
 * Adapt applyWorkshareLoop to triage between the schedule types, now possible since all schedules have been implemented. The default schedule is assumed to be non-chunked static, as without OpenMPIRBuilder.
 * Remove the chunk parameter from applyStaticWorkshareLoop, it is ignored by the runtime. Change the value for the value passed to the init function to 0, as without OpenMPIRBuilder.
 * Refactor CanonicalLoopInfo::setTripCount and CanonicalLoopInfo::mapIndVar as used by both, applyStaticWorkshareLoop and applyStaticChunkedWorkshareLoop.
 * Enable Clang to use the OpenMPIRBuilder in the presence of the schedule clause.

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




More information about the All-commits mailing list