Skip to content

Commit 4e1da8d

Browse files
Rbiessyqnixsynapse
authored andcommitted
ggml-cpu: sycl: Re-enable exp f16 (ggml-org#14462)
1 parent c2eff62 commit 4e1da8d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ggml/src/ggml-cpu/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,4 +589,9 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
589589
if (EMSCRIPTEN)
590590
set_target_properties(${GGML_CPU_NAME} PROPERTIES COMPILE_FLAGS "-msimd128")
591591
endif()
592+
593+
if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
594+
# The compiler automatically enables "-ffast-math" which can cause NaNs in tests due to "-fassociative-math"
595+
target_compile_options(${GGML_CPU_NAME} PRIVATE "-fno-associative-math")
596+
endif()
592597
endfunction()

ggml/src/ggml-sycl/ggml-sycl.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4221,6 +4221,7 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const g
42214221
case GGML_UNARY_OP_GELU_QUICK:
42224222
case GGML_UNARY_OP_GELU_ERF:
42234223
case GGML_UNARY_OP_TANH:
4224+
case GGML_UNARY_OP_EXP:
42244225
case GGML_UNARY_OP_SGN:
42254226
case GGML_UNARY_OP_ABS:
42264227
case GGML_UNARY_OP_ELU:
@@ -4229,9 +4230,6 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const g
42294230
#else
42304231
return ggml_is_contiguous(op->src[0]) && (op->src[0]->type == GGML_TYPE_F32 && op->type == GGML_TYPE_F32) && (op->type == op->src[0]->type);
42314232
#endif
4232-
case GGML_UNARY_OP_EXP:
4233-
// Disable FP16 until we find out the root cause of failing fp16 sycl::exp
4234-
return ggml_is_contiguous(op->src[0]) && (op->type == op->src[0]->type) && op->src[0]->type == GGML_TYPE_F32;
42354233
default:
42364234
return false;
42374235
}

0 commit comments

Comments
 (0)