Page MenuHomePhabricator

[OpenMP] Add RTL function for getting number of threads in block.
ClosedPublic

Authored by jhuber6 on Oct 8 2021, 5:10 PM.

Details

Summary

This patch adds support for the
__kmpc_get_hardware_num_threads_in_block function that returns the
number of threads. This was missing in the new runtime and was used by
the AMDGPU plugin which prevented it from using the new runtime. This
patchs also unified the interface for getting the thread numbers in the
frontend.

Originally authored by jdoerfert.

Diff Detail

Unit TestsFailed

TimeTest
220 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/14.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
110 msx64 debian > Clang.OpenMP::nvptx_parallel_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/14.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_parallel_codegen.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/tools/clang/test/OpenMP/Output/nvptx_parallel_codegen.cpp.tmp-ppc-host.bc
660 msx64 debian > Clang.OpenMP::nvptx_target_teams_distribute_parallel_for_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/14.0.0/include -nostdsysteminc -verify -fopenmp -fopenmp-cuda-mode -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_target_teams_distribute_parallel_for_codegen.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/tools/clang/test/OpenMP/Output/nvptx_target_teams_distribute_parallel_for_codegen.cpp.tmp-ppc-host.bc
160 msx64 debian > Clang.OpenMP::nvptx_target_teams_distribute_parallel_for_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/14.0.0/include -nostdsysteminc -verify -fopenmp -fopenmp-version=45 -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_target_teams_distribute_parallel_for_generic_mode_codegen.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/tools/clang/test/OpenMP/Output/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp.tmp-ppc-host.bc
430 msx64 debian > Clang.OpenMP::nvptx_target_teams_distribute_parallel_for_simd_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/14.0.0/include -nostdsysteminc -verify -fopenmp -fopenmp-cuda-mode -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_target_teams_distribute_parallel_for_simd_codegen.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/tools/clang/test/OpenMP/Output/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp.tmp-ppc-host.bc

Event Timeline

jhuber6 created this revision.Oct 8 2021, 5:10 PM
jhuber6 requested review of this revision.Oct 8 2021, 5:10 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 8 2021, 5:10 PM
JonChesterfield accepted this revision.Oct 8 2021, 5:16 PM
JonChesterfield added a subscriber: JonChesterfield.

Great! I like the decrease in complexity of the compiler. Pretty close to dropping the nvptx and amdgpu subclasses entirely

This revision is now accepted and ready to land.Oct 8 2021, 5:16 PM
jhuber6 updated this revision to Diff 378393.Oct 8 2021, 6:32 PM

Fixing tests.