[all-commits] [llvm/llvm-project] 21ec48: [OpenMP][clang] Set num_threads 'strict' to unsupp...

Robert Imschweiler via All-commits all-commits at lists.llvm.org
Thu Sep 25 01:06:16 PDT 2025


  Branch: refs/heads/users/ro-i/omp-gpu-strict-unsupported
  Home:   https://github.com/llvm/llvm-project
  Commit: 21ec4893f994fbe86dd05060bbaaf2cf7a32f1e9
      https://github.com/llvm/llvm-project/commit/21ec4893f994fbe86dd05060bbaaf2cf7a32f1e9
  Author: Robert Imschweiler <robert.imschweiler at amd.com>
  Date:   2025-09-25 (Thu, 25 Sep 2025)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticCommonKinds.td
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M clang/lib/CodeGen/CGOpenMPRuntime.h
    M clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
    M clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    A clang/test/OpenMP/amdgcn_parallel_num_threads_strict_messages.cpp
    M clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
    R clang/test/OpenMP/distribute_parallel_for_simd_num_threads_strict_codegen.cpp
    A clang/test/OpenMP/nvptx_parallel_num_threads_strict_messages.cpp
    A clang/test/OpenMP/target_parallel_num_threads_strict_codegen.cpp
    R clang/test/OpenMP/teams_distribute_parallel_for_num_threads_strict_codegen.cpp
    R clang/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_strict_codegen.cpp
    M llvm/include/llvm/Frontend/OpenMP/OMP.td

  Log Message:
  -----------
  [OpenMP][clang] Set num_threads 'strict' to unsupported on GPUs

Setting the prescriptiveness of the num_threads clause to 'strict' and
having a corresponding check (with message and severity clauses) does
not align well with how OpenMP should be handled for GPUs.

The num_threads expression may be an arbitrary integer expression which
is evaluated on the target, in correspondance to the OpenMP spec. This
prevents the check from being done before launching the kernel,
especially considering that the num_threads clause is associated with
the parallel directive and that there may be multiple parallel
directives with different num_threads clauses in a single target region.
Acting on the result of the 'strict' check on the GPU would require
doing I/O on the GPU, which can introduce performance regressions.
Delaying any actions resulting from the 'strict' check and doing them on
the host after executing the target region involves additional data
copies and is not really semantically correct.

For now, the 'strict' modifier for the num_threads clause and its
associated message and severity clause are set to be unsupported on
GPUs. Targets other than GPUs still support the aforementioned features
in the context of an OpenMP target region.



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