From 75fda6da3d3a17fc1024c319bb56ef060d1758ca 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 [ROCm/hip commit: b8640f1f0d7f3458123f67d7edfdd92546d280b9] --- .../hip/include/hip/hcc_detail/hip_runtime.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/projects/hip/include/hip/hcc_detail/hip_runtime.h b/projects/hip/include/hip/hcc_detail/hip_runtime.h index 0e5820a016..0a173bb466 100644 --- a/projects/hip/include/hip/hcc_detail/hip_runtime.h +++ b/projects/hip/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__