[all-commits] [llvm/llvm-project] 344370: [Flang][OpenMP] Lowering of host-evaluated clauses

Sergio Afonso via All-commits all-commits at lists.llvm.org
Wed Dec 4 06:54:38 PST 2024


  Branch: refs/heads/users/skatrak/host-eval-06-flang
  Home:   https://github.com/llvm/llvm-project
  Commit: 34437021123b32c9d38f8edc84448db1b0526574
      https://github.com/llvm/llvm-project/commit/34437021123b32c9d38f8edc84448db1b0526574
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2024-12-04 (Wed, 04 Dec 2024)

  Changed paths:
    M flang/include/flang/Common/OpenMP-utils.h
    M flang/lib/Common/OpenMP-utils.cpp
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    A flang/test/Lower/OpenMP/host-eval.f90
    A flang/test/Lower/OpenMP/target-spmd.f90
    M mlir/include/mlir/Dialect/OpenMP/OpenMPClauseOperands.h

  Log Message:
  -----------
  [Flang][OpenMP] Lowering of host-evaluated clauses

This patch adds support for lowering OpenMP clauses and expressions attached to
constructs nested inside of a target region that need to be evaluated in the
host device. This is done through the use of the `OpenMP_HostEvalClause`
`omp.target` set of operands and entry block arguments.

When lowering clauses for a target construct, a more involved
`processHostEvalClauses()` function is called, which looks at the current and
potentially other nested constructs in order to find and lower clauses that
need to be processed outside of the `omp.target` operation under construction.
This populates an instance of a global structure with the resulting MLIR
values.

The resulting list of host-evaluated values is used to initialize the
`host_eval` operands when constructing the `omp.target` operation, and then
replaced with the corresponding block arguments after creating that operation's
region.

Afterwards, while lowering nested operations, those that might potentially be
evaluated in the host (e.g. `num_teams`, `thread_limit`, `num_threads` and
`collapse`) check first whether there is an active global host-evaluated
information structure and whether it holds values referring to these clauses.
If that is the case, the stored values (referring to `omp.target` entry block
arguments at that stage) are used instead of lowering clauses again.



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