[Openmp-commits] [PATCH] D114413: [OpenMPIRBuilder] Implement static-chunked workshare-loop schedules.

Michael Kruse via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Nov 22 20:50:32 PST 2021


Meinersbur created this revision.
Meinersbur added reviewers: kiranchandramohan, ftynse, peixin, jdoerfert, clementval, Leporacanthicus, kiranktp, arnamoy10, bryanpkc, Chuanfeng, AMDChirag, anchu-rajendran, SouraVX, fghanim, jdenny, MatsPetersson.
Meinersbur added a project: OpenMP.
Herald added subscribers: sdasgup3, wenzhicui, wrengr, Chia-hungDuan, dcaballe, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, zzheng, guansong, hiraditya, yaxunl.
Meinersbur requested review of this revision.
Herald added subscribers: llvm-commits, sstefan1, stephenneuendorffer, nicolasvasilache.
Herald added projects: clang, MLIR, LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114413

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114413.389087.patch
Type: text/x-patch
Size: 122383 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211123/04421170/attachment-0001.bin>


More information about the Openmp-commits mailing list