[PATCH] D122734: [HIP] Fix mangling number for local struct

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 7 20:28:19 PDT 2022

yaxunl added a comment.

In D122734#3437344 <https://reviews.llvm.org/D122734#3437344>, @tra wrote:

> In D122734#3435086 <https://reviews.llvm.org/D122734#3435086>, @yaxunl wrote:
>> This patch takes a similar approach as https://reviews.llvm.org/D69322 has done for lambda. When doing host compilation for CUDA/HIP on Windows with MSVC toolchain, mangling number of lambda always uses Itanium mangling number. In this case, mangling number of local struct types always uses Itanium mangling number. I assume this should be fine as long as it is consistent for all HIP programs.
> I'm fairly sure that the code does what you need it to do for HIP. What I'm not sure is whether it will impact other users.
> I've missed that `getManglingNumber` is part of `MSHIPNumberingContext`, so it is HIP-specific and should not change mangling for non-HIP users.
> Would it make it possible to end up with different mangling for the shared code compiled as regular C++ code and host-side code in HIP sources? E.g. from a common header included in both.

It may cause a template instantiation of host functions to have different mangled names when compiled as HIP program, versus compiled as C++ program.

To avoid that, I need to restrict using of Itanium mangling number for mangling device side names only, then the mangling of host functions will not be affected in HIP programs.



More information about the cfe-commits mailing list