<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Tags: patch<br>
<br>
Hi Graham,<br>
</p>
<div class="moz-cite-prefix">On 2024-05-05 07:31, Graham Inggs
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAM8zJQs=o8OWvJ8NG5zSWanUJRiHqXaiqd2fdt6GEdOUchFozg@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">As can be seen in reproducible builds [1], rocm-hipamd FTBFS on arm64
with glibc 2.38. I've copied what I hope is the relevant part of the
log below.
A bug was filed against glibc [2], but it seems glibc upstream do not
consider it a bug in glibc.
</pre>
</blockquote>
<p>There is nothing that can be done in rocm-hipamd to address this
bug, aside from removing arm64 from the rocm-hipamd architecture
list. The incompatibility is not with the HIP runtime, but with
the HIP language<span style="white-space: pre-wrap">. </span><span
style="white-space: pre-wrap">This is a disagreement that glibc and llvm will need to resolve between themselves</span><span
style="white-space: pre-wrap">.
</span></p>
<blockquote type="cite"
cite="mid:CAM8zJQs=o8OWvJ8NG5zSWanUJRiHqXaiqd2fdt6GEdOUchFozg@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">[1] <a
class="moz-txt-link-freetext"
href="https://tests.reproducible-builds.org/debian/rb-pkg/rocm-hipamd.html">https://tests.reproducible-builds.org/debian/rb-pkg/rocm-hipamd.html</a>
[2] <a class="moz-txt-link-freetext"
href="https://sourceware.org/bugzilla/show_bug.cgi?id=30909">https://sourceware.org/bugzilla/show_bug.cgi?id=30909</a>
In file included from /tmp/hip_pch.724714/hip_pch.h:1:
In file included from
/build/reproducible-path/rocm-hipamd-5.7.1/hip/include/hip/hip_runtime.h:62:
In file included from
/build/reproducible-path/rocm-hipamd-5.7.1/hipamd/include/hip/amd_detail/amd_hip_runtime.h:76:
In file included from
/usr/lib/gcc/aarch64-linux-gnu/13/../../../../include/c++/13/cmath:47:
In file included from /usr/include/math.h:40:
/usr/include/aarch64-linux-gnu/bits/math-vector.h:40:9: error: unknown
type name '__SVFloat32_t'
40 | typedef __SVFloat32_t __sv_f32_t;
| ^
/usr/include/aarch64-linux-gnu/bits/math-vector.h:41:9: error: unknown
type name '__SVFloat64_t'
41 | typedef __SVFloat64_t __sv_f64_t;
| ^
/usr/include/aarch64-linux-gnu/bits/math-vector.h:42:9: error: unknown
type name '__SVBool_t'
42 | typedef __SVBool_t __sv_bool_t;
| ^
</pre>
</blockquote>
<p>This compilation error is when building device code when the host
architecture is aarch64. LLVM only defines __SVFloat32_t,
__SVFloat64_t and __SVBool_t when building host code, but not when
building device code. To me this seems reasonable because GPUs do
not support SVE instructions.</p>
<p>However, the math.h header (on aarch64 at least) is not aware of
the concept of the distinction between host code and device code.
As such, it fails when compiling device code. The glibc argument
is that GCC always supports these types, but I'm not convinced.
I'm curious how GCC handles the math headers for OpenMP GPU
offloading [3].</p>
<p>In any case, I've attached a patch for glibc that would fix this
bug. Perhaps my suggestion would be more palatable to upstream
than the previously rejected patch. If not, it's up to glibc or
LLVM to find a solution. If they cannot, then we will have to drop
arm64 support for the HIP language.<br>
</p>
<p>Sincerely,<br>
Cory Bloor<br>
</p>
<p>[3]: <a class="moz-txt-link-freetext"
href="https://gcc.gnu.org/wiki/Offloading">https://gcc.gnu.org/wiki/Offloading</a><br>
</p>
</body>
</html>