[all-commits] [llvm/llvm-project] de9039: [flang][OpenMP] Lower REDUCTION clause for SECTION...

Tom Eccles via All-commits all-commits at lists.llvm.org
Fri Jul 12 02:29:43 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: de90391ea88c51da8bcde95206f3f31ecbaf97a3
      https://github.com/llvm/llvm-project/commit/de90391ea88c51da8bcde95206f3f31ecbaf97a3
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2024-07-12 (Fri, 12 Jul 2024)

  Changed paths:
    M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
    M flang/lib/Lower/OpenMP/ClauseProcessor.h
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    A flang/test/Lower/OpenMP/sections-array-reduction.f90
    A flang/test/Lower/OpenMP/sections-reduction.f90

  Log Message:
  -----------
  [flang][OpenMP] Lower REDUCTION clause for SECTIONS (#97858)

The tricky bit here is that we need to generate the reduction symbol
mapping inside each of the nested SECTION constructs. This is a bit
similar to omp.canonical_loop inside of omp.wsloop, except the SECTION
constructs come from the PFT.

To make this work I moved the lowering of the SECTION constructs inside
of the lowering SECTIONS (where reduction information is still
available). This subverts the normal control flow for OpenMP lowering a
bit.

One alternative option I investigated would be to generate the SECTION
CONSTRUCTS as normal as though there were no reduction, and then to fix
them up after control returns back to genSectionsOp. The problem here is
that the code generated for the section body has the wrong symbol
mapping for the reduction variable, so all of the nested code has to be
patched up. In my prototype version this was even more hacky than what
the solution I settled upon.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list