Skip to content

Commit a7417f5

Browse files
authored
ggml-cpu: sycl: Re-enable exp f16 (#14462)
1 parent eb3fa29 commit a7417f5

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
@@ -4215,6 +4215,7 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const g
42154215
case GGML_UNARY_OP_GELU_QUICK:
42164216
case GGML_UNARY_OP_GELU_ERF:
42174217
case GGML_UNARY_OP_TANH:
4218+
case GGML_UNARY_OP_EXP:
42184219
case GGML_UNARY_OP_SGN:
42194220
case GGML_UNARY_OP_ABS:
42204221
case GGML_UNARY_OP_ELU:
@@ -4223,9 +4224,6 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const g
42234224
#else
42244225
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);
42254226
#endif
4226-
case GGML_UNARY_OP_EXP:
4227-
// Disable FP16 until we find out the root cause of failing fp16 sycl::exp
4228-
return ggml_is_contiguous(op->src[0]) && (op->type == op->src[0]->type) && op->src[0]->type == GGML_TYPE_F32;
42294227
default:
42304228
return false;
42314229
}

0 commit comments

Comments
 (0)