use __HIPCC__ for device code
This commit is contained in:
@@ -58,19 +58,19 @@
|
||||
/*!
|
||||
* \brief Tag function as usable by device
|
||||
*/
|
||||
#if defined (__CUDA__) || defined(__NVCC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined (__CUDA__) || defined(__NVCC__) || defined(__HIPCC__)
|
||||
#define XGBOOST_DEVICE __host__ __device__
|
||||
#else
|
||||
#define XGBOOST_DEVICE
|
||||
#endif // defined (__CUDA__) || defined(__NVCC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#endif // defined (__CUDA__) || defined(__NVCC__) || defined(__HIPCC__)
|
||||
|
||||
#if defined(__CUDA__) || defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDA__) || defined(__CUDACC__) || defined(__HIPCC__)
|
||||
#define XGBOOST_HOST_DEV_INLINE XGBOOST_DEVICE __forceinline__
|
||||
#define XGBOOST_DEV_INLINE __device__ __forceinline__
|
||||
#else
|
||||
#define XGBOOST_HOST_DEV_INLINE
|
||||
#define XGBOOST_DEV_INLINE
|
||||
#endif // defined(__CUDA__) || defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#endif // defined(__CUDA__) || defined(__CUDACC__) || defined(__HIPCC__)
|
||||
|
||||
// These check are for Makefile.
|
||||
#if !defined(XGBOOST_MM_PREFETCH_PRESENT) && !defined(XGBOOST_BUILTIN_PREFETCH_PRESENT)
|
||||
|
||||
@@ -58,11 +58,11 @@
|
||||
|
||||
namespace xgboost {
|
||||
|
||||
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDACC__) || defined(__HIPCC__)
|
||||
// Sets a function to call instead of cudaSetDevice();
|
||||
// only added for testing
|
||||
void SetCudaSetDeviceHandler(void (*handler)(int));
|
||||
#endif // __CUDACC__ || __HIP_PLATFORM_AMD__
|
||||
#endif // __CUDACC__ || __HIPCC__
|
||||
|
||||
template <typename T> struct HostDeviceVectorImpl;
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
|
||||
// decouple it from xgboost.
|
||||
#ifndef LINALG_HD
|
||||
#if defined(__CUDA__) || defined(__NVCC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDA__) || defined(__NVCC__) || defined(__HIPCC__)
|
||||
#define LINALG_HD __host__ __device__
|
||||
#else
|
||||
#define LINALG_HD
|
||||
#endif // defined (__CUDA__) || defined(__NVCC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#endif // defined (__CUDA__) || defined(__NVCC__) || defined(__HIPCC__)
|
||||
#endif // LINALG_HD
|
||||
|
||||
namespace xgboost::linalg {
|
||||
@@ -118,7 +118,7 @@ using IndexToTag = std::conditional_t<std::is_integral<RemoveCRType<S>>::value,
|
||||
|
||||
template <int32_t n, typename Fn>
|
||||
LINALG_HD constexpr auto UnrollLoop(Fn fn) {
|
||||
#if defined(__CUDA_ARCH__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDA_ARCH__) || defined(__HIPCC__)
|
||||
#pragma unroll n
|
||||
#endif // defined __CUDA_ARCH__
|
||||
for (int32_t i = 0; i < n; ++i) {
|
||||
@@ -136,7 +136,7 @@ int32_t NativePopc(T v) {
|
||||
inline LINALG_HD int Popc(uint32_t v) {
|
||||
#if defined(__CUDA_ARCH__)
|
||||
return __popc(v);
|
||||
#elif defined(__GNUC__) || defined(__clang__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#elif defined(__GNUC__) || defined(__clang__) || defined(__HIPCC__)
|
||||
return __builtin_popcount(v);
|
||||
#elif defined(_MSC_VER)
|
||||
return __popcnt(v);
|
||||
@@ -148,7 +148,7 @@ inline LINALG_HD int Popc(uint32_t v) {
|
||||
inline LINALG_HD int Popc(uint64_t v) {
|
||||
#if defined(__CUDA_ARCH__)
|
||||
return __popcll(v);
|
||||
#elif defined(__GNUC__) || defined(__clang__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#elif defined(__GNUC__) || defined(__clang__) || defined(__HIPCC__)
|
||||
return __builtin_popcountll(v);
|
||||
#elif defined(_MSC_VER) && defined(_M_X64)
|
||||
return __popcnt64(v);
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
#if defined(__CUDACC__)
|
||||
#include <cuda_runtime.h>
|
||||
#elif defined(__HIP_PLATFORM_AMD__)
|
||||
#elif defined(__HIPCC__)
|
||||
#include <hip/hip_runtime.h>
|
||||
#endif
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace common {
|
||||
|
||||
#define SPAN_CHECK KERNEL_CHECK
|
||||
|
||||
#elif defined(__HIP_PLATFORM_AMD__)
|
||||
#elif defined(__HIPCC__)
|
||||
// Usual logging facility is not available inside device code.
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
@@ -157,7 +157,7 @@ namespace common {
|
||||
|
||||
#endif // defined(XGBOOST_STRICT_R_MODE)
|
||||
|
||||
#endif // __CUDA_ARCH__ || __HIP_PLATFORM_AMD__
|
||||
#endif // __CUDA_ARCH__ || __HIPCC__
|
||||
|
||||
#define SPAN_LT(lhs, rhs) SPAN_CHECK((lhs) < (rhs))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user