Add HIP backend in Thrust's config files
MODIFY
thrust/detail/config/compiler.h
thrust/detail/config/compiler.h
#define THRUST_DEVICE_COMPILER_GCC 2
#define THRUST_DEVICE_COMPILER_NVCC 3
#define THRUST_DEVICE_COMPILER_CLANG 4
+#define THRUST_DEVICE_COMPILER_HCC 5
// figure out which host compiler we're using
// XXX we should move the definition of THRUST_DEPRECATED out of this logic
#if defined(_MSC_VER)
#define THRUST_HOST_COMPILER THRUST_HOST_COMPILER_MSVC
#define THRUST_DEPRECATED __declspec(deprecated)
-#elif defined(__clang__)
+#elif defined(__clang__) || defined(__HCC__)
#define THRUST_HOST_COMPILER THRUST_HOST_COMPILER_CLANG
#define THRUST_DEPRECATED __attribute__ ((deprecated))
#define THRUST_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
#else
#define THRUST_DEVICE_COMPILER THRUST_DEVICE_COMPILER_CLANG
#endif
+#elif defined(__HCC__)
+#define THRUST_DEVICE_COMPILER THRUST_DEVICE_COMPILER_HCC
#else
#define THRUST_DEVICE_COMPILER THRUST_DEVICE_COMPILER_UNKNOWN
#endif

MODIFY
thrust/detail/config/device_system.h
thrust/detail/config/device_system.h
#define THRUST_DEVICE_SYSTEM_OMP 2
#define THRUST_DEVICE_SYSTEM_TBB 3
#define THRUST_DEVICE_SYSTEM_CPP 4
+#define THRUST_DEVICE_SYSTEM_HIP 5
#ifndef THRUST_DEVICE_SYSTEM
#define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_CUDA
+// #define THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_HIP
#endif // THRUST_DEVICE_SYSTEM
// XXX make the use of THRUST_DEVICE_BACKEND an error in Thrust 1.7
#define THRUST_DEVICE_BACKEND_CUDA THRUST_DEVICE_SYSTEM_CUDA
#define THRUST_DEVICE_BACKEND_OMP THRUST_DEVICE_SYSTEM_OMP
#define THRUST_DEVICE_BACKEND_TBB THRUST_DEVICE_SYSTEM_TBB
+#define THRUST_DEVICE_BACKEND_HIP THRUST_DEVICE_SYSTEM_HIP
#ifdef THRUST_DEVICE_BACKEND
# if THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC
#define __THRUST_DEVICE_SYSTEM_NAMESPACE tbb
#elif THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CPP
#define __THRUST_DEVICE_SYSTEM_NAMESPACE cpp
+#elif THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_HIP
+#define __THRUST_DEVICE_SYSTEM_NAMESPACE hip
#endif
#define __THRUST_DEVICE_SYSTEM_ROOT thrust/system/__THRUST_DEVICE_SYSTEM_NAMESPACE

MODIFY
thrust/detail/config/forceinline.h
thrust/detail/config/forceinline.h
#define __thrust_forceinline__ __forceinline__
+#elif defined(__HCC__)
+
+// STREAMHPC Should we add static?
+#define __thrust_forceinline__ __forceinline__
+
#else
// TODO add

MODIFY
thrust/detail/config/host_device.h
thrust/detail/config/host_device.h
// and only nvcc knows what to do with __host__ and __device__,
// define them to be the empty string for other compilers
-#if THRUST_DEVICE_COMPILER != THRUST_DEVICE_COMPILER_NVCC
+#if (THRUST_DEVICE_COMPILER != THRUST_DEVICE_COMPILER_NVCC) && (THRUST_DEVICE_COMPILER != THRUST_DEVICE_COMPILER_HCC)
// since __host__ & __device__ might have already be defined, only
// #define them if not defined already

Add HIP backend in Thrust's config files