frasercrmck wrote:

> > I would like to further investigate weak linkage as another means of 
> > overriding specific builtins down to a finer granularity. That approach 
> > might warrant another method of file discovery.
> 
> It would bring unnecessary builds and may increase build time. Filename 
> overriding should be better.

Yes, however when a target only wants to override one type such as fp16, with 
the current approach the target has to override the whole of `cos.cl` and 
re-implement fp32 and fp64, for example. This isn't terrible for OpenCL where 
you can simply repeat the wrappers to the CLC functions, but when wanting to 
override the CLC functions for specific types it's awkward and can result in a 
lot of duplicated code.

The idea using weak linkage wouldn't remove file overriding (as you say, it's a 
good approach for coarse-grained overriding), but would have to compliment it. 
We actually do it already for a couple of builtins (such as 
[ldexp](https://github.com/llvm/llvm-project/blob/main/libclc/clc/lib/generic/math/clc_ldexp.cl#L18)),
 but it's a bit hacky.

https://github.com/llvm/llvm-project/pull/135710
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to