Skip to content

Commit 804a3e9

Browse files
Highwaycopybara-github
Highway
authored andcommitted
Enable FP16 when compiling for IMG GPUs
PiperOrigin-RevId: 736573845
1 parent 5c80e6f commit 804a3e9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hwy/base.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,8 @@ HWY_API HWY_BITCASTSCALAR_CONSTEXPR To BitCastScalar(const From& val) {
11251125

11261126
#ifndef HWY_HAVE_SCALAR_F16_TYPE
11271127
// Compiler supports _Float16, not necessarily with operators.
1128-
#if HWY_NEON_HAVE_F16C || HWY_RVV_HAVE_F16_VEC || HWY_SSE2_HAVE_F16_TYPE
1128+
#if HWY_NEON_HAVE_F16C || HWY_RVV_HAVE_F16_VEC || HWY_SSE2_HAVE_F16_TYPE || \
1129+
__SPIRV_DEVICE__
11291130
#define HWY_HAVE_SCALAR_F16_TYPE 1
11301131
#else
11311132
#define HWY_HAVE_SCALAR_F16_TYPE 0
@@ -1177,7 +1178,7 @@ using NativeSpecialFloatToWrapper =
11771178
// are generated regardless of F16 support; see #1684.
11781179
struct alignas(2) float16_t {
11791180
#if HWY_HAVE_SCALAR_F16_TYPE
1180-
#if HWY_RVV_HAVE_F16_VEC || HWY_SSE2_HAVE_F16_TYPE
1181+
#if HWY_RVV_HAVE_F16_VEC || HWY_SSE2_HAVE_F16_TYPE || __SPIRV_DEVICE__
11811182
using Native = _Float16;
11821183
#elif HWY_NEON_HAVE_F16C
11831184
using Native = __fp16;

0 commit comments

Comments
 (0)