[PATCH] D112492: [HIP] Do not use kernel handle for MSVC target

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 1 13:55:19 PDT 2021


tra added a comment.

As phrased the summary would likely be rather confusing for anyone other than you and me.

> Currently Visual Studio 2019 has a linker issue which causes linking error
> when a template kernel is instantiated in different compilation units.

It's not clear what exactly is the issue and what causes it.

> On the other hand, it is unnecessary to prefix kernel stub for MSVC
> target since the host and device compilation uses different mangling
> ABI.

This could use more details on why different mangling matters here. IIRC, on Linux where both host and device use the same mangling and HIP needed a way to tell apart the GPU-side kernels and their host-side stub. Different mangling makes it a non-issue.

> This patch let clang not emit kernel handle for MSVC target to work around the linker issue.

Again, without the back-story the jump from linking error to mangling differences to "let's not emit a handle" does not make much sense.

I'd restructure it along the line of:

- we emit host-side handles to match GPU-side kernels
- the handles cause linking issues on windows because of X/Y/Z.
- handles are not necessary on Windows, because of the different host/device mangling
- no generating the handles avoids the linking issue on Windows.

This prompts the question -- should/could handle generation be improved instead? Having identical behavior on all platforms would arguably be better than a platform-specific workaround.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112492/new/

https://reviews.llvm.org/D112492



More information about the cfe-commits mailing list