Skip to content

Conversation

@Thyre
Copy link
Collaborator

@Thyre Thyre commented May 29, 2025

Avoid linking in a system CUDA / ROCm by mistake by forcing LLVM to use dlopen the libraries instead. This also removes the need to pass in these libraries as dependencies when building LLVM altogether, except if testing of the built libraries is wanted.

This should only really matter for systems where a system ROCm or CUDA exists.

Avoid linking in a system CUDA / ROCm by mistake by forcing LLVM
to use dlopen the libraries instead. This also removes the need
to pass in these libraries as dependencies when building LLVM
altogether, except if testing of the built libraries is wanted.

This should only really matter for systems where a system ROCm
or CUDA exists.
@Thyre Thyre changed the title LLVM: Use dlopen for libomptarget / offload LLVM: Use dlopen for AMDGPU/CUDA libomptarget / offload target libraries May 29, 2025
@Thyre
Copy link
Collaborator Author

Thyre commented May 29, 2025

Hm, a single stage test build ignored the set flag for LLVM 18.1.8. Investigating...
Haven't checked full builds due to their build times yet.

Pass arguments to top-level build instead.
@Thyre
Copy link
Collaborator Author

Thyre commented May 29, 2025

LLVM 18 requires top-level CMake options, LLVM 19+ need their options as runtime arguments. Tests with both CUDA & AMDGPU enabled at the same time looked good.

Tests can be done by building LLVM EasyConfigs with e.g. CUDA as a direct dependency, and then checking the logs for:

Building CUDA plugin for dlopened libcuda
[...]
Building AMDGPU plugin for dlopened libhsa

Example EasyConfig:

Click to open
name = 'LLVM'
version = '20.1.5'


homepage = "https://llvm.org/"
description = """The LLVM Core libraries provide a modern source- and target-independent
 optimizer, along with code generation support for many popular CPUs
 (as well as some less common ones!) These libraries are built around a well
 specified code representation known as the LLVM intermediate representation
 ("LLVM IR"). The LLVM Core libraries are well documented, and it is
 particularly easy to invent your own language (or port an existing compiler)
 to use LLVM as an optimizer and code generator."""

toolchain = {'name': 'GCCcore', 'version': '13.3.0'}
toolchainopts = {
    # 'cstd': 'gnu++11',
    'pic': True
}

source_urls = ['https://github.com/llvm/llvm-project/releases/download/llvmorg-%(version)s/']
sources = [
    'llvm-project-%(version)s.src.tar.xz',
]
patches = [
    'LLVM-18.1.8_envintest.patch',
    'LLVM-19.1.7_libomptarget_tests.patch',
    'LLVM-19.1.7_clang_rpathwrap_test.patch',
]
checksums = [
    {'llvm-project-20.1.5.src.tar.xz': 'a069565cd1c6aee48ee0f36de300635b5781f355d7b3c96a28062d50d575fa3e'},
    {'LLVM-18.1.8_envintest.patch': '8e25dfab8a29a860717b4bd2d8cdd0e795433766d7fffbda32d06a2bde47058d'},
    {'LLVM-19.1.7_libomptarget_tests.patch': '79a67c118d034cfb74e255696369150c73432d2b422f4834efacb26f7904edbf'},
    {'LLVM-19.1.7_clang_rpathwrap_test.patch': '5ee6a87ec8ff1c8b736ffe0513aa2098bd2b83a1ffc647a1ad2cf966f567e8a1'},
]

local_gcc_version = '13.3.0'
local_gcc_compiler = ('GCCcore', local_gcc_version)

builddependencies = [
    ('binutils', '2.42'),
    ('Python', '3.12.3'),
    ('CMake', '3.29.3'),
    ('psutil', '6.0.0'),  # Needed to enable test timeout in lit
    ('lit', '18.1.8'),
    ('git', '2.45.1'),
]

dependencies = [
    ('libxml2', '2.12.7'),
    ('ncurses', '6.5'),
    ('zlib', '1.3.1'),
    ('Z3', '4.13.0'),
    ('CUDA', '12.6.0', '', SYSTEM),
]

build_shared_libs = True

bootstrap = False
full_llvm = False
build_clang_extras = False
build_runtimes = True
build_lld = True
build_lldb = False
build_bolt = True
build_openmp = True
build_openmp_tools = True
build_openmp_offload = True
usepolly = True

python_bindings = False

build_targets = ['all']
# disable_werror = True

skip_all_tests = False
skip_sanitizer_tests = True
test_suite_max_failed = 10
test_suite_timeout_single = 5 * 60
test_suite_ignore_patterns = [
    "X86/register-fragments-bolt-symbols.s",
    "modularize/ProblemsCoverage.modularize",
    "Driver/atomic.f90",
    "Driver/gcc-toolchain-install-dir.f90",
    "api_tests/test_ompd_get_icv_from_scope.c",
]

# LLVM will produce .mod files for its flang installation at the 3rd stage of the build via Clang+Flang
# These should not be checked for sanity, as we want to build LLVM on top of GCCcore to be used as a new toolchain
skip_mod_files_sanity_check = True

amd_gfx_list = ['gfx1201']

moduleclass = 'compiler'

@Thyre
Copy link
Collaborator Author

Thyre commented Jun 4, 2025

Test report by @Thyre

Overview of tested easyconfigs (in order)

  • SUCCESS LLVM-20.1.5-GCCcore-13.3.0-amdgpu.eb

Build succeeded for 1 out of 1 (1 easyconfigs in total)
zam226 - Linux Ubuntu 22.04, x86_64, 12th Gen Intel(R) Core(TM) i7-12700, 1 x AMD N/A (device id: 0x747e, gfx: gfx1101, driver: 6.10.5), Python 3.10.12
See https://gist.github.com/Thyre/2703499cb3411ea4d1a9b1257a650631 for a full test report.


Test with explicit CUDA dependency and an external ROCm module loaded. No NVIDIA drivers present:

~/.local/easybuild/software/LLVM/20.1.5-GCCcore-13.3.0/easybuild » cat easybuild-LLVM-20.1.5-20250604.112230.log| grep dlopen
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
Failed to 'dlopen' libcuda.so.1
-- Building CUDA plugin for dlopened libcuda
-- Building AMDGPU plugin for dlopened libhsa
Failed to 'dlopen' libcuda.so.1
-- Building CUDA plugin for dlopened libcuda
-- Building AMDGPU plugin for dlopened libhsa
UNSUPPORTED: ORC-x86_64-linux :: TestCases/Darwin/x86-64/jit-re-dlopen-data-reset.S (84218 of 101198)
UNSUPPORTED: ORC-x86_64-linux :: TestCases/Darwin/x86-64/jit-re-dlopen-trivial.S (84219 of 101198)
UNSUPPORTED: ORC-x86_64-linux :: TestCases/Darwin/x86-64/trivial-jit-dlopen-nested.c (84228 of 101198)
UNSUPPORTED: ORC-x86_64-linux :: TestCases/Darwin/x86-64/trivial-jit-dlopen.c (84229 of 101198)
UNSUPPORTED: ORC-x86_64-linux :: TestCases/Windows/x86-64/trivial-jit-dlopen.c (84288 of 101198)
UNSUPPORTED: Profile-x86_64 :: AIX/gcov-dlopen-dlclose.test (85411 of 101198)
PASS: Profile-x86_64 :: Linux/instrprof-dlopen.test (85476 of 101198)
PASS: Profile-x86_64 :: Posix/gcov-dlopen.c (85478 of 101198)
PASS: Profile-x86_64 :: Posix/instrprof-dlopen-norpath.test (85485 of 101198)
PASS: Profile-x86_64 :: Posix/instrprof-dlopen.test (85487 of 101198)
PASS: XRay-x86_64-linux :: TestCases/Posix/dlopen.cpp (85582 of 101198)
Failed to 'dlopen' libcuda.so.1
-- Building CUDA plugin for dlopened libcuda
-- Building AMDGPU plugin for dlopened libhsa

Thyre and others added 2 commits June 4, 2025 16:16
@boegel boegel added this to the next release (5.1.1?) milestone Jun 18, 2025
Signed-off-by: Jan André Reuter <[email protected]>
@Crivella
Copy link
Contributor

@boegelbot please test @ jsc-zen3-a100
EB_ARGS="--installpath /tmp/$USER/ebpr-3747 LLVM-20.1.5-GCCcore-13.3.0.eb"
CORE_CNT=16

@boegelbot
Copy link

@Crivella: Request for testing this PR well received on jsczen3l1.int.jsc-zen3.fz-juelich.de

PR test command 'if [[ develop != 'develop' ]]; then EB_BRANCH=develop ./easybuild_develop.sh 2> /dev/null 1>&2; EB_PREFIX=/home/boegelbot/easybuild/develop source init_env_easybuild_develop.sh; fi; EB_PR=3747 EB_ARGS="--installpath /tmp/$USER/ebpr-3747 LLVM-20.1.5-GCCcore-13.3.0.eb" EB_REPO=easybuild-easyblocks EB_BRANCH=develop /opt/software/slurm/bin/sbatch --job-name test_PR_3747 --ntasks="16" ~/boegelbot/eb_from_pr_upload_jsc-zen3.sh' executed!

  • exit code: 0
  • output:
Submitted batch job 7039

Test results coming soon (I hope)...

- notification for comment with ID 3018220653 processed

Message to humans: this is just bookkeeping information for me,
it is of no use to you (unless you think I have a bug, which I don't).

@boegelbot
Copy link

Test report by @boegelbot

Overview of tested easyconfigs (in order)

  • SUCCESS LLVM-20.1.5-GCCcore-13.3.0.eb

Build succeeded for 1 out of 1 (1 easyconfigs in total)
jsczen3c1.int.jsc-zen3.fz-juelich.de - Linux Rocky Linux 9.5, x86_64, AMD EPYC-Milan Processor (zen3), Python 3.9.21
See https://gist.github.com/boegelbot/f89e3a30a415d9ec237ea338d92daf2a for a full test report.

@Crivella
Copy link
Contributor

Manual test report 19.1.7 (SUCCESS)

On a RHEL9 VM with only lmod + EESSI + EESSI-extend

https://gist.github.com/Crivella/9bcde470ab894eb22b949ec704e12cef

@Crivella
Copy link
Contributor

Manual test report 20.1.5 (SUCCESS)

On a RHEL9 VM with only lmod + EESSI + EESSI-extend

https://gist.github.com/Crivella/9de28d2469310125324935940bc1770c

Copy link
Contributor

@Crivella Crivella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Crivella
Copy link
Contributor

Going in, thanks @Thyre!

@Crivella Crivella merged commit c3f4f89 into easybuilders:develop Jun 30, 2025
17 checks passed
@Flamefire
Copy link
Contributor

Test report by @Flamefire

Overview of tested easyconfigs (in order)

Build succeeded for 0 out of 3 (3 easyconfigs in total)
n1368 - Linux RHEL 8.9 (Ootpa), x86_64, Intel(R) Xeon(R) Platinum 8470 (sapphirerapids), Python 3.9.18
See https://gist.github.com/Flamefire/b2cb939d725d0c052924c73090dc3593 for a full test report.

@Flamefire
Copy link
Contributor

Test report by @Flamefire

Overview of tested easyconfigs (in order)

Build succeeded for 1 out of 3 (3 easyconfigs in total)
c71 - Linux AlmaLinux 9.4, x86_64, AMD EPYC 9334 32-Core Processor (zen4), 4 x NVIDIA NVIDIA H100, 560.35.03, Python 3.9.18
See https://gist.github.com/Flamefire/f65d41a5b394d7da97d7594a7dea7e57 for a full test report.

@Flamefire
Copy link
Contributor

Test report by @Flamefire

Overview of tested easyconfigs (in order)

  • FAIL (build issue) LLVM-19.1.7-GCCcore-13.3.0.eb
  • SUCCESS LLVM-20.1.5-GCCcore-13.3.0.eb
  • SUCCESS LLVM-18.1.8-GCCcore-13.3.0.eb

Build succeeded for 2 out of 3 (3 easyconfigs in total)
i7033 - Linux Rocky Linux 8.9 (Green Obsidian), x86_64, AMD EPYC 7702 64-Core Processor (zen2), Python 3.9.18
See https://gist.github.com/Flamefire/6e30238dabd26a86374c6ab299afba75 for a full test report.

@Flamefire
Copy link
Contributor

Test report by @Flamefire

Overview of tested easyconfigs (in order)

Build succeeded for 2 out of 3 (3 easyconfigs in total)
n1016 - Linux RHEL 8.9 (Ootpa), x86_64, Intel(R) Xeon(R) Platinum 8470 (sapphirerapids), Python 3.9.18
See https://gist.github.com/Flamefire/22d33367c112b7fe8442b97c13b667e8 for a full test report.

@Flamefire
Copy link
Contributor

Test report by @Flamefire

Overview of tested easyconfigs (in order)

Build succeeded for 2 out of 3 (3 easyconfigs in total)
c17 - Linux AlmaLinux 9.4, x86_64, AMD EPYC 9334 32-Core Processor (zen4), 4 x NVIDIA NVIDIA H100, 560.35.03, Python 3.9.18
See https://gist.github.com/Flamefire/12fa64857d5f5d4fd14481a93b199578 for a full test report.

@Crivella
Copy link
Contributor

Crivella commented Jul 2, 2025

Al these tests do not have the fix for #3758 right?

@Flamefire
Copy link
Contributor

True, forgot about that, that might be a reason. But I see LLVM-18.1.8-GCCcore-13.3.0.eb failing throughout all PRs even the fixed one. That's why I ran the test for this.
I'll do a test report on all 3 clusters just with that single EC again

@Thyre
Copy link
Collaborator Author

Thyre commented Jul 2, 2025

True, forgot about that, that might be a reason. But I see LLVM-18.1.8-GCCcore-13.3.0.eb failing throughout all PRs even the fixed one. That's why I ran the test for this. I'll do a test report on all 3 clusters just with that single EC again

nvptx failures should be ignored if ptxas is not in $PATH. We might want to bump this so that tests are only evaluated if we actually have an EasyBuild dependency on CUDA. If ptxas is not in PATH, then we probably have a bug somewhere.

See also

pxtas_path = which('ptxas', on_error=IGNORE)
if self.nvptx_target_cond and not pxtas_path:
self.ignore_patterns += ['nvptx64-nvidia-cuda', 'nvptx64-nvidia-cuda-LTO']
self.log.warning("PTXAS not found in PATH, ignoring failing tests for NVPTX target")

How do the test failures look like?

@Flamefire
Copy link
Contributor

I see a lot nvptx64 failures and the following errors in various tests:

FAIL: BOLT :: runtime/instrument-wrong-target.s (1768 of 102801)
******************** TEST 'BOLT :: runtime/instrument-wrong-target.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 6: /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/bin/llvm-mc -triple aarch64 -filetype=obj /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/bolt/test/runtime/instrument-wrong-target.s -o /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/tools/bolt/test/runtime/Output/instrument-wrong-target.s.tmp.o
+ /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/bin/llvm-mc -triple aarch64 -filetype=obj /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/bolt/test/runtime/instrument-wrong-target.s -o /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/tools/bolt/test/runtime/Output/instrument-wrong-target.s.tmp.o
/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/bin/llvm-mc: error: unable to get target for 'aarch64', see --version and --triple.
--

********************
FAIL: MLIR :: mlir-pdll-lsp-server/compilation_database.test (80212 of 102801)
******************** TEST 'MLIR :: mlir-pdll-lsp-server/compilation_database.test' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 1
echo -e '--- !FileInfo:\n  filepath: "/foo.pdll"\n  includes: "/build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/mlir/test/mlir-pdll-lsp-server;/build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/mlir/test/mlir-pdll-lsp-server/../../include"' > /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/tools/mlir/test/mlir-pdll-lsp-server/Output/compilation_database.test.tmp.yml
# executed command: echo -e '--- !FileInfo:\n  filepath: "/foo.pdll"\n  includes: "/build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/mlir/test/mlir-pdll-lsp-server;/build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/mlir/test/mlir-pdll-lsp-server/../../include"'
# note: command had no output on stdout or stderr
# RUN: at line 2
mlir-pdll-lsp-server -pdll-compilation-database=/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/tools/mlir/test/mlir-pdll-lsp-server/Output/compilation_database.test.tmp.yml -lit-test < /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/mlir/test/mlir-pdll-lsp-server/compilation_database.test | /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/bin/FileCheck /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/mlir/test/mlir-pdll-lsp-server/compilation_database.test
# executed command: mlir-pdll-lsp-server -pdll-compilation-database=/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/tools/mlir/test/mlir-pdll-lsp-server/Output/compilation_database.test.tmp.yml -lit-test
# .---command stderr------------
# | : CommandLine Error: Option 'debug-counter' registered more than once!
# | LLVM ERROR: inconsistency in registered CommandLine options
# `-----------------------------
# error: command failed with exit status: -6
# executed command: /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/bin/FileCheck /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/mlir/test/mlir-pdll-lsp-server/compilation_database.test
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/bin/FileCheck /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/mlir/test/mlir-pdll-lsp-server/compilation_database.test
# `-----------------------------
# error: command failed with exit status: 2

--

FAIL: MemorySanitizer-lld-X86_64 :: preinit_array.cpp (81337 of 102801)
******************** TEST 'MemorySanitizer-lld-X86_64 :: preinit_array.cpp' FAILED ********************
Exit Code: 139

Command Output (stderr):
--
RUN: at line 1: /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./bin/clang  --driver-mode=g++ -fsanitize=memory -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls  -m64 -fuse-ld=lld  -gline-tables-only -O0 /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/compiler-rt/test/msan/preinit_array.cpp -o /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/runtimes/runtimes-bins/compiler-rt/test/msan/lld-X86_64/Output/preinit_array.cpp.tmp &&  /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/runtimes/runtimes-bins/compiler-rt/test/msan/lld-X86_64/Output/preinit_array.cpp.tmp
+ /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./bin/clang --driver-mode=g++ -fsanitize=memory -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -fuse-ld=lld -gline-tables-only -O0 /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/compiler-rt/test/msan/preinit_array.cpp -o /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/runtimes/runtimes-bins/compiler-rt/test/msan/lld-X86_64/Output/preinit_array.cpp.tmp
+ /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/runtimes/runtimes-bins/compiler-rt/test/msan/lld-X86_64/Output/preinit_array.cpp.tmp
/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/runtimes/runtimes-bins/compiler-rt/test/msan/lld-X86_64/Output/preinit_array.cpp.script: line 1: 2041792 Segmentation fault      /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/runtimes/runtimes-bins/compiler-rt/test/msan/lld-X86_64/Output/preinit_array.cpp.tmp

--

********************
FAIL: libomptarget :: nvptx64-nvidia-cuda :: api/omp_get_mapped_ptr.c (86880 of 102801)
******************** TEST 'libomptarget :: nvptx64-nvidia-cuda :: api/omp_get_mapped_ptr.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./bin/clang -fopenmp    -I /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/openmp/libomptarget/test -I /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/runtime/src -L /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/libomptarget -L /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./lib -L /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./lib  -Wl,-rpath,/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/libomptarget -Wl,-rpath,/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./lib -Wl,-rpath,/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./lib  --libomptarget-nvptx-bc-path=/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/libomptarget/DeviceRTL -fopenmp-targets=nvptx64-nvidia-cuda /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/openmp/libomptarget/test/api/omp_get_mapped_ptr.c -o /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/libomptarget/test/nvptx64-nvidia-cuda/api/Output/omp_get_mapped_ptr.c.tmp /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./lib/libomptarget.devicertl.a && /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/libomptarget/test/nvptx64-nvidia-cuda/api/Output/omp_get_mapped_ptr.c.tmp
# executed command: /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./bin/clang -fopenmp -I /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/openmp/libomptarget/test -I /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/runtime/src -L /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/libomptarget -L /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./lib -L /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./lib -Wl,-rpath,/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/libomptarget -Wl,-rpath,/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./lib -Wl,-rpath,/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./lib --libomptarget-nvptx-bc-path=/build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/libomptarget/DeviceRTL -fopenmp-targets=nvptx64-nvidia-cuda /build/LLVM/18.1.8/GCCcore-13.3.0/llvm-project-18.1.8.src/openmp/libomptarget/test/api/omp_get_mapped_ptr.c -o /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/projects/openmp/libomptarget/test/nvptx64-nvidia-cuda/api/Output/omp_get_mapped_ptr.c.tmp /build/LLVM/18.1.8/GCCcore-13.3.0/llvm.obj.3/./lib/libomptarget.devicertl.a
# .---command stderr------------
# | clang: error: cannot find libdevice for sm_90; provide path to different CUDA installation via '--cuda-path', or pass '-nocudalib' to build without linking with libdevice
# `-----------------------------
# error: command failed with exit status: 1

--

********************

@Thyre
Copy link
Collaborator Author

Thyre commented Jul 2, 2025

I mean, the nvptx64 failure makes sense, as CUDA is not a dependency. I wonder however why those tests are not marked as ignored. Can you check if ptxas exists in your PATH?

In any case, we should probably go from just checking which('ptxas', on_error=IGNORE) to ignoring the failed tests if CUDA is not a direct dependency, just like we do for ROCm.

@Flamefire
Copy link
Contributor

I think I got it:

if self.nvptx_target_cond and not pxtas_path:

self.nvptx_target_cond = (BUILD_TARGET_NVPTX in build_targets) or all_target_cond where BUILD_TARGET_NVPTX is added if CUDA is a dependency

So the ignore part is never added. And indeed if I extract the parsing code, manually add the pattern and run on the same output I get:

num_failed=29 ignored_pattern_matches=297 failed_pattern_matches=326

PR incoming

@Flamefire
Copy link
Contributor

Test report by @Flamefire

Overview of tested easyconfigs (in order)

Build succeeded for 0 out of 1 (1 easyconfigs in total)
n1680 - Linux RHEL 8.9 (Ootpa), x86_64, Intel(R) Xeon(R) Platinum 8470 (sapphirerapids), Python 3.9.18
See https://gist.github.com/Flamefire/13d3fa794fe45cab8fa4a07d0be195f0 for a full test report.

@Flamefire
Copy link
Contributor

Test report by @Flamefire

Overview of tested easyconfigs (in order)

Build succeeded for 0 out of 1 (1 easyconfigs in total)
c42 - Linux AlmaLinux 9.4, x86_64, AMD EPYC 9334 32-Core Processor (zen4), 4 x NVIDIA NVIDIA H100, 560.35.03, Python 3.9.18
See https://gist.github.com/Flamefire/2953f6cabefe624212eae0487cae2901 for a full test report.

@Thyre
Copy link
Collaborator Author

Thyre commented Jul 2, 2025

Test report by @Flamefire

Overview of tested easyconfigs (in order)

* **FAIL (build issue)** _LLVM-18.1.8-GCCcore-13.3.0.eb_ (partial log available at https://gist.github.com/Flamefire/f4486f71b5a925fbd596ef3e00467df4)

[...]

For LLVM 18, we set skip_sanitizer_tests = False, for LLVM 19 & 20 skip_sanitizer_tests = True.
We should probably set this for LLVM 18 as well. See also easybuilders/easybuild-easyconfigs#22903 (comment)

@Flamefire
Copy link
Contributor

Test report by @Flamefire

Overview of tested easyconfigs (in order)

  • SUCCESS LLVM-18.1.8-GCCcore-13.3.0.eb

Build succeeded for 1 out of 1 (1 easyconfigs in total)
i7001 - Linux Rocky Linux 8.9 (Green Obsidian), x86_64, AMD EPYC 7702 64-Core Processor (zen2), Python 3.9.18
See https://gist.github.com/Flamefire/b019a2a269433ba473293c95bd68fc5c for a full test report.

@Flamefire
Copy link
Contributor

Test report by @Flamefire

Overview of tested easyconfigs (in order)

Build succeeded for 0 out of 1 (1 easyconfigs in total)
c115 - Linux AlmaLinux 9.4, x86_64, AMD EPYC 9334 32-Core Processor (zen4), 4 x NVIDIA NVIDIA H100, 560.35.03, Python 3.9.18
See https://gist.github.com/Flamefire/331c4761b841270076fdba5eafb0eb5f for a full test report.

@boegel boegel changed the title LLVM: Use dlopen for AMDGPU/CUDA libomptarget / offload target libraries enhance LLVM easyblock to use dlopen for AMDGPU/CUDA libomptarget / offload target libraries Jul 2, 2025
@boegel boegel changed the title enhance LLVM easyblock to use dlopen for AMDGPU/CUDA libomptarget / offload target libraries enhance LLVM easyblock to use dlopen for AMDGPU/CUDA libomptarget / offload target libraries Jul 2, 2025
@Thyre Thyre mentioned this pull request Jul 3, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants