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

Sergio Afonso via All-commits all-commits at lists.llvm.org
Mon Jul 28 03:49:09 PDT 2025


  Branch: refs/heads/users/skatrak/flang-generic-06-openmp-opt
  Home:   https://github.com/llvm/llvm-project
  Commit: aac44b842037ec2d0b8e9779fbad0baa55fba290
      https://github.com/llvm/llvm-project/commit/aac44b842037ec2d0b8e9779fbad0baa55fba290
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2025-07-28 (Mon, 28 Jul 2025)

  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

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