This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][LibC] Adds testing LibC GPU Mode for AMDGPU
ClosedPublic

Authored by jplehr on Mar 23 2023, 7:05 AM.

Details

Summary

This adds testing LibC's GPU mode to the AMDGPU (experimental) buildbot.
The change requires the buildbot to also depend on the libc project and
pass-in a few more CMake flags.
Finally, it runs the additional check-libc target.

Diff Detail

Event Timeline

jplehr created this revision.Mar 23 2023, 7:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2023, 7:05 AM
jplehr requested review of this revision.Mar 23 2023, 7:05 AM
jdoerfert added inline comments.Mar 23 2023, 9:52 AM
buildbot/osuosl/master/config/builders.py
1888

can't we use native here (@jhuber6 ?)

jhuber6 added inline comments.Mar 23 2023, 9:53 AM
buildbot/osuosl/master/config/builders.py
1888

Actually I never implemented that for libc, I probably should go ahead and do that. But I think for the buildbot it will help to be explicit, so if the GPU dies we don't silently start passing tests. theres a LIBC_GPU_TEST_ARCHITECTURE variable for that purpose.

jplehr updated this revision to Diff 508004.Mar 24 2023, 2:07 AM

Rebase and review feedback

jhuber6 accepted this revision.Mar 24 2023, 5:41 AM
This revision is now accepted and ready to land.Mar 24 2023, 5:41 AM

When do we want to land this in the buildbot?

I wanted to do this today, my afternoon. This should give us some time to reasonably react if things don't go the way we want.

This revision was automatically updated to reflect the committed changes.
gkistanova reopened this revision.Mar 28 2023, 3:02 PM

Could you elaborate on why did you specify LLVM_ENABLE_PROJECTS explicitly, and why it does not match what's in the depends_on_projects, please? The same question is for LLVM_ENABLE_RUNTIMES and enable_runtimes respectively.

With this patch the openmp-offload-amdgpu-runtime-experimental builder would not listen for compiler_rt changes, but would build that. Meaning false blame lists every time when a compiler_rt commit breaks a build. This does not look right. What am I missing?

This revision is now accepted and ready to land.Mar 28 2023, 3:02 PM
ronlieb requested changes to this revision.Mar 28 2023, 3:52 PM

I reverted the patch as it seems to be breaking our bot

This revision now requires changes to proceed.Mar 28 2023, 3:52 PM

Could you elaborate on why did you specify LLVM_ENABLE_PROJECTS explicitly, and why it does not match what's in the depends_on_projects, please? The same question is for LLVM_ENABLE_RUNTIMES and enable_runtimes respectively.

With this patch the openmp-offload-amdgpu-runtime-experimental builder would not listen for compiler_rt changes, but would build that. Meaning false blame lists every time when a compiler_rt commit breaks a build. This does not look right. What am I missing?

Thanks for the comment and explanation. You're not missing anything, it was a mistake on my end. I'll fix it and update the patch.

jplehr updated this revision to Diff 509250.Mar 29 2023, 1:32 AM

Addressed feedback: removed extra CMake flags to enable runtimes and projects manually. Instead rely on enable_runtimes and depends_on_projects lists from the buildbot factory.
The builtbot before specified the CMake flag to enable the openmp runtime manually (despite listing it in enable_runtimes), so I removed that completely.

If this is the preferred way to do it, we should change the AMDGPU-openmp buildbot (non-experimental) and also remove the manual CMake flag there.

gkistanova requested changes to this revision.Mar 29 2023, 12:04 PM
gkistanova added inline comments.
buildbot/osuosl/master/config/builders.py
1877

Unless you need to handle a special case, you do not need to specify enable_runtimes. Just make sure you list all the dependencies in depends_on_projects (which seems you are), no matter if they are "projects" or "runtimes", and let the default machinery do the trick.

This revision now requires changes to proceed.Mar 29 2023, 12:04 PM
jhuber6 added inline comments.Mar 29 2023, 1:12 PM
buildbot/osuosl/master/config/builders.py
1877

Will the default machinery put it in the right place? The libc project can go in both as far as I'm aware.

libc will be a runtime by default.

jplehr added inline comments.Mar 29 2023, 2:02 PM
buildbot/osuosl/master/config/builders.py
1877

I added these as enable_runtimes as the OpenMPBuilder will set the enable_runtimes=['openmp'] when no argument is given.

Should we then also change the OpenMPBuilder or is this part of the default machinery you mentioned?

gkistanova added inline comments.Mar 29 2023, 6:18 PM
buildbot/osuosl/master/config/builders.py
1877

As far as I can see OpenMPBuilder does the right thing. It passes through both depends_on_projects and enable_runtimes to LLVMBuildFactory and then uses the factory properties to set cmake params. Please see https://github.com/llvm/llvm-zorg/blob/91e9b7954ae867c3294b896e44fdc7ad498840b5/zorg/buildbot/builders/OpenMPBuilder.py#L75 and below for more details.

I added these as enable_runtimes the OpenMPBuilder will set the enable_runtimes=['openmp'] when no argument is given.

I do not think it would. Where do you see that in the code?

Please let me know if this patch needs more revision after the changes I implemented, and thanks for all the help.

buildbot/osuosl/master/config/builders.py
1877

My bad, you are totally right. I must have confused the enable_projects parts in the OpenMPBuilder.
Thanks for your patience.

jplehr updated this revision to Diff 509570.Mar 30 2023, 1:18 AM

Remvoed the enable_runtimes argument

gkistanova accepted this revision.Mar 30 2023, 9:44 AM

Thanks for updating the patch, JP.

LGTM.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 30 2023, 12:11 PM
This revision was automatically updated to reflect the committed changes.

It seems that the automation does not correctly enable libc or openmp as runtimes when only given as depend_on_projects.
The CMake invocation that actually happened was

cmake -G Ninja ../llvm.src/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON '-DLLVM_LIT_ARGS=-vv --show-unsupported --show-xfail -j 32' -DCMAKE_INSTALL_PREFIX=/home/ompworker/bbot/openmp-offload-amdgpu-runtime-experimental/llvm.inst -DCMAKE_BUILD_TYPE=Release -DCLANG_DEFAULT_LINKER=lld '-DLLVM_TARGETS_TO_BUILD=X86;AMDGPU' -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DLIBOMPTARGET_FOUND_AMDGPU_GPU=ON -DLLVM_LIBC_FULL_BUILD=ON -DLIBC_GPU_BUILD=ON -DLIBC_GPU_ARCHITECTURE=gfx906 -DLIBC_GPU_TEST_ARCHITECTURE=gfx906 '-DLLVM_ENABLE_PROJECTS=llvm;libc;clang;lld;compiler-rt;openmp'

So, it only enables those as projects. This leads to a compiler error as we actually need the Clang to build the runtimes.

Is this an error in the automation machinery that we should fix, or shall we go back to enabling those as enable_runtimes?

Please keep it as is. I'll take a look later today on what might be wrong.

OpenMPBuilder didn't do enable_runtimes="auto". This is fixed in https://github.com/llvm/llvm-zorg/commit/b86d771caf03cb7fe94d0d187cad25d9519ea584.

Could you commit this patch again, please? And do not revert even if something wouldn't work as expected. Since we are all looking at this thing, it would be a bit easier with less moving parts.

I'll land it since JP is asleep.

[AMD Official Use Only - General]

Thanks Joseph