Your message dated Fri, 10 Mar 2023 23:32:51 +0000
with message-id <[email protected]>
and subject line Bug#1031808: fixed in llvm-toolchain-15 1:15.0.7-2
has caused the Debian Bug report #1031808,
regarding clang-15: clang does not search debian paths for rocm
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
1031808: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1031808
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: clang-15
Version: 1:15.0.7-1
Severity: normal
X-Debbugs-Cc: [email protected], [email protected]
Dear Maintainer,
Clang does not search the system paths when looking for the ROCm
components that it requires for building HIP langauge code. Consider the
following sample program:
main.hip:
#include <stdio.h>
#include <stdlib.h>
#include <hip/hip_runtime.h>
#define CHECK_HIP(expr) do { \
hipError_t result = (expr); \
if (result != hipSuccess) { \
fprintf(stderr, "%s:%d: %s (%d)\n", \
__FILE__, __LINE__, \
hipGetErrorString(result), result); \
exit(EXIT_FAILURE); \
} \
} while(0)
__global__ void sq_arr(float *arr, int n) {
int tid = blockDim.x*blockIdx.x + threadIdx.x;
if (tid < n) {
arr[tid] = arr[tid] * arr[tid];
}
}
int main() {
enum { N = 5 };
float hArr[N] = { 1, 2, 3, 4, 5 };
float *dArr;
CHECK_HIP(hipMalloc(&dArr, sizeof(float) * N));
CHECK_HIP(hipMemcpy(dArr, hArr, sizeof(float) * N,
hipMemcpyHostToDevice));
sq_arr<<<dim3(1), dim3(32,1,1), 0, 0>>>(dArr, N);
CHECK_HIP(hipMemcpy(hArr, dArr, sizeof(float) * N,
hipMemcpyDeviceToHost));
for (int i = 0; i < N; ++i) {
printf("%f\n", hArr[i]);
}
CHECK_HIP(hipFree(dArr));
return 0;
}
It should be possible to build this sample program using the commands:
apt install hipcc
clang++-15 -x hip -lamdhip64 main.hip
At present, however, that will result in the following error messages:
clang: error: cannot find ROCm device library; provide its path via
'--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without
ROCm device library
clang: error: cannot find HIP runtime; provide its path via '--rocm-path',
or pass '-nogpuinc' to build without HIP runtime
clang: error: cannot find HIP runtime; provide its path via '--rocm-path',
or pass '-nogpuinc' to build without HIP runtime
The errors can be resolved with a few additional flags:
clang++-15 -x hip --rocm-path=/usr \
--rocm-device-lib-path=/usr/lib/x86_64-linux-gnu/amdgcn/bitcode \
--hip-version=5.2.21153 \
-lamdhip64 main.hip
However, this should not be necessary. The first step should be to
backport the upstream HIP detection for Debian and Fedora [1]. That will
solve 2/3rds of this problem by eliminating the need to pass --rocm-path
and --hip-version.
It's less clear what should be done about the ROCm Device Lib path. The
upstream LLVM project searches for the ROCm device libs at
/usr/lib/llvm-15/lib/clang/15.0.7/lib/amdgcn/bitcode [2], which seems
like the ideal place to put them. However, placing the device libs in a
path that contains the LLVM version number would require a lot of
coordination between packages.
My understanding is that the bitcode files are LLVM IR and newer
versions of LLVM can use bitcode files that were compiled with older
versions of LLVM [3], so it should be fine to leave the bitcode files in
an unversioned path like /usr/lib/$(DEB_HOST_MULTIARCH)/amdgcn/bitcode
and still not have to worry about what happens when LLVM is updated.
After considering these trade-offs, my conclusion is that
/usr/lib/$(DEB_HOST_MULTIARCH)/amdgcn/bitcode should be added to the
search paths for the ROCm device libs.
Sincerely,
Cory Bloor
[1]:
https://github.com/llvm/llvm-project/commit/082593ff7aff68060bd66dccfa43493d07d9c255
[2]:
https://github.com/llvm/llvm-project/blob/419948fe6708021524f86e15d755719d634ab8d2/clang/lib/Driver/ToolChains/AMDGPU.cpp#L416
[3]: https://llvm.org/docs/DeveloperPolicy.html#ir-backwards-compatibility
-- System Information:
Debian Release: bookworm/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-3-amd64 (SMP w/32 CPU threads; PREEMPT)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect
Versions of packages clang-15 depends on:
ii binutils 2.40-2
ii libc6 2.36-8
ii libc6-dev 2.36-8
ii libclang-common-15-dev 1:15.0.7-1
ii libclang-cpp15 1:15.0.7-1
ii libclang1-15 1:15.0.7-1
ii libgcc-12-dev 12.2.0-14
ii libgcc-s1 12.2.0-14
ii libllvm15 1:15.0.7-1
ii libobjc-12-dev 12.2.0-14
ii libstdc++-12-dev 12.2.0-14
ii libstdc++6 12.2.0-14
ii llvm-15-linker-tools 1:15.0.7-1
Versions of packages clang-15 recommends:
ii llvm-15-dev 1:15.0.7-1
ii python3 3.11.2-1
Versions of packages clang-15 suggests:
pn clang-15-doc <none>
pn wasi-libc <none>
-- no debconf information
--- End Message ---
--- Begin Message ---
Source: llvm-toolchain-15
Source-Version: 1:15.0.7-2
Done: Sylvestre Ledru <[email protected]>
We believe that the bug you reported is fixed in the latest version of
llvm-toolchain-15, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Sylvestre Ledru <[email protected]> (supplier of updated llvm-toolchain-15
package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Format: 1.8
Date: Sun, 15 Jan 2023 10:54:41 +0100
Source: llvm-toolchain-15
Architecture: source
Version: 1:15.0.7-2
Distribution: unstable
Urgency: medium
Maintainer: LLVM Packaging Team <[email protected]>
Changed-By: Sylvestre Ledru <[email protected]>
Closes: 1029010 1031808 1032316 1032317
Changes:
llvm-toolchain-15 (1:15.0.7-2) unstable; urgency=medium
.
[ Sylvestre Ledru ]
* Yeah, we would like to have this version in bookworm
(Closes: #1032316)
* Adjust some lintian overrides
* Disable flang on s390x. Seems that it is breaking
.
[ Gianfranco Costamagna ]
* Update print lldb python patch, following what was done
in automake for newer python
.
[ Samuel Thibault ]
* Fix disabling amdgpu on non-Linux.
.
[ John Paul Adrian Glaubitz ]
* Don't run chrpath for libclang on powerpc and powerpcspe
.
[ Faidon Liambotis ]
* Update the wasm-sysroot-usr.diff patch to restore functionality that was
accidentally dropped when the patch was forward-ported from 14 to 15. This
resolves an issue in which clang++ builds would fail if libc++-15-dev was
installed alongside libc++-15-dev-wasm32. (Closes: #1029010, #1032317)
.
[ Cordell Bloor ]
* Backport support for HIP in /usr and add Debian paths
for rocm-device-libs to search list (Closes: #1031808)
Checksums-Sha1:
0ca4eaf577972b4f3b9504d4d153a8116fcca2dc 8135 llvm-toolchain-15_15.0.7-2.dsc
0880145f11e6f71e7c400cc5d284edd9962046e8 170932
llvm-toolchain-15_15.0.7-2.debian.tar.xz
e9307795bbc43c62cfd09de3c93343b692a335d7 34473
llvm-toolchain-15_15.0.7-2_amd64.buildinfo
Checksums-Sha256:
f6eda05bb17603e4a7fe792eb88ebbe9b2c056af712fcb3ef010377419987865 8135
llvm-toolchain-15_15.0.7-2.dsc
580267233f947fd27357c2d2cb3463fa2619c8db83dd39370661fac0674c489d 170932
llvm-toolchain-15_15.0.7-2.debian.tar.xz
b41710115e34657af2a19e0fe4059e995c873a17627d5e4dfbf23a073cbd2607 34473
llvm-toolchain-15_15.0.7-2_amd64.buildinfo
Files:
bb757b739193d3b238adbd9aa32ea94a 8135 devel optional
llvm-toolchain-15_15.0.7-2.dsc
800bd90f1d71dc85876a8aacf6912c9d 170932 devel optional
llvm-toolchain-15_15.0.7-2.debian.tar.xz
c4455cb1dc68bf3b75773bc170bab726 34473 devel optional
llvm-toolchain-15_15.0.7-2_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEtg21mU05vsTRqVzPfmUo2nUvG+EFAmQLtfkACgkQfmUo2nUv
G+Gsow//URSCLQYO4IXN5UhhmatDhyXEky01AsgeY7ManAFsPNb5CPnUV/7tkQAC
trv9LEIc1fXyDSgNrKC4huX+Ssk9eTZamY9ZS/Sk0sMeF6J/lhQLpU85nNVywlsi
SrN2XLc55FARv9nQMJCND266hlsh7WuZ6vpts868Ulhxow4zCyXE4OGt5ZrEgJUF
RO/oipz/1PWYrmdfWfu9sRX47EA4xg1Mo+uOfu4gmW3C9CYplsn/ItAWKobhxi7k
Uk6j26hpblgWcrTvTHwLsdOkIKH7MNk6bu6DF79plhvRVDFjvb1Ix0EYmaMdv9Rf
p0YZkRdjaP5cEUVkmMk36/Mr/gPvAyuhVuSlOdZme4tz1JIe6TbI/odCCqfA8noP
SzwcxwCoZr7vUrDFJBerdygQj+yfBAgDHroqbNbJq9XtVz+Z/BOFgkZIBJ4vlLbN
IbBdibnXFo5rIn7ey0zEn+vAfq/SiSJ2aPLYNGj2n87Zq298D3XPI7V8aFC7Oo3u
frTcaqkrhCZp7zeAyjNBe7HGJLgf6B+qY0saIkuAENttyPz0BnKw+40Z0mduMjhZ
fODlazaumI7FScicJZoeeebB3szwDzgm4hNZEPY7XfnceVUAZPaBzqwkvaz864dB
hKDZaJudhpbDD5RuPrZu7LG4ludugyegk9xVDuZvcDz91Q4XWMU=
=kNBE
-----END PGP SIGNATURE-----
--- End Message ---