[PATCH] D73942: [hip] Properly populate macros based on host processor.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 10:58:44 PST 2020


hliao added a comment.

In D73942#1857384 <https://reviews.llvm.org/D73942#1857384>, @tra wrote:

> On one hand the change makes sense to me and fits well with what we've done so far.
>  On the other hand, I worry that this is likely to break things.
>  We sort of have been implicitly relying on not having the macros related to advanced CPU features enabled on device side which typically results in device-side compilation seeing a more portable/simpler version of the code.
>  Defining the macros that enable more host-side CPU-specific code may trigger interesting compatibility features. Postponed diagnostics combined with `ignore (some) errors in the wrong-side-only code` should probably deal with most of them, but I suspect we'll see new interesting failure cases. We would not know until we try.
>
> I would be more comfortable if we could have an option to disable this functionality with a command line option, at least temporarily. If things break, the option will avoid turning it into an emergency. If my concern turns out to be false, we can remove the option later.


sure, I would try to add option to control that. This patch is developed to fix a real issue found on HIP with MSVC without additional CPU settings, like `-msse3`. Look into the header `lib/Headers/x86intrin.h` in clang. The including of intrinsic headers is controlled by the pre-defined macros for MSVC compilation. If that macros are not defined correctly, the host code in device-compilation may trigger issues on missing prototypes or something else.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73942





More information about the cfe-commits mailing list