Skip to content

Commit 32e3ea7

Browse files
authored
Merge pull request easybuilders#23304 from Thyre/20250703205604_new_pr_ROCm-LLVM641
{tools}[GCCcore/14.2.0] ROCm-LLVM v19.0.0 w/ ROCm 6.4.1
2 parents cf797a5 + d10ab6f commit 32e3ea7

3 files changed

Lines changed: 398 additions & 0 deletions

File tree

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
easyblock = 'Bundle'
2+
3+
name = 'ROCm-LLVM'
4+
_llvm_version = '19.0.0'
5+
version = _llvm_version
6+
_rocm_version = '6.4.1'
7+
versionsuffix = f'-ROCm-{_rocm_version}'
8+
9+
homepage = 'https://github.com/ROCm/llvm-project'
10+
description = """ROCm-LLVM is an open source Clang/LLVM based compiler.
11+
It is an AMD Fork of The LLVM Compiler Infrastructure, and aims to contain all of upstream LLVM.
12+
It also includes several AMD-specific additions in the llvm-project/amd directory."""
13+
docurls = ['https://rocmdocs.amd.com']
14+
15+
toolchain = {'name': 'GCCcore', 'version': '14.2.0'}
16+
17+
builddependencies = [
18+
('CMake', '3.31.3'),
19+
('Perl', '5.40.0'),
20+
('Python', '3.13.1'),
21+
('pkgconf', '2.3.0'),
22+
('xxd', '9.1.1457'), # required for ROCr-Runtime
23+
]
24+
25+
dependencies = [
26+
('binutils', '2.42'),
27+
('elfutils', '0.193'),
28+
('zlib', '1.3.1'),
29+
('hwloc', '2.11.2'),
30+
('GMP', '6.3.0'),
31+
('libxml2', '2.13.4'),
32+
('ncurses', '6.5'),
33+
('libffi', '3.4.5'),
34+
('libdrm', '2.4.125'),
35+
('numactl', '2.0.19'),
36+
('Z3', '4.13.4'),
37+
]
38+
39+
local_rocm_llvm_source = 'llvm-project-rocm-%s.tar.gz' % _rocm_version
40+
local_common_cmake_configopts = ' '.join([
41+
'-DCMAKE_C_COMPILER=%(installdir)s/bin/clang',
42+
'-DCMAKE_CXX_COMPILER=%(installdir)s/bin/clang++',
43+
'-DLLVM_INSTALL_PREFIX=%(installdir)s',
44+
'-DLLVM_DIR=%(installdir)s/lib/cmake/llvm',
45+
])
46+
47+
default_easyblock = 'CMakeMake'
48+
49+
default_component_specs = {
50+
'source_urls': ['https://github.com/ROCm/%(name)s/archive/'],
51+
'sources': [{
52+
'download_filename': '%(version)s.tar.gz',
53+
'filename': '%(name)s-%(version)s.tar.gz',
54+
}],
55+
'srcdir': '%(name)s-%(version)s',
56+
}
57+
58+
components = [
59+
('llvm-project', '%s-rocm-%s' % (_llvm_version, _rocm_version), {
60+
'easyblock': 'EB_ROCm_minus_LLVM',
61+
'sources': [{
62+
'download_filename': 'rocm-%s.tar.gz' % _rocm_version,
63+
'filename': local_rocm_llvm_source,
64+
# rename the extracted directory to the one that the LLVM easyblock expects
65+
'extract_cmd': 'tar xfz %%s && mv %%(name)s-rocm-%s %%(name)s-%%(version)s.src' % _rocm_version,
66+
}],
67+
'patches': [
68+
'ROCm-LLVM-19.0.0_fix-offload-build.patch',
69+
'ROCm-LLVM-19.0.0_fix-ConstantFoldFP128-conversion-issue.patch'
70+
],
71+
'checksums': [
72+
{local_rocm_llvm_source:
73+
'460ad28677092b9eb86ffdc49bcb4d01035e32b4f05161d85f90c9fa80239f50'},
74+
{'ROCm-LLVM-19.0.0_fix-offload-build.patch':
75+
'2ce1454aa3d2f50795bbc331c239f44be07f8ec836978cad130406af4340e30d'},
76+
{'ROCm-LLVM-19.0.0_fix-ConstantFoldFP128-conversion-issue.patch':
77+
'76fc2b0209c9e6a2d13f138b40acdab41313e979104bb66e4b1ac1aa7b4b5d03'},
78+
],
79+
'start_dir': f'llvm-project-{_llvm_version}-rocm-{_rocm_version}.src',
80+
'bootstrap': True,
81+
'build_lld': True,
82+
'build_clang_extras': True,
83+
'build_openmp_offload': False,
84+
'build_openmp_tools': True,
85+
'build_runtimes': True,
86+
'full_llvm': False,
87+
'skip_all_tests': True,
88+
}),
89+
('ROCm-comgr', 'rocm-%s' % _rocm_version, {
90+
# sources are located in amd/comgr subdir of llvm-project component
91+
'sources': [{'filename': local_rocm_llvm_source, 'extract_cmd': 'echo %s'}],
92+
'checksums': [
93+
{local_rocm_llvm_source:
94+
'460ad28677092b9eb86ffdc49bcb4d01035e32b4f05161d85f90c9fa80239f50'},
95+
],
96+
'srcdir': 'llvm-project-%s-%%(version)s.src/amd/comgr' % _llvm_version,
97+
'prebuildopts': 'export ROCM_PATH=%(installdir)s && ',
98+
'configopts': local_common_cmake_configopts + ' -DROCM_DIR=%(installdir)s/share/rocm/cmake'
99+
}),
100+
('ROCR-Runtime', 'rocm-%s' % _rocm_version, {
101+
'srcdir': '%(name)s-%(version)s',
102+
'checksums': [
103+
{'ROCR-Runtime-rocm-6.4.1.tar.gz':
104+
'f72d100a46a2dd9f4c870cef156604777f1bdb1841df039d14bf37b19814b9da'},
105+
],
106+
'configopts': local_common_cmake_configopts + ' -DBUILD_SHARED_LIBS=ON',
107+
}),
108+
('llvm-project-openmp', '%s-rocm-%s' % (_llvm_version, _rocm_version), {
109+
'easyblock': 'EB_ROCm_minus_LLVM',
110+
'sources': [{
111+
'download_filename': 'rocm-%s.tar.gz' % _rocm_version,
112+
'filename': local_rocm_llvm_source,
113+
# rename the extracted directory to the one that the LLVM easyblock expects
114+
# we need to extract the sources again so that potential source changes done by easyblocks
115+
# do not cause unintended behaviour in the second build
116+
'extract_cmd': 'tar xfz %%s && mv llvm-project-rocm-%s %%(name)s-%%(version)s.src' % _rocm_version,
117+
}],
118+
'patches': [
119+
'ROCm-LLVM-19.0.0_fix-offload-build.patch',
120+
'ROCm-LLVM-19.0.0_fix-ConstantFoldFP128-conversion-issue.patch',
121+
],
122+
'checksums': [
123+
{local_rocm_llvm_source:
124+
'460ad28677092b9eb86ffdc49bcb4d01035e32b4f05161d85f90c9fa80239f50'},
125+
{'ROCm-LLVM-19.0.0_fix-offload-build.patch':
126+
'2ce1454aa3d2f50795bbc331c239f44be07f8ec836978cad130406af4340e30d'},
127+
{'ROCm-LLVM-19.0.0_fix-ConstantFoldFP128-conversion-issue.patch':
128+
'76fc2b0209c9e6a2d13f138b40acdab41313e979104bb66e4b1ac1aa7b4b5d03'},
129+
],
130+
'start_dir': f'llvm-project-openmp-{_llvm_version}-rocm-{_rocm_version}.src',
131+
'bootstrap': True,
132+
'build_lld': True,
133+
'build_clang_extras': True,
134+
'build_openmp_offload': True,
135+
'build_openmp_tools': True,
136+
'build_runtimes': True,
137+
'full_llvm': False,
138+
'skip_all_tests': True,
139+
}),
140+
('aomp-extras', 'rocm-%s' % _rocm_version, {
141+
'configopts':
142+
local_common_cmake_configopts +
143+
' -DAOMP_STANDALONE_BUILD=0 '
144+
'-DAOMP_VERSION_STRING=%s ' % _rocm_version,
145+
'checksums': [
146+
{'aomp-extras-rocm-6.4.1.tar.gz':
147+
'cf20b02b1f99f506c198866ef03f2265dc355627760f82cda3878d5bc6486afc'},
148+
],
149+
}),
150+
151+
]
152+
153+
sanity_check_components = ['llvm-project']
154+
155+
modextravars = {
156+
'HIP_DEVICE_LIB_PATH': '%(installdir)s/amdgcn/bitcode',
157+
}
158+
159+
moduleclass = 'tools'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
From 6ee49080e4bb43efe7ede10bed15935853bbd434 Mon Sep 17 00:00:00 2001
2+
From: Chen Zheng <czhengsz@cn.ibm.com>
3+
Date: Tue, 30 Jul 2024 09:02:07 +0800
4+
Subject: [PATCH] [NFC] fix build failure (#100993)
5+
6+
Fix the build failure caused by
7+
https://github.com/llvm/llvm-project/pull/94944
8+
9+
Fixes https://github.com/llvm/llvm-project/issues/100296
10+
11+
(cherry picked from commit 40b4fd7a3e81d32b29364a1b15337bcf817659c0)
12+
---
13+
llvm/lib/Analysis/ConstantFolding.cpp | 4 ++--
14+
1 file changed, 2 insertions(+), 2 deletions(-)
15+
16+
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
17+
index df75745645e04..ff30fece5fce9 100644
18+
--- a/llvm/lib/Analysis/ConstantFolding.cpp
19+
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
20+
@@ -1784,8 +1784,8 @@ Constant *ConstantFoldFP(double (*NativeFP)(double), const APFloat &V,
21+
}
22+
23+
#if defined(HAS_IEE754_FLOAT128) && defined(HAS_LOGF128)
24+
-Constant *ConstantFoldFP128(long double (*NativeFP)(long double),
25+
- const APFloat &V, Type *Ty) {
26+
+Constant *ConstantFoldFP128(float128 (*NativeFP)(float128), const APFloat &V,
27+
+ Type *Ty) {
28+
llvm_fenv_clearexcept();
29+
float128 Result = NativeFP(V.convertToQuad());
30+
if (llvm_fenv_testexcept()) {

0 commit comments

Comments
 (0)