================
@@ -0,0 +1,21 @@
+#ifndef __CLC_INTEGER_CLC_CLZ_H__
+#define __CLC_INTEGER_CLC_CLZ_H__
+
+#if defined(CLC_CLSPV) || defined(CLC_SPIRV)
+// clspv and spir-v targets provide their own OpenCL-compatible clz
+#define __clc_clz clz
----------------
frasercrmck wrote:

> > In this context of this PR, what are you proposing? That no such 
> > redirections should take place, or just that ones that map to intrinsics 
> > specifically should not be redirected?
> 
> I mean __clc_ functions should not be implemented by directly calling the 
> opencl public name, that's backwards. Targets should be implementing __clc 
> override implementations, not directly providing their own opencl public 
> entrypoints. It sounds like that's the end goal, not sure how this step gets 
> you there though. I won't hold this up if it's in service of reaching that end

Yep, I think we agree on the direction of this aspect of libclc. Regardless, 
this is how it's currently done for the SPIR-V targets. I would prefer if 
SPIR-V targets built a fully complete OpenCL library, and that they would 
selectively link which OpenCL builtins they want from libclc and which they 
want to override or optimize themselves.

Personally, I'm hesitant to make too many changes that affect the downstream 
SPIR-V targets at the same time as refactoring the library in such an intrusive 
way. This macro header redirection is a convenient way of keeping things the 
same for them, whilst clearing away the noise that might obscure real codegen 
issues.

As mentioned above, it sounds like we can improve the SPIR-V situation for most 
`__clc` functions. In general I'd prefer to loop back to that sort of thing 
once the refactoring is complete. Then we can test (and commit, revert, 
whatever) those changes in isolation. We're not backing ourselves into a corner 
with the macro redirections.

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

Reply via email to