[all-commits] [llvm/llvm-project] 333f63: [OpenMPOpt] Make parallel regions reachable from n...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Mon Apr 27 05:11:39 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 333f636c9af90fd77bc6669a74f8bd9e2832640b
      https://github.com/llvm/llvm-project/commit/333f636c9af90fd77bc6669a74f8bd9e2832640b
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2026-04-27 (Mon, 27 Apr 2026)

  Changed paths:
    M llvm/lib/Transforms/IPO/OpenMPOpt.cpp
    A offload/test/offloading/fortran/target-generic-loops.f90
    A offload/test/offloading/fortran/target-spmd-loops.f90

  Log Message:
  -----------
  [OpenMPOpt] Make parallel regions reachable from new DeviceRTL loop functions (#150927)

This patch updates the OpenMP optimization pass to know about the new
DeviceRTL functions for loop constructs.

This change marks these functions as potentially containing parallel
regions, which fixes a current bug with the state machine rewrite
optimization. It previously failed to identify parallel regions located
inside of the callbacks passed to these new DeviceRTL functions, causing
the resulting code to skip executing these parallel regions.

As a result, Generic kernels produced by Flang that contain parallel
regions now work properly.

One known related issue not fixed by this patch is that the presence of
calls to these functions will prevent the SPMD-ization of Generic
kernels by OpenMPOpt. Previously, this was due to assuming there was no
parallel region. This is changed by this patch, but instead we now mark
it temporarily as unsupported in an SPMD context. The reason is that,
without additional changes, code intended for the main thread of the
team located outside of the parallel region would not be guarded
properly, resulting in race conditions and generally invalid behavior.



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