123123#if defined(__HIPCC_RTC__)
124124#define __BF16_HOST_DEVICE__ __BF16_DEVICE__
125125#else
126- #include < algorithm>
127126#include < climits>
128127#include < cmath>
129128#define __BF16_HOST_DEVICE__ __host__ __BF16_DEVICE__
@@ -215,7 +214,7 @@ struct __attribute__((aligned(2))) __hip_bfloat16 {
215214 __BF16_HOST_DEVICE__ __hip_bfloat16 (const float val) : __x_bf16 (static_cast <__bf16>(val)) {}
216215
217216 /* ! \brief create __hip_bfloat16 from a __hip_bfloat16_raw */
218- __BF16_HOST_DEVICE__ __hip_bfloat16 (const __hip_bfloat16_raw& val) : __x (val.x ) {}
217+ __BF16_HOST_DEVICE__ constexpr __hip_bfloat16 (const __hip_bfloat16_raw& val) : __x (val.x ) {}
219218
220219 /* ! \brief create __hip_bfloat16 from __bf16 */
221220 __BF16_HOST_DEVICE__ __hip_bfloat16 (const __bf16 val) : __x_bf16 (val) {}
@@ -232,7 +231,7 @@ struct __attribute__((aligned(2))) __hip_bfloat16 {
232231 }
233232
234233 /* ! \brief return false if bfloat value is +0.0 or -0.0, returns true otherwise */
235- __BF16_HOST_DEVICE__ operator bool () const { return __x_bf16 != 0 .0f ; }
234+ __BF16_HOST_DEVICE__ constexpr operator bool () const { return __x_bf16 != 0 .0f ; }
236235
237236 /* ! \brief return a casted char from underlying float val */
238237 __BF16_HOST_DEVICE__ operator char () const { return static_cast <char >(__x_bf16); }
@@ -370,7 +369,7 @@ struct __attribute__((aligned(4))) __hip_bfloat162 {
370369 __BF16_HOST_DEVICE__ __hip_bfloat162 (const __hip_bfloat162& val) : x (val.x ), y (val.y ) {}
371370
372371 /* ! \brief create __hip_bfloat162 from two __hip_bfloat16 */
373- __BF16_HOST_DEVICE__ __hip_bfloat162 (const __hip_bfloat16& a, const __hip_bfloat16& b)
372+ __BF16_HOST_DEVICE__ constexpr __hip_bfloat162 (const __hip_bfloat16& a, const __hip_bfloat16& b)
374373 : x (a), y (b) {}
375374
376375 /* ! \brief create __hip_bfloat162 from vector of __bf16_2 */
0 commit comments