[PATCH] D56318: [HIP] Fix size_t for MSVC environment

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 4 11:30:07 PST 2019


yaxunl added a comment.

In D56318#1346693 <https://reviews.llvm.org/D56318#1346693>, @rjmccall wrote:

> No, no, I understand that you're not changing pointer sizes, but this is one example of trying to match the ABI of the target environment, and I'm trying to understand how far that goes.  What does it mean to be in the "MSVC" environment when you're actually just compiling for the GPU?  Why are you using OS headers in the first place?  Do you need struct layout to match MSVC (presumably on x86-64)?  What should happen with the C++ ABI?


HIP is single source program. The same source code is compiled for both host and device. Since HIP is an extension to C++, it uses the C++ header files of the system. This is true for both host code and device code. On linux, both uses gcc header files. On windows, when MSVC is installed and default target environment is MSVC, the host compilation will use MSVC header files, so does the device compilation. For device compilation, most of the stuff in MSVC headers do not matter, e.g. function declarations, since they are for host. What matters are mostly type definitions. They should be consistent for both device and host. Since MSVC supports C++11, it should work. As an example, CUDA SDK supports MSVC.


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

https://reviews.llvm.org/D56318





More information about the cfe-commits mailing list