#1116585 amd_hip_bf16.h: bf16 functions need to be static

Package:
libamdhip64-dev
Source:
libamdhip64-dev
Description:
Header files for the AMD implementation of HIP
Submitter:
Christian Kastner
Date:
2025-09-29 01:41:01 UTC
Severity:
normal
Tags:
#1116585#5
Date:
2025-09-28 19:29:56 UTC
From:
To:
Dear Maintainer,

Newer versions of ggml fail to build from source with HIP <= 6.0, with
linking failures such as the following:

According to upstream the upstream fix introduced in a later version
[1], this is because the functions in the bf16 header need to static.

Marking as important as it blocks the update of another package.

The fix seems simple enough, I will submit a PR.

Best,
Christian

[1]: https://github.com/ROCm/clr/commit/77c581a3ebd47b5e2908973b70adea66891159ee

#1116585#8
Date:
2025-09-28 19:32:05 UTC
From:
To:
Hello,

Bug #1116585 in rocm-hipamd reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/rocm-team/rocm-hipamd/-/commit/bb952c9a48d4be7cd2a71679528c6618e156f467
------------------------------------------------------------------------
Add Mark-bf16-functions-as-static.patch

Closes: #1116585
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1116585

#1116585#13
Date:
2025-09-28 19:32:05 UTC
From:
To:
Hello,

Bug #1116585 in rocm-hipamd reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/rocm-team/rocm-hipamd/-/commit/bb952c9a48d4be7cd2a71679528c6618e156f467
------------------------------------------------------------------------
Add Mark-bf16-functions-as-static.patch

Closes: #1116585
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1116585

#1116585#18
Date:
2025-09-28 21:54:13 UTC
From:
To:
Hello,

Bug #1116585 in rocm-hipamd reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/rocm-team/rocm-hipamd/-/commit/c980dc9a677a0be98d1acc597b06dca3a69a913c
------------------------------------------------------------------------
Add Mark-bf16-functions-as-static.patch

Closes: #1116585
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1116585

#1116585#21
Date:
2025-09-28 21:54:13 UTC
From:
To:
Hello,

Bug #1116585 in rocm-hipamd reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/rocm-team/rocm-hipamd/-/commit/c980dc9a677a0be98d1acc597b06dca3a69a913c
------------------------------------------------------------------------
Add Mark-bf16-functions-as-static.patch

Closes: #1116585
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1116585

#1116585#26
Date:
2025-09-29 01:30:20 UTC
From:
To:
Whoa there, Christian. Changing the definition of __HOST_DEVICE__ to
implicitly be static inline is using a bazooka to kill a housefly.

That would have knock-on effects on any code that uses the
__HOST_DEVICE__ macro, not just the handful of functions defined in the 
bf16 header. That header is indeed quite difficult to use without static
or inline qualifiers on all the functions it defines and those functions
were clearly always intended to have inline and/or static qualifiers.
However, if we want to backport a fix to trixie, changing the macro is
not going to be acceptable. User code might be using that
__HOST_DEVICE__ macro, in which case the impact may be much larger than 
just bf16 if we change that definition.

For this specific patch, there is also the problem that the
__HOST_DEVICE__ macro is defined in multiple different headers, but 
you've only changed the definition in one. That will result in a warning
when both headers are included in the same translation unit (and
inconsistent definitions if different translation units include
different headers).

I would recommend that we consider narrowly adding the appropriate
static and/or inline qualifiers to the specific functions in
amd_hip_bf16.h where they are needed.

Sincerely,
Cory Bloor