Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reland - [Offload] Introduce offload-tblgen and initial new API implementation (#108413) #117704

Merged
merged 23 commits into from
Nov 27, 2024

Conversation

callumfare
Copy link
Contributor

Relands changes from #108413 - this was reverted due to build issues. The problem was just that the offload-tblgen tool was behind recent changes to tablegen that ensure const records. This has been fixed and the PR is otherwise identical.


New API

Previous discussions at the LLVM/Offload meeting have brought up the need for a new API for exposing the functionality of the plugins. This change introduces a very small subset of a new API, which is primarily for testing the offload tooling and demonstrating how a new API can fit into the existing code base without being too disruptive. Exact designs for these entry points and future additions can be worked out over time.

The new API does however introduce the bare minimum functionality to implement device discovery for Unified Runtime and SYCL. This means that the urinfo and sycl-ls tools can be used on top of Offload. A (rough) implementation of a Unified Runtime adapter (aka plugin) for Offload is available here. Our intention is to maintain this and use it to implement and test Offload API changes with SYCL.

Demoing the new API

# From the runtime build directory
$ ninja LibomptUnitTests
$ OFFLOAD_TRACE=1 ./offload/unittests/OffloadAPI/offload.unittests 

Open questions and future work

  • Only some of the available device info is exposed, and not all the possible device queries needed for SYCL are implemented by the plugins. A sensible next step would be to refactor and extend the existing device info queries in the plugins. The existing info queries are all strings, but the new API introduces the ability to return any arbitrary type.
  • It may be sensible at some point for the plugins to implement the new API directly, and the higher level code on top of it could be made generic, but this is more of a long-term possibility.

@callumfare
Copy link
Contributor Author

Hi @jhuber6 - thanks for merging the original PR and apologies for the build problems. My branch was a little behind and I missed some tablegen changes. The last commit in this PR contains the fixes, and things are otherwise identical. I'd appreciate a review on this and getting it relanded, thanks!

@frasercrmck frasercrmck merged commit c979ec0 into llvm:main Nov 27, 2024
7 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 27, 2024

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building offload at step 5 "compile-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/11833

Here is the relevant piece of the build log for the reference
Step 5 (compile-openmp) failure: build (failure)
...
23.617 [6/9/1777] Building CXX object offload/src/CMakeFiles/omptarget.dir/LegacyAPI.cpp.o
23.740 [6/8/1778] Building CXX object offload/src/CMakeFiles/omptarget.dir/OpenMP/InteropAPI.cpp.o
23.874 [6/7/1779] Building CXX object offload/src/CMakeFiles/omptarget.dir/OpenMP/Mapping.cpp.o
23.971 [6/6/1780] Building CXX object offload/src/CMakeFiles/omptarget.dir/device.cpp.o
23.980 [6/5/1781] Building CXX object offload/src/CMakeFiles/omptarget.dir/OpenMP/API.cpp.o
24.009 [6/4/1782] Building CXX object offload/src/CMakeFiles/omptarget.dir/interface.cpp.o
24.342 [6/3/1783] Building CXX object offload/src/CMakeFiles/omptarget.dir/PluginManager.cpp.o
24.523 [6/2/1784] Building CXX object offload/liboffload/CMakeFiles/LLVMOffload.dir/src/OffloadImpl.cpp.o
24.688 [5/2/1785] Building CXX object offload/src/CMakeFiles/omptarget.dir/omptarget.cpp.o
24.816 [4/2/1786] Linking CXX shared library /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMOffload.so.20.0git
FAILED: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMOffload.so.20.0git 
: && /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/./bin/clang++ --target=x86_64-unknown-linux-gnu -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics   -Wl,--gc-sections -shared -Wl,-soname,libLLVMOffload.so.20.0git -o /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMOffload.so.20.0git offload/liboffload/CMakeFiles/LLVMOffload.dir/src/OffloadLib.cpp.o offload/liboffload/CMakeFiles/LLVMOffload.dir/src/OffloadImpl.cpp.o  -Wl,-rpath,"\$ORIGIN:/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/runtimes/runtimes-bins/offload/liboffload/..:"  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libomptarget.rtl.amdgpu.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libomptarget.rtl.cuda.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libomptarget.rtl.host.a  -Wl,--version-script=/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/offload/liboffload/exports  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMExtensions.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMAMDGPUCodeGen.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMPasses.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMCFGuard.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMCoroutines.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMipo.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMInstrumentation.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMLinker.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMFrontendOpenMP.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMFrontendOffloading.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMVectorize.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMSandboxIR.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMHipStdPar.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMIRPrinter.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMAsmPrinter.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMGlobalISel.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMMIRParser.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMSelectionDAG.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMCodeGen.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMScalarOpts.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMAggressiveInstCombine.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMInstCombine.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMCGData.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMBitWriter.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMObjCARCOpts.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMTarget.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMTransformUtils.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMAMDGPUAsmParser.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMAMDGPUDisassembler.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMAMDGPUDesc.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMMCDisassembler.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMAMDGPUInfo.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMAMDGPUUtils.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMAnalysis.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMProfileData.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMSymbolize.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMDebugInfoPDB.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMDebugInfoCodeView.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMDebugInfoMSF.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMDebugInfoBTF.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMDebugInfoDWARF.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMObject.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMIRReader.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMBitReader.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMAsmParser.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMTextAPI.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMCore.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMRemarks.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMBitstreamReader.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMCodeGenTypes.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMMCParser.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMMC.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMBinaryFormat.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMTargetParser.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMSupport.a  /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libLLVMDemangle.a  -lrt  -ldl  -lm  /usr/lib64/libz.so  /usr/lib64/libzstd.so  -lpthread  /usr/lib64/libffi.so && :
ld.lld: error: undefined symbol: llvm::omp::target::ompt::Initialized
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::GenericDeviceTy(llvm::omp::target::plugin::GenericPluginTy&, int, int, llvm::omp::GV const&)) in archive /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libomptarget.rtl.amdgpu.a
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::init(llvm::omp::target::plugin::GenericPluginTy&)) in archive /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libomptarget.rtl.amdgpu.a

ld.lld: error: undefined symbol: llvm::omp::target::ompt::lookupCallbackByCode
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::GenericDeviceTy(llvm::omp::target::plugin::GenericPluginTy&, int, int, llvm::omp::GV const&)) in archive /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libomptarget.rtl.amdgpu.a

ld.lld: error: undefined symbol: llvm::omp::target::ompt::lookupCallbackByName
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::init(llvm::omp::target::plugin::GenericPluginTy&)) in archive /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libomptarget.rtl.amdgpu.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
25.096 [4/1/1787] Linking CXX shared library /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/libomptarget.so.20.0git
ninja: build stopped: subcommand failed.
FAILED: runtimes/runtimes-stamps/runtimes-build 
cd /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/runtimes/runtimes-bins && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 27, 2024

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime running on omp-vega20-0 while building offload at step 5 "compile-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/30/builds/11122

Here is the relevant piece of the build log for the reference
Step 5 (compile-openmp) failure: build (failure)
...
44.699 [6/9/2222] Building CXX object offload/src/CMakeFiles/omptarget.dir/LegacyAPI.cpp.o
44.916 [6/8/2223] Building CXX object offload/src/CMakeFiles/omptarget.dir/OffloadRTL.cpp.o
44.930 [6/7/2224] Building CXX object offload/src/CMakeFiles/omptarget.dir/OpenMP/Mapping.cpp.o
45.085 [6/6/2225] Building CXX object offload/src/CMakeFiles/omptarget.dir/OpenMP/API.cpp.o
45.251 [6/5/2226] Building CXX object offload/src/CMakeFiles/omptarget.dir/device.cpp.o
45.271 [6/4/2227] Building CXX object offload/src/CMakeFiles/omptarget.dir/PluginManager.cpp.o
45.333 [6/3/2228] Building CXX object offload/src/CMakeFiles/omptarget.dir/interface.cpp.o
45.771 [6/2/2229] Building CXX object offload/liboffload/CMakeFiles/LLVMOffload.dir/src/OffloadImpl.cpp.o
46.011 [5/2/2230] Building CXX object offload/src/CMakeFiles/omptarget.dir/omptarget.cpp.o
46.135 [4/2/2231] Linking CXX shared library /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMOffload.so.20.0git
FAILED: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMOffload.so.20.0git 
: && /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/clang++ --target=x86_64-unknown-linux-gnu -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics   -Wl,--gc-sections -shared -Wl,-soname,libLLVMOffload.so.20.0git -o /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMOffload.so.20.0git offload/liboffload/CMakeFiles/LLVMOffload.dir/src/OffloadLib.cpp.o offload/liboffload/CMakeFiles/LLVMOffload.dir/src/OffloadImpl.cpp.o  -Wl,-rpath,"\$ORIGIN:/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/liboffload/..:"  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.amdgpu.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.cuda.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.host.a  -Wl,--version-script=/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/liboffload/exports  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMExtensions.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUCodeGen.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMPasses.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMCFGuard.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMCoroutines.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMipo.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMInstrumentation.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMLinker.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMFrontendOpenMP.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMFrontendOffloading.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMVectorize.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMSandboxIR.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMHipStdPar.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMIRPrinter.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMAsmPrinter.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMGlobalISel.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMMIRParser.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMSelectionDAG.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMCodeGen.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMScalarOpts.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMAggressiveInstCombine.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMInstCombine.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMCGData.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMBitWriter.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMObjCARCOpts.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMTarget.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMTransformUtils.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUAsmParser.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUDisassembler.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUDesc.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMMCDisassembler.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUInfo.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUUtils.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMAnalysis.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMProfileData.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMSymbolize.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMDebugInfoPDB.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMDebugInfoCodeView.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMDebugInfoMSF.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMDebugInfoBTF.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMDebugInfoDWARF.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMObject.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMIRReader.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMBitReader.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMAsmParser.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMTextAPI.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMCore.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMRemarks.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMBitstreamReader.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMCodeGenTypes.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMMCParser.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMMC.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMBinaryFormat.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMTargetParser.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMSupport.a  /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libLLVMDemangle.a  -lrt  -ldl  -lm  /usr/lib/x86_64-linux-gnu/libz.so  -lpthread  /usr/lib/x86_64-linux-gnu/libffi.a && :
ld.lld: error: undefined symbol: llvm::omp::target::ompt::Initialized
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::GenericDeviceTy(llvm::omp::target::plugin::GenericPluginTy&, int, int, llvm::omp::GV const&)) in archive /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.amdgpu.a
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::init(llvm::omp::target::plugin::GenericPluginTy&)) in archive /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.amdgpu.a

ld.lld: error: undefined symbol: llvm::omp::target::ompt::lookupCallbackByCode
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::GenericDeviceTy(llvm::omp::target::plugin::GenericPluginTy&, int, int, llvm::omp::GV const&)) in archive /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.amdgpu.a

ld.lld: error: undefined symbol: llvm::omp::target::ompt::lookupCallbackByName
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::init(llvm::omp::target::plugin::GenericPluginTy&)) in archive /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.amdgpu.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
46.467 [4/1/2232] Linking CXX shared library /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/lib/libomptarget.so.20.0git
ninja: build stopped: subcommand failed.
FAILED: runtimes/runtimes-stamps/runtimes-build /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-stamps/runtimes-build 
cd /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins && /usr/local/cmake/bin/cmake --build .
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 27, 2024

LLVM Buildbot has detected a new failure on builder openmp-offload-libc-amdgpu-runtime running on omp-vega20-1 while building offload at step 5 "compile-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/9229

Here is the relevant piece of the build log for the reference
Step 5 (compile-openmp) failure: build (failure)
...
45.019 [6/9/2218] Building CXX object offload/src/CMakeFiles/omptarget.dir/OpenMP/API.cpp.o
45.060 [6/8/2219] Building CXX object offload/src/CMakeFiles/omptarget.dir/device.cpp.o
45.141 [6/7/2220] Building CXX object offload/src/CMakeFiles/omptarget.dir/OffloadRTL.cpp.o
45.187 [6/6/2221] Building CXX object offload/src/CMakeFiles/omptarget.dir/interface.cpp.o
45.216 [6/5/2222] Building CXX object offload/src/CMakeFiles/omptarget.dir/PluginManager.cpp.o
45.348 [6/4/2223] Building CXX object offload/src/CMakeFiles/omptarget.dir/OpenMP/InteropAPI.cpp.o
45.611 [6/3/2224] Building CXX object offload/src/CMakeFiles/omptarget.dir/OpenMP/Mapping.cpp.o
46.027 [6/2/2225] Building CXX object offload/liboffload/CMakeFiles/LLVMOffload.dir/src/OffloadImpl.cpp.o
46.077 [5/2/2226] Building CXX object offload/src/CMakeFiles/omptarget.dir/omptarget.cpp.o
46.428 [4/2/2227] Linking CXX shared library /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMOffload.so.20.0git
FAILED: /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMOffload.so.20.0git 
: && /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/./bin/clang++ --target=x86_64-unknown-linux-gnu -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics   -Wl,--gc-sections -shared -Wl,-soname,libLLVMOffload.so.20.0git -o /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMOffload.so.20.0git offload/liboffload/CMakeFiles/LLVMOffload.dir/src/OffloadLib.cpp.o offload/liboffload/CMakeFiles/LLVMOffload.dir/src/OffloadImpl.cpp.o  -Wl,-rpath,"\$ORIGIN:/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/liboffload/..:"  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.amdgpu.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.cuda.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.host.a  -Wl,--version-script=/home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.src/offload/liboffload/exports  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMExtensions.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUCodeGen.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMPasses.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMCFGuard.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMCoroutines.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMipo.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMInstrumentation.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMLinker.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMFrontendOpenMP.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMFrontendOffloading.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMVectorize.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMSandboxIR.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMHipStdPar.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMIRPrinter.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMAsmPrinter.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMGlobalISel.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMMIRParser.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMSelectionDAG.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMCodeGen.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMScalarOpts.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMAggressiveInstCombine.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMInstCombine.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMCGData.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMBitWriter.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMObjCARCOpts.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMTarget.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMTransformUtils.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUAsmParser.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUDisassembler.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUDesc.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMMCDisassembler.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUInfo.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMAMDGPUUtils.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMAnalysis.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMProfileData.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMSymbolize.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMDebugInfoPDB.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMDebugInfoCodeView.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMDebugInfoMSF.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMDebugInfoBTF.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMDebugInfoDWARF.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMObject.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMIRReader.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMBitReader.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMAsmParser.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMTextAPI.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMCore.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMRemarks.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMBitstreamReader.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMCodeGenTypes.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMMCParser.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMMC.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMBinaryFormat.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMTargetParser.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMSupport.a  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libLLVMDemangle.a  -lrt  -ldl  -lm  /usr/lib/x86_64-linux-gnu/libz.so  /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libllvmlibc_rpc_server.a  -lpthread  /usr/lib/x86_64-linux-gnu/libffi.a && :
ld.lld: error: undefined symbol: llvm::omp::target::ompt::Initialized
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::GenericDeviceTy(llvm::omp::target::plugin::GenericPluginTy&, int, int, llvm::omp::GV const&)) in archive /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.amdgpu.a
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::init(llvm::omp::target::plugin::GenericPluginTy&)) in archive /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.amdgpu.a

ld.lld: error: undefined symbol: llvm::omp::target::ompt::lookupCallbackByCode
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::GenericDeviceTy(llvm::omp::target::plugin::GenericPluginTy&, int, int, llvm::omp::GV const&)) in archive /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.amdgpu.a

ld.lld: error: undefined symbol: llvm::omp::target::ompt::lookupCallbackByName
>>> referenced by PluginInterface.cpp
>>>               PluginInterface.cpp.o:(llvm::omp::target::plugin::GenericDeviceTy::init(llvm::omp::target::plugin::GenericPluginTy&)) in archive /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libomptarget.rtl.amdgpu.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
46.602 [4/1/2228] Linking CXX shared library /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/lib/libomptarget.so.20.0git
ninja: build stopped: subcommand failed.
131.822 [2/2/4353] Completed 'runtimes-amdgcn-amd-amdhsa'
FAILED: runtimes/runtimes-stamps/runtimes-build /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-stamps/runtimes-build 
cd /home/ompworker/bbot/openmp-offload-libc-amdgpu-runtime/llvm.build/runtimes/runtimes-bins && /usr/local/cmake/bin/cmake --build .
ninja: build stopped: subcommand failed.

frasercrmck added a commit that referenced this pull request Nov 27, 2024
…PI implementation (#108413) (#117704)"

This reverts commit c979ec0.

This showed failures in the post-merge CI.
sommerlukas pushed a commit that referenced this pull request Nov 28, 2024
…plementation (#108413. #117704) (#117894)

Relands #117704, which relanded changes from #108413 - this was reverted
due to build issues. The new offload library did not build with
`LIBOMPTARGET_OMPT_SUPPORT` enabled, which was not picked up by
pre-merge testing.

The last commit contains the fix; everything else is otherwise identical
to the approved PR.
___

### New API

Previous discussions at the LLVM/Offload meeting have brought up the
need for a new API for exposing the functionality of the plugins. This
change introduces a very small subset of a new API, which is primarily
for testing the offload tooling and demonstrating how a new API can fit
into the existing code base without being too disruptive. Exact designs
for these entry points and future additions can be worked out over time.

The new API does however introduce the bare minimum functionality to
implement device discovery for Unified Runtime and SYCL. This means that
the `urinfo` and `sycl-ls` tools can be used on top of Offload. A
(rough) implementation of a Unified Runtime adapter (aka plugin) for
Offload is available
[here](https://github.com/callumfare/unified-runtime/tree/offload_adapter).
Our intention is to maintain this and use it to implement and test
Offload API changes with SYCL.

### Demoing the new API

```sh
# From the runtime build directory
$ ninja LibomptUnitTests
$ OFFLOAD_TRACE=1 ./offload/unittests/OffloadAPI/offload.unittests 
```


### Open questions and future work
* Only some of the available device info is exposed, and not all the
possible device queries needed for SYCL are implemented by the plugins.
A sensible next step would be to refactor and extend the existing device
info queries in the plugins. The existing info queries are all strings,
but the new API introduces the ability to return any arbitrary type.
* It may be sensible at some point for the plugins to implement the new
API directly, and the higher level code on top of it could be made
generic, but this is more of a long-term possibility.
jplehr added a commit that referenced this pull request Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants