Page MenuHomePhabricator

[OpenMPOpt] Expand SPMDization with guarding
Needs ReviewPublic

Authored by ggeorgakoudis on Jul 24 2021, 6:19 AM.

Details

Summary

This patch expands SPMDization by guarding code regions that should be executed only by the main thread. It defines an SPMD guarded execution mode where the main thread executes guarded regions and synchronizes with worker threads using simple barriers to ensure that values are updated. Given it is possible that the same code region executes both from SPMD or SPMDized guarded execution mode, the patch creates a non-guarded version of the region and a flag to guard or not that is managed by the runtime.

TODO: tests, depends on simplification callback fixes

Diff Detail

Unit TestsFailed

TimeTest
180 msx64 debian > Clang.OpenMP::amdgcn_target_codegen.cpp
Script: -- : 'RUN: at line 3'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/llvm-project/build/lib/clang/13.0.0/include -nostdsysteminc -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc /var/lib/buildkite-agent/builds/llvm-project/clang/test/OpenMP/amdgcn_target_codegen.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/tools/clang/test/OpenMP/Output/amdgcn_target_codegen.cpp.tmp-ppc-host.bc
920 msx64 debian > Clang.OpenMP::declare_target_codegen_globalization.cpp
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/llvm-project/build/lib/clang/13.0.0/include -nostdsysteminc -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc /var/lib/buildkite-agent/builds/llvm-project/clang/test/OpenMP/declare_target_codegen_globalization.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/tools/clang/test/OpenMP/Output/declare_target_codegen_globalization.cpp.tmp-ppc-host.bc
390 msx64 debian > Clang.OpenMP::nvptx_SPMD_codegen.cpp
Script: -- : 'RUN: at line 2'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/llvm-project/build/lib/clang/13.0.0/include -nostdsysteminc -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc /var/lib/buildkite-agent/builds/llvm-project/clang/test/OpenMP/nvptx_SPMD_codegen.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/tools/clang/test/OpenMP/Output/nvptx_SPMD_codegen.cpp.tmp-ppc-host.bc
170 msx64 debian > Clang.OpenMP::nvptx_data_sharing.cpp
Script: -- : 'RUN: at line 5'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/llvm-project/build/lib/clang/13.0.0/include -nostdsysteminc -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc /var/lib/buildkite-agent/builds/llvm-project/clang/test/OpenMP/nvptx_data_sharing.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/tools/clang/test/OpenMP/Output/nvptx_data_sharing.cpp.tmp-ppc-host.bc
370 msx64 debian > Clang.OpenMP::nvptx_distribute_parallel_generic_mode_codegen.cpp
Script: -- : 'RUN: at line 3'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/clang -cc1 -internal-isystem /var/lib/buildkite-agent/builds/llvm-project/build/lib/clang/13.0.0/include -nostdsysteminc -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc /var/lib/buildkite-agent/builds/llvm-project/clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/tools/clang/test/OpenMP/Output/nvptx_distribute_parallel_generic_mode_codegen.cpp.tmp-ppc-host.bc
View Full Test Results (102 Failed)

Event Timeline

ggeorgakoudis created this revision.Jul 24 2021, 6:19 AM
ggeorgakoudis requested review of this revision.Jul 24 2021, 6:19 AM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript
ggeorgakoudis edited the summary of this revision. (Show Details)Jul 24 2021, 6:33 AM
ggeorgakoudis retitled this revision from [OpenMPOpt][WIP] Expand SPMDIzation with guarding to [OpenMPOpt][WIP] Expand SPMDization with guarding.Jul 24 2021, 6:47 AM

Update for sensible access to __kmpc_is_spmd_guarded_exec_mode

ggeorgakoudis retitled this revision from [OpenMPOpt][WIP] Expand SPMDization with guarding to [OpenMPOpt] Expand SPMDization with guarding.Jul 24 2021, 7:51 AM
ggeorgakoudis edited the summary of this revision. (Show Details)