[libclc] [libclc] Create an internal 'clc' builtins library (PR #109985)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 06:55:51 PDT 2024


frasercrmck wrote:

> > CC @rjodinchr. I realise now that this idea may prove problematic for `clspv`/`clspv64` targets. If this idea were to taken further, things like OpenCL `minmag` would call `__clc_minmag` which would call `__clc_fabs` (e.g.), but I notice `fabs` is not implemented in `clspv*` libclc and it's left as external declarations. What exactly is happening with clspv libclc builtins? Same question for conversions, etc.
> 
> `clspv` has a native support for `fabs`, it does not need libclc to define that function. But as I understand that change, maybe `clspv` will need to add alias for some `__clc_<something>`, but it should not be a big issue I believe.

Thanks for the quick reply! It makes sense why you don't need certain symbols. Glad to hear you don't think it'll be a problem.

I'm still not sure how I feel about going from OpenCL to the CLC layer then "back" to OpenCL again, though. I wonder if a system of macros would help obscure this somehow (`#define __clc_fabs fabs` for clspv). I can't say I'm jumping at the chance to introduce more preprocessor logic though.

https://github.com/llvm/llvm-project/pull/109985


More information about the cfe-commits mailing list