From 9f072b50baec6f9708361888bc14c9dbf70c1093 Mon Sep 17 00:00:00 2001 From: amdsc21 <96135754+amdsc21@users.noreply.github.com> Date: Fri, 10 Mar 2023 17:14:31 +0100 Subject: [PATCH] fix __popc --- include/xgboost/linalg.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/xgboost/linalg.h b/include/xgboost/linalg.h index b1504bf01..91aeb189c 100644 --- a/include/xgboost/linalg.h +++ b/include/xgboost/linalg.h @@ -134,9 +134,9 @@ int32_t NativePopc(T v) { } inline LINALG_HD int Popc(uint32_t v) { -#if defined(__CUDA_ARCH__) || defined(__HIP_PLATFORM_AMD__) +#if defined(__CUDA_ARCH__) return __popc(v); -#elif defined(__GNUC__) || defined(__clang__) +#elif defined(__GNUC__) || defined(__clang__) || defined(__HIP_PLATFORM_AMD__) return __builtin_popcount(v); #elif defined(_MSC_VER) return __popcnt(v); @@ -146,9 +146,9 @@ inline LINALG_HD int Popc(uint32_t v) { } inline LINALG_HD int Popc(uint64_t v) { -#if defined(__CUDA_ARCH__) || defined(__HIP_PLATFORM_AMD__) +#if defined(__CUDA_ARCH__) return __popcll(v); -#elif defined(__GNUC__) || defined(__clang__) +#elif defined(__GNUC__) || defined(__clang__) || defined(__HIP_PLATFORM_AMD__) return __builtin_popcountll(v); #elif defined(_MSC_VER) && _defined(_M_X64) return __popcnt64(v);