Page MenuHomePhabricator

[OpenMPIRBuilder] Implement static-chunked workshare-loop schedules.
Needs ReviewPublic

Authored by Meinersbur on Mon, Nov 22, 8:50 PM.

Details

Summary

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.

Diff Detail

Event Timeline

Meinersbur created this revision.Mon, Nov 22, 8:50 PM
Meinersbur requested review of this revision.Mon, Nov 22, 8:50 PM
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptMon, Nov 22, 8:50 PM
  • Simicolon after LLVM_FALLTHROUGH
  • Changes requested by @peixin
  • Remove unused code
  • Fix mlir test

@Meinersbur Please rebase on main. The function "getPreheader()" was moved into OMPIRBuilder.h.