[PATCH] D36831: [AMDGPU] Transform __read_pipe_* and __write_pipe_*

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 10:23:28 PDT 2017


yaxunl marked 5 inline comments as done.
yaxunl added a comment.

In https://reviews.llvm.org/D36831#848830, @rampitec wrote:

> In https://reviews.llvm.org/D36831#848827, @yaxunl wrote:
>
> > Clang does not emit mangled functions for pipe builtin functions. Instead, it emits unmangled functions e.g. __read_pipe_*. These functions are not overloaded and will be implemented by device library.
> >
> > The original implementation of AMDGPULibFunc assumes all library functions have mangled name. It extracts function argument information based on the mangled function name and use it to implement getOrInsertFunction.
> >
> > For unmangled library functions, those functions regarding mangling or function parameter info are either irrelevant or useless. Those functions are needed for mangled functions because the mangling requires such information.
> >
> > Therefore I subclass AMDGPULibFunc as AMDGPUMangledLibFunc and AMDGPUUnmangledLibFunc and move all the stuff needed for mangling to AMDGPUMangledLibFunc.
> >
> > For AMDGPUUnmangledLibFunc, since there is no argument type information from mangling, AMDGPULibFunc::getOrInsertFunction cannot be implemented. There is no special trick about identifying whether it is prelink or not in the original implementation. Just checks whether the function is declaration or not. I see no point of implementing a special getOrInsertFunction for AMDGPUUnmangledLibFunc.
>
>
> What about EI_READ_PIPE? Is it mangled? Shall it be removed?
>
> Whatever you subclass all the changes shall be contained within AMDGPULibFunc and not in its clients. If some of the arguments on FuncInfo are unused in this case that is fine. You can also check the former implementation from HSAIL which was also handling EDG style magling (unmagled in therms you are using here).
>
> All in all that is only legal to do it on prelink, and that is exactly what getFunction() does.


For pipe functions, clang currently does not do any mangling at all. It is not like the EDG style mangling.

As I said, getFunction() requires function argument information, which is not available for unmangled functions. To implement getFunction() requires providing argument information for unmangled functions, which is time consuming and also useless.


https://reviews.llvm.org/D36831





More information about the llvm-commits mailing list