From 9b6d26f8b2e6c7b5d08359561a3fdff225b953c5 Mon Sep 17 00:00:00 2001 From: mshivama Date: Wed, 23 Sep 2020 21:23:50 +0530 Subject: [PATCH] Add missing definitions for class static members The static members __HIP_Coordinates::x, ::y and ::z must be defined outside the class. Otherwise, linker throws `undefined reference error` when these definitions are needed in the HIP application. Change-Id: Iabc09744b478c22e4b13cf9824877ec9cfdd4f7a --- hipamd/include/hip/hcc_detail/hip_runtime.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hipamd/include/hip/hcc_detail/hip_runtime.h b/hipamd/include/hip/hcc_detail/hip_runtime.h index 0e5820a016..0a173bb466 100644 --- a/hipamd/include/hip/hcc_detail/hip_runtime.h +++ b/hipamd/include/hip/hcc_detail/hip_runtime.h @@ -487,6 +487,22 @@ struct __HIP_Coordinates { #endif }; +template +#if !defined(_MSC_VER) +__attribute__((weak)) +#endif +constexpr typename __HIP_Coordinates::X __HIP_Coordinates::x; +template +#if !defined(_MSC_VER) +__attribute__((weak)) +#endif +constexpr typename __HIP_Coordinates::Y __HIP_Coordinates::y; +template +#if !defined(_MSC_VER) +__attribute__((weak)) +#endif +constexpr typename __HIP_Coordinates::Z __HIP_Coordinates::z; + extern "C" __device__ __attribute__((const)) size_t __ockl_get_global_size(uint); inline __device__