Re: Bug#1116585: amd_hip_bf16.h: bf16 functions need to be static
Hi Cory,
thank you for your analysis.
On 2025-09-29 03:30, Cordell Bloor wrote:
> 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).
this was quite odd to me, too; but as this landed upstream and was
released with 6.1, I assumed that this would be safe.
> 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.
Apparently, this is was upstream did later.
I took a look at adding the appropriate static and/or inline qualifiers,
but this was more challenging than I thought, especially since I don't
know what the "known-good" version is to compare against.
I'll disable ggml's HIP backend for now, as this issue is blocking my
update in unstable as well.
Best,
Christian
Reply to: