Skip to content

[SYCL] [HIP] __CUDA_ARCH__ defined when compiling for HIP backend #7720

Closed
@AuroraPerego

Description

@AuroraPerego

Describe the bug
I noticed that __CUDA_ARCH__ is defined when compiling ahead of time for the HIP backend.
I don't know if this is wanted, but for example using Eigen I get an error because it tries to include CUDA libraries (the workaround here is to define EIGEN_NO_CUDA).

As an example, compiling a file that just includes the Eigen library gives this:

In file included from include_eigen.cpp:3:
In file included from eigen/Eigen/Core:160:
eigen/Eigen/src/Core/util/Meta.h:21:12: fatal error: 'math_constants.h' file not found
  #include <math_constants.h>
           ^~~~~~~~~~~~~~~~~~

To Reproduce

$ clang++ -fsycl -std=c++17 dummy.cpp -dM -E  -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx900 --rocm-path=/opt/rocm-5.0.2 | grep CUDA_ARCH
#define __CUDA_ARCH__ 1

where dummy.cpp is just

#include <CL/sycl.hpp>

int main(){
    return 0;
}

Environment (please complete the following information):

  • OS: Linux
  • Target device and vendor: AMD GPU Radeon PRO WX 9100
  • clang version: 16.0.0 (https://github.com/intel/llvm 0f579ba)
    release 2022-09 (but it tried also with the sycl-nightly/20221208 and the behaviour is the same)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghipIssues related to execution on HIP backend.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions