Romain Biessy commited on
Commit
c0fcd7a
·
1 Parent(s): 6b59b68

ggml-cpu: sycl: Re-enable exp f16 (llama/14462)

Browse files
ggml/src/ggml-cpu/CMakeLists.txt CHANGED
@@ -589,4 +589,9 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
589
  if (EMSCRIPTEN)
590
  set_target_properties(${GGML_CPU_NAME} PROPERTIES COMPILE_FLAGS "-msimd128")
591
  endif()
 
 
 
 
 
592
  endfunction()
 
589
  if (EMSCRIPTEN)
590
  set_target_properties(${GGML_CPU_NAME} PROPERTIES COMPILE_FLAGS "-msimd128")
591
  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()
597
  endfunction()
ggml/src/ggml-sycl/ggml-sycl.cpp CHANGED
@@ -4215,6 +4215,7 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const g
4215
  case GGML_UNARY_OP_GELU_QUICK:
4216
  case GGML_UNARY_OP_GELU_ERF:
4217
  case GGML_UNARY_OP_TANH:
 
4218
  case GGML_UNARY_OP_SGN:
4219
  case GGML_UNARY_OP_ABS:
4220
  case GGML_UNARY_OP_ELU:
@@ -4223,9 +4224,6 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const g
4223
  #else
4224
  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);
4225
  #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;
4229
  default:
4230
  return false;
4231
  }
 
4215
  case GGML_UNARY_OP_GELU_QUICK:
4216
  case GGML_UNARY_OP_GELU_ERF:
4217
  case GGML_UNARY_OP_TANH:
4218
+ case GGML_UNARY_OP_EXP:
4219
  case GGML_UNARY_OP_SGN:
4220
  case GGML_UNARY_OP_ABS:
4221
  case GGML_UNARY_OP_ELU:
 
4224
  #else
4225
  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);
4226
  #endif
 
 
 
4227
  default:
4228
  return false;
4229
  }