Skip to content

Commit 3d57038

Browse files
AngryLokinegril
authored andcommitted
dev-libs/rocm-comgr: drop 6.0.0, cleanup in 6.1.1 patches
* fix hip compiler on musl profile * fix tests * make 6.1.1 compatible with LLVM 18 Signed-off-by: Sv. Lockal <[email protected]>
1 parent 85e6f7c commit 3d57038

9 files changed

+100
-189
lines changed

dev-libs/rocm-comgr/Manifest

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ DIST rocm-comgr-5.3.3.tar.gz 120414 BLAKE2B 29b9d466d74ef94165a2b9bea35eac4616f6
44
DIST rocm-comgr-5.4.3.tar.gz 120461 BLAKE2B c4eb79dd5a72a2b18e16841fc8cb9a3a33efb0c7b04a7585df9672d682bba6fa826ab8b37dba5febca3b8c5ee5aca30d8546e1fa69e77671e5c750e2a8c1f12f SHA512 1a25af99a0166d70ca6dc5df5a667068eaf583dccd74bbb18a2a5de3c1b769e0c1eb9a0c539e0cd88bc50bbbe53214a1d1b23fbdfd6fc5b6507c44da259815c4
55
DIST rocm-comgr-5.5.1.tar.gz 127475 BLAKE2B dbcb6729b27c0b4a4be37f5e462d96b10c15a6a3b540a81a74a648fc45dc727ea5706db1a0f4583a31ac4cb5c9f0d9f4e258fa5ac792b327f4cb1dfe6d585937 SHA512 09174ef2ad21f62b197e439bb5b04a365233c360c57cc2ccf0ea3d53edfa8880dff4f127c6d6c1d430b63b6f7ea666705b14cadc2bccb89c0fefed943b0cf1c7
66
DIST rocm-comgr-5.7.1.tar.gz 137923 BLAKE2B e215f51137fd0c4b67e85496bf289dc0afde6ebc9efb9416f5fc4cf312b2be9be26da35cb70965bf4857a0f1434d750bcc03ce83095173098487ef7805948735 SHA512 cdd2609b858d9503c30122a2d328d36baa8a930a05bcb6c38e30723909c492b4d47eaaf4884dbb7aa82053e7cda6c22ee1aa16fc5ba266e272d98ff772c5079d
7-
DIST rocm-comgr-6.0.0.tar.gz 142129 BLAKE2B 65d00a79ead48872e3b94e5239a07c476288c611aa3ce2311a345bec5f7d277dc67910fa5f4ef000a5e94e6bed148baa4b1c7fe2b1cfaae2cc39555d716668d5 SHA512 877d2042bdafa6b503ee8f24d3a9c4ac9e001a7884211df47b2237d8a5ead66ced0f352c7b76d96190cd407461f5434fb1a5a4508067e432eb93c0f2fd066053

dev-libs/rocm-comgr/files/rocm-comgr-6.0.0-llvm-18-compat.patch

Lines changed: 0 additions & 22 deletions
This file was deleted.

dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-clang18-code-object-v5.patch

Lines changed: 0 additions & 23 deletions
This file was deleted.

dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-clang18-log_remarks_test.patch

Lines changed: 0 additions & 14 deletions
This file was deleted.

dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-clang18-option-use-visibility.patch

Lines changed: 0 additions & 39 deletions
This file was deleted.

dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-fix-comgr-default-flags.patch

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Remove HIP/ROCM includes ("-isystem /usr/include"), as they break inclusion of <math.h>.
22
Add inclusion of Clang resource dir (e.g. /usr/lib/clang/17), as it is used in hip runtime like that.
3-
Issue: https://github.com/ROCm/clr/issues/82
3+
Remove hardcoded target to fix HIP on musl.
4+
5+
Issues:
6+
* https://github.com/ROCm/clr/issues/82
7+
* https://github.com/ROCm/llvm-project/issues/92
48
--- a/src/comgr-compiler.cpp
59
+++ b/src/comgr-compiler.cpp
610
@@ -1028,9 +1028,8 @@ AMDGPUCompiler::addTargetIdentifierFlags(llvm::StringRef IdentStr,
@@ -15,8 +19,12 @@ Issue: https://github.com/ROCm/clr/issues/82
1519

1620
Args.push_back("-x");
1721

18-
@@ -1055,9 +1054,7 @@ amd_comgr_status_t AMDGPUCompiler::addCompilationFlags() {
19-
Args.push_back("x86_64-unknown-linux-gnu");
22+
@@ -1051,13 +1050,9 @@ amd_comgr_status_t AMDGPUCompiler::addCompilationFlags() {
23+
case AMD_COMGR_LANGUAGE_HIP:
24+
Args.push_back("hip");
25+
Args.push_back("-std=c++11");
26+
- Args.push_back("-target");
27+
- Args.push_back("x86_64-unknown-linux-gnu");
2028
Args.push_back("--cuda-device-only");
2129
Args.push_back("-isystem");
2230
- Args.push_back(ROCMIncludePath.c_str());
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
ROCm 6.0.0 and 6.0.2 releases use mix between LLVM 17 and 18
2+
forked as https://github.com/RadeonOpenCompute/llvm-project
3+
which makes some libraries compatible with LLVM 17,
4+
while other require LLVM 18.
5+
6+
Backports:
7+
* https://github.com/ROCm/llvm-project/commit/6cbc4dc91dfeb1cf2295cb350866e0b3a07dfee4
8+
* https://github.com/ROCm/llvm-project/commit/179ec2e67bf882c6bccb27f81db3d80f7eb9946e
9+
* https://github.com/ROCm/llvm-project/commit/ee123c3d1706bc4346511b1a9032020782576350
10+
--- a/src/comgr-compiler.cpp
11+
+++ b/src/comgr-compiler.cpp
12+
@@ -205,7 +205,11 @@ bool AssemblerInvocation::createFromArgs(AssemblerInvocation &Opts,
13+
// Parse the arguments.
14+
const OptTable &OptTbl = getDriverOptTable();
15+
16+
+#if LLVM_VERSION_MAJOR == 17
17+
const unsigned IncludedFlagsBitmask = options::CC1AsOption;
18+
+#else
19+
+ llvm::opt::Visibility IncludedFlagsBitmask(options::CC1AsOption);
20+
+#endif
21+
unsigned MissingArgIndex, MissingArgCount;
22+
InputArgList Args = OptTbl.ParseArgs(Argv, MissingArgIndex, MissingArgCount,
23+
IncludedFlagsBitmask);
24+
@@ -1041,11 +1045,15 @@ amd_comgr_status_t AMDGPUCompiler::addCompilationFlags() {
25+
Args.push_back("cl");
26+
Args.push_back("-std=cl1.2");
27+
Args.push_back("-cl-no-stdinc");
28+
+ Args.push_back("-mllvm");
29+
+ Args.push_back("-amdgpu-internalize-symbols");
30+
break;
31+
case AMD_COMGR_LANGUAGE_OPENCL_2_0:
32+
Args.push_back("cl");
33+
Args.push_back("-std=cl2.0");
34+
Args.push_back("-cl-no-stdinc");
35+
+ Args.push_back("-mllvm");
36+
+ Args.push_back("-amdgpu-internalize-symbols");
37+
break;
38+
case AMD_COMGR_LANGUAGE_HIP:
39+
Args.push_back("hip");
40+
@@ -1605,6 +1613,9 @@ amd_comgr_status_t AMDGPUCompiler::assembleToRelocatable() {
41+
Args.push_back("-x");
42+
Args.push_back("assembler");
43+
44+
+ // -nogpulib option not needed for assembling to relocatable
45+
+ NoGpuLib = false;
46+
+
47+
return processFiles(AMD_COMGR_DATA_KIND_RELOCATABLE, ".o");
48+
}
49+
50+
--- a/src/comgr-metadata.cpp
51+
+++ b/src/comgr-metadata.cpp
52+
@@ -1087,7 +1087,12 @@ amd_comgr_status_t lookUpCodeObject(DataObject *DataP,
53+
}
54+
55+
BinaryStreamReader Reader(StringRef(DataP->Data, DataP->Size),
56+
- support::little);
57+
+#if LLVM_VERSION_MAJOR == 17
58+
+ support::little
59+
+#else
60+
+ llvm::endianness::little
61+
+#endif
62+
+ );
63+
64+
StringRef Magic;
65+
if (auto EC = Reader.readFixedString(Magic, OffloadBundleMagicLen)) {
66+
--- a/test/compile_log_remarks_test.c
67+
+++ b/test/compile_log_remarks_test.c
68+
@@ -107,7 +107,11 @@ int main(int argc, char *argv[]) {
69+
AMD_COMGR_DATA_KIND_SOURCE, 1);
70+
71+
checkLogs("AMD_COMGR_ACTION_CODEGEN_BC_TO_ASSEMBLY", DataSetAsm,
72+
+#if LLVM_VERSION_MAJOR == 17
73+
"remark: <unknown>:0:0: 8 stack bytes in function "
74+
+#else
75+
+ "remark: <unknown>:0:0: 8 stack bytes in function 'f' "
76+
+#endif
77+
"[-Rpass-analysis=prologepilog]");
78+
79+
Status = amd_comgr_destroy_data_set(DataSetCl);

dev-libs/rocm-comgr/rocm-comgr-6.0.0-r1.ebuild

Lines changed: 0 additions & 68 deletions
This file was deleted.

dev-libs/rocm-comgr/rocm-comgr-6.1.1.ebuild

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ inherit cmake llvm-r1 prefix
1010
MY_P=llvm-project-rocm-${PV}
1111
components=( "amd/comgr" )
1212

13-
if [[ ${PV} == *9999 ]] ; then
14-
EGIT_REPO_URI="https://github.com/ROCm/llvm-project"
15-
inherit git-r3
16-
S="${WORKDIR}/${P}/${components[0]}"
17-
else
18-
SRC_URI="https://github.com/ROCm/llvm-project/archive/rocm-${PV}.tar.gz -> ${MY_P}.tar.gz"
19-
S="${WORKDIR}/${MY_P}/${components[0]}"
20-
KEYWORDS="~amd64"
21-
fi
13+
DESCRIPTION="Radeon Open Compute Code Object Manager"
14+
HOMEPAGE="https://github.com/ROCm/ROCm-CompilerSupport"
15+
SRC_URI="https://github.com/ROCm/llvm-project/archive/rocm-${PV}.tar.gz -> ${MY_P}.tar.gz"
16+
S="${WORKDIR}/${MY_P}/${components[0]}"
17+
18+
LICENSE="MIT"
19+
SLOT="0/$(ver_cut 1-2)"
20+
KEYWORDS="~amd64"
2221

2322
IUSE="test"
2423
RESTRICT="!test? ( test )"
@@ -28,27 +27,19 @@ PATCHES=(
2827
"${FILESDIR}/0001-Find-CLANG_RESOURCE_DIR-using-clang-print-resource-d.patch"
2928
"${FILESDIR}/${PN}-5.7.1-correct-license-install-dir.patch"
3029
"${FILESDIR}/${PN}-6.0.0-extend-isa-compatibility-check.patch"
31-
"${FILESDIR}/${PN}-6.0.0-llvm-18-compat.patch"
30+
"${FILESDIR}/${PN}-6.1.0-llvm-18-compat.patch"
3231
"${FILESDIR}/${PN}-6.1.0-enforce-oop-compiler.patch"
3332
"${FILESDIR}/${PN}-6.1.0-fix-comgr-default-flags.patch"
34-
"${FILESDIR}/${PN}-6.1.0-clang18-option-use-visibility.patch"
35-
"${FILESDIR}/${PN}-6.1.0-clang18-code-object-v5.patch"
36-
"${FILESDIR}/${PN}-6.1.0-clang18-log_remarks_test.patch"
3733
"${FILESDIR}/${PN}-6.1.0-dont-add-nogpulib.patch"
3834
)
3935

40-
DESCRIPTION="Radeon Open Compute Code Object Manager"
41-
HOMEPAGE="https://github.com/ROCm/ROCm-CompilerSupport"
42-
LICENSE="MIT"
43-
SLOT="0/$(ver_cut 1-2)"
44-
4536
RDEPEND=">=dev-libs/rocm-device-libs-${PV}
4637
sys-devel/clang-runtime:=
4738
$(llvm_gen_dep '
4839
sys-devel/clang:${LLVM_SLOT}=
4940
sys-devel/lld:${LLVM_SLOT}=
5041
')
51-
dev-util/hipcc
42+
dev-util/hipcc:${SLOT}
5243
"
5344
DEPEND="${RDEPEND}"
5445

0 commit comments

Comments
 (0)