[PATCH] D105221: [openmp][nfc] Simplify macros guarding math complex headers

Jon Chesterfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 8 06:26:55 PDT 2021


JonChesterfield added a comment.

I think the openmp_wrappers are only used when compiling device code, which would explain why setting a macro in one of them is a proxy for detecting compilation for the device.

Attempting to verify that, it looks like:
trunk-nvptx includes openmp_wrappers on device code only
trunk-amdgcn never includes openmp_wrappers
aomp-amdgcn includes openmp_wrappers on device code and cuda_wrappers on host code

in which case `#define __OPENMP_NVPTX` from an openmp_wrapper is equivalent to defining __OPENMP_NVPTX when compiling for the target and not for the host.

This seems fragile. How about we #define _OPENMP_HOST when compiling openmp for the host, and _OPENMP_TARGET when compiling openmp for the device? Do that from clang directly, not from a header which is only sometimes included. For one thing, we may want wrapper headers like these for the openmp host at some point.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105221



More information about the cfe-commits mailing list