[all-commits] [llvm/llvm-project] 664a9d: [clang][OpenMP] Add no-loop SPMD kernel promotion

Nicole Aschenbrenner via All-commits all-commits at lists.llvm.org
Wed Sep 16 07:52:04 PDT 2026


  Branch: refs/heads/users/nicebert/clang-openmp-no-loop-core
  Home:   https://github.com/llvm/llvm-project
  Commit: 664a9db4bbe3d521bf31fe94bfb017852dc6e16e
      https://github.com/llvm/llvm-project/commit/664a9db4bbe3d521bf31fe94bfb017852dc6e16e
  Author: Nicole Aschenbrenner <nicole.aschenbrenner at amd.com>
  Date:   2026-09-16 (Wed, 16 Sep 2026)

  Changed paths:
    M clang/lib/CodeGen/CGOpenMPRuntime.h
    M clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
    M clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    A clang/test/OpenMP/target_no_loop.c
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    A offload/test/offloading/target-no-loop.c

  Log Message:
  -----------
  [clang][OpenMP] Add no-loop SPMD kernel promotion

A target teams distribute parallel for that is guaranteed a thread for
every iteration does not need the loop around its body. Flang already
drops it and runs the region as a no-loop kernel.

Enable the same optimization for Clang through mirroring Flang's MLIR
promotion using OpenMPIRBuilder. The kernel is tagged SPMD_NO_LOOP, so
the runtime sizes the grid to the iteration space, and the body is
emitted without a loop around it. The canonical loop it consumes is
reconstructed in the no-loop branch rather than taken from an
OMPCanonicalLoop node, so the promotion does not require
-fopenmp-enable-irbuilder.

Restrict offload entry creation to module level finalize, preventing
asserts on missing offload entries from nested CodeGenFunction
finalizing before module completion.



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