[all-commits] [llvm/llvm-project] e9c729: [OpenMP] Codegen aggregate for outlined function c...

Giorgis Georgakoudis via All-commits all-commits at lists.llvm.org
Fri Jul 16 23:28:09 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e9c7291cb25f071f1a1dfa4049ed9f5a8a217b3e
      https://github.com/llvm/llvm-project/commit/e9c7291cb25f071f1a1dfa4049ed9f5a8a217b3e
  Author: Giorgis Georgakoudis <georgakoudis1 at llnl.gov>
  Date:   2021-07-16 (Fri, 16 Jul 2021)

  Changed paths:
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
    M clang/lib/CodeGen/CGStmtOpenMP.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/test/CodeGenCXX/observe-noexcept.cpp
    M clang/test/OpenMP/cancel_codegen.cpp
    M clang/test/OpenMP/cancellation_point_codegen.cpp
    M clang/test/OpenMP/debug-info-complex-byval.cpp
    M clang/test/OpenMP/debug-info-openmp-array.cpp
    M clang/test/OpenMP/declare_target_codegen_globalization.cpp
    M clang/test/OpenMP/distribute_codegen.cpp
    M clang/test/OpenMP/distribute_firstprivate_codegen.cpp
    M clang/test/OpenMP/distribute_lastprivate_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp
    M clang/test/OpenMP/distribute_private_codegen.cpp
    M clang/test/OpenMP/distribute_simd_codegen.cpp
    M clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/distribute_simd_private_codegen.cpp
    M clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
    M clang/test/OpenMP/for_firstprivate_codegen.cpp
    M clang/test/OpenMP/for_lastprivate_codegen.cpp
    M clang/test/OpenMP/for_linear_codegen.cpp
    M clang/test/OpenMP/for_private_codegen.cpp
    M clang/test/OpenMP/for_reduction_codegen.cpp
    M clang/test/OpenMP/for_reduction_codegen_UDR.cpp
    M clang/test/OpenMP/for_reduction_task_codegen.cpp
    M clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
    M clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
    M clang/test/OpenMP/nvptx_allocate_codegen.cpp
    M clang/test/OpenMP/nvptx_data_sharing.cpp
    M clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
    M clang/test/OpenMP/nvptx_lambda_capturing.cpp
    M clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
    M clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
    M clang/test/OpenMP/nvptx_parallel_codegen.cpp
    M clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
    M clang/test/OpenMP/nvptx_target_codegen.cpp
    M clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
    M clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
    M clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
    M clang/test/OpenMP/nvptx_target_teams_codegen.cpp
    M clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
    M clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
    M clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
    M clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
    M clang/test/OpenMP/nvptx_teams_codegen.cpp
    M clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
    M clang/test/OpenMP/openmp_win_codegen.cpp
    M clang/test/OpenMP/parallel_codegen.cpp
    M clang/test/OpenMP/parallel_copyin_codegen.cpp
    M clang/test/OpenMP/parallel_firstprivate_codegen.cpp
    M clang/test/OpenMP/parallel_for_codegen.cpp
    M clang/test/OpenMP/parallel_for_lastprivate_conditional.cpp
    M clang/test/OpenMP/parallel_for_linear_codegen.cpp
    M clang/test/OpenMP/parallel_for_reduction_task_codegen.cpp
    M clang/test/OpenMP/parallel_for_simd_aligned_codegen.cpp
    M clang/test/OpenMP/parallel_if_codegen.cpp
    M clang/test/OpenMP/parallel_master_codegen.cpp
    M clang/test/OpenMP/parallel_master_reduction_task_codegen.cpp
    M clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
    M clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
    M clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
    M clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/parallel_private_codegen.cpp
    M clang/test/OpenMP/parallel_reduction_codegen.cpp
    M clang/test/OpenMP/parallel_reduction_task_codegen.cpp
    M clang/test/OpenMP/parallel_sections_codegen.cpp
    M clang/test/OpenMP/parallel_sections_reduction_task_codegen.cpp
    M clang/test/OpenMP/reduction_compound_op.cpp
    M clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
    M clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
    M clang/test/OpenMP/sections_firstprivate_codegen.cpp
    M clang/test/OpenMP/sections_lastprivate_codegen.cpp
    M clang/test/OpenMP/sections_private_codegen.cpp
    M clang/test/OpenMP/sections_reduction_codegen.cpp
    M clang/test/OpenMP/sections_reduction_task_codegen.cpp
    M clang/test/OpenMP/single_codegen.cpp
    M clang/test/OpenMP/single_firstprivate_codegen.cpp
    M clang/test/OpenMP/single_private_codegen.cpp
    M clang/test/OpenMP/target_codegen_global_capture.cpp
    M clang/test/OpenMP/target_map_codegen_03.cpp
    M clang/test/OpenMP/target_parallel_codegen.cpp
    M clang/test/OpenMP/target_parallel_debug_codegen.cpp
    M clang/test/OpenMP/target_parallel_for_codegen.cpp
    M clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
    M clang/test/OpenMP/target_parallel_for_reduction_task_codegen.cpp
    M clang/test/OpenMP/target_parallel_for_simd_codegen.cpp
    M clang/test/OpenMP/target_parallel_if_codegen.cpp
    M clang/test/OpenMP/target_parallel_num_threads_codegen.cpp
    M clang/test/OpenMP/target_parallel_reduction_task_codegen.cpp
    M clang/test/OpenMP/target_teams_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_collapse_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_dist_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_lastprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_collapse_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_order_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_proc_bind_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_task_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_proc_bind_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_reduction_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_collapse_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_dist_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_reduction_codegen.cpp
    M clang/test/OpenMP/target_teams_map_codegen.cpp
    M clang/test/OpenMP/target_teams_num_teams_codegen.cpp
    M clang/test/OpenMP/target_teams_thread_limit_codegen.cpp
    M clang/test/OpenMP/task_codegen.cpp
    M clang/test/OpenMP/task_if_codegen.cpp
    M clang/test/OpenMP/task_in_reduction_codegen.cpp
    M clang/test/OpenMP/taskgroup_codegen.cpp
    M clang/test/OpenMP/taskloop_in_reduction_codegen.cpp
    M clang/test/OpenMP/taskloop_simd_in_reduction_codegen.cpp
    M clang/test/OpenMP/teams_codegen.cpp
    M clang/test/OpenMP/teams_distribute_codegen.cpp
    M clang/test/OpenMP/teams_distribute_collapse_codegen.cpp
    M clang/test/OpenMP/teams_distribute_dist_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_lastprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_collapse_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_copyin_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_dist_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_if_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_lastprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_proc_bind_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_reduction_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_reduction_task_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_collapse_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_dist_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_if_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_proc_bind_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_reduction_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_reduction_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_collapse_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_dist_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_reduction_codegen.cpp
    M clang/test/OpenMP/teams_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_private_codegen.cpp
    M clang/test/OpenMP/tile_codegen.cpp
    M clang/test/OpenMP/unroll_codegen_parallel_for_factor.cpp
    M clang/test/OpenMP/vla_crash.c
    M clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected
    M clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected
    R openmp/libomptarget/deviceRTLs/common/generated_microtask_cases.gen
    M openmp/libomptarget/deviceRTLs/common/src/support.cu
    R openmp/libomptarget/utils/generate_microtask_cases.py

  Log Message:
  -----------
  [OpenMP] Codegen aggregate for outlined function captures

Parallel regions are outlined as functions with capture variables explicitly generated as distinct parameters in the function's argument list. That complicates the fork_call interface in the OpenMP runtime: (1) the fork_call is variadic since there is a variable number of arguments to forward to the outlined function, (2) wrapping/unwrapping arguments happens in the OpenMP runtime, which is sub-optimal, has been a source of ABI bugs, and has a hardcoded limit (16) in the number of arguments, (3)  forwarded arguments must cast to pointer types, which complicates debugging. This patch avoids those issues by aggregating captured arguments in a struct to pass to the fork_call.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D102107




More information about the All-commits mailing list