LLM inference in C/C++
C++ ggml
[SYCL] Support OP EXPM1, support all UT cases of FLOOR, TRUNC, ROUND (#24363)
Neo Zhangfdd109883df9
diff --git a/docs/ops.md b/docs/ops.mdindex 4896533d92..fe74df805e 100644--- a/docs/ops.md+++ b/docs/ops.md@@ -44,10 +44,10 @@ Legend:| DUP | ❌ | ✅ | ✅ | 🟡 | 🟡 | 🟡 | ✅ | ✅ | ❌ | ❌ | ❌ || ELU | ❌ | ✅ | ✅ | 🟡 | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ || EXP | ❌ | ✅ | ✅ | 🟡 | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ |-| EXPM1 | ❌ | ❌ | ✅ | 🟡 | ✅ | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ |+| EXPM1 | ❌ | ❌ | ✅ | 🟡 | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ || FILL | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ || FLASH_ATTN_EXT | ❌ | 🟡 | ✅ | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | ❌ | ❌ |-| FLOOR | ❌ | ❌ | ✅ | 🟡 | ✅ | ❌ | 🟡 | ✅ | ✅ | ❌ | ❌ |+| FLOOR | ❌ | ❌ | ✅ | 🟡 | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ || GATED_DELTA_NET | ❌ | ❌ | ✅ | ❌ | 🟡 | ❌ | ✅ | 🟡 | ✅ | ❌ | ❌ || GATED_LINEAR_ATTN | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ || GEGLU | ❌ | ✅ | ✅ | ✅ | 🟡 | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |@@ -89,7 +89,7 @@ Legend:| ROLL | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ || ROPE | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ || ROPE_BACK | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ |-| ROUND | ❌ | ❌ | ✅ | 🟡 | ✅ | ❌ | 🟡 | ✅ | ✅ | ❌ | ❌ |+| ROUND | ❌ | ❌ | ✅ | 🟡 | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ || RWKV_WKV6 | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ || RWKV_WKV7 | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | ❌ || SCALE | ❌ | 🟡 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ |@@ -118,6 +118,6 @@ Legend:| TIMESTEP_EMBEDDING | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ || TOP_K | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | 🟡 | 🟡 | ✅ | ❌ | ❌ || TRI | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ |-| TRUNC | ❌ | ❌ | ✅ | 🟡 | ✅ | ❌ | 🟡 | ✅ | ✅ | ❌ | ❌ |+| TRUNC | ❌ | ❌ | ✅ | 🟡 | ✅ | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ || UPSCALE | ❌ | 🟡 | ✅ | ✅ | ✅ | 🟡 | ✅ | ✅ | ✅ | ❌ | ❌ || XIELU | ❌ | ❌ | ✅ | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ |diff --git a/docs/ops/SYCL.csv b/docs/ops/SYCL.csvindex 2c851aaa12..9ff664a5bf 100644--- a/docs/ops/SYCL.csv+++ b/docs/ops/SYCL.csv@@ -27,20 +27,20 @@"SYCL0","HARDSIGMOID","type=f16,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL""SYCL0","EXP","type=f16,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL""SYCL0","EXP","type=f16,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL"-"SYCL0","EXPM1","type=f16,ne_a=[128,2,2,2],v=0","support","0","no","SYCL"-"SYCL0","EXPM1","type=f16,ne_a=[5,7,11,13],v=0","support","0","no","SYCL"+"SYCL0","EXPM1","type=f16,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL"+"SYCL0","EXPM1","type=f16,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL""SYCL0","SOFTPLUS","type=f16,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL""SYCL0","SOFTPLUS","type=f16,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL""SYCL0","GELU_ERF","type=f16,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL""SYCL0","GELU_ERF","type=f16,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL"-"SYCL0","FLOOR","type=f16,ne_a=[128,2,2,2],v=0","support","0","no","SYCL"-"SYCL0","FLOOR","type=f16,ne_a=[5,7,11,13],v=0","support","0","no","SYCL"+"SYCL0","FLOOR","type=f16,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL"+"SYCL0","FLOOR","type=f16,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL""SYCL0","CEIL","type=f16,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL""SYCL0","CEIL","type=f16,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL"-"SYCL0","ROUND","type=f16,ne_a=[128,2,2,2],v=0","support","0","no","SYCL"-"SYCL0","ROUND","type=f16,ne_a=[5,7,11,13],v=0","support","0","no","SYCL"-"SYCL0","TRUNC","type=f16,ne_a=[128,2,2,2],v=0","support","0","no","SYCL"-"SYCL0","TRUNC","type=f16,ne_a=[5,7,11,13],v=0","support","0","no","SYCL"+"SYCL0","ROUND","type=f16,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL"+"SYCL0","ROUND","type=f16,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL"+"SYCL0","TRUNC","type=f16,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL"+"SYCL0","TRUNC","type=f16,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL""SYCL0","ABS","type=f16,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL""SYCL0","ABS","type=f16,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","SGN","type=f16,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL"@@ -69,20 +69,20 @@"SYCL0","HARDSIGMOID","type=f16,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","EXP","type=f16,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL""SYCL0","EXP","type=f16,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL"-"SYCL0","EXPM1","type=f16,ne_a=[128,2,2,2],v=1","support","0","no","SYCL"-"SYCL0","EXPM1","type=f16,ne_a=[5,7,11,13],v=1","support","0","no","SYCL"+"SYCL0","EXPM1","type=f16,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL"+"SYCL0","EXPM1","type=f16,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","SOFTPLUS","type=f16,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL""SYCL0","SOFTPLUS","type=f16,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","GELU_ERF","type=f16,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL""SYCL0","GELU_ERF","type=f16,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL"-"SYCL0","FLOOR","type=f16,ne_a=[128,2,2,2],v=1","support","0","no","SYCL"-"SYCL0","FLOOR","type=f16,ne_a=[5,7,11,13],v=1","support","0","no","SYCL"+"SYCL0","FLOOR","type=f16,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL"+"SYCL0","FLOOR","type=f16,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","CEIL","type=f16,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL""SYCL0","CEIL","type=f16,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL"-"SYCL0","ROUND","type=f16,ne_a=[128,2,2,2],v=1","support","0","no","SYCL"-"SYCL0","ROUND","type=f16,ne_a=[5,7,11,13],v=1","support","0","no","SYCL"-"SYCL0","TRUNC","type=f16,ne_a=[128,2,2,2],v=1","support","0","no","SYCL"-"SYCL0","TRUNC","type=f16,ne_a=[5,7,11,13],v=1","support","0","no","SYCL"+"SYCL0","ROUND","type=f16,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL"+"SYCL0","ROUND","type=f16,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL"+"SYCL0","TRUNC","type=f16,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL"+"SYCL0","TRUNC","type=f16,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","ABS","type=f32,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL""SYCL0","ABS","type=f32,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL""SYCL0","SGN","type=f32,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL"@@ -111,8 +111,8 @@"SYCL0","HARDSIGMOID","type=f32,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL""SYCL0","EXP","type=f32,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL""SYCL0","EXP","type=f32,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL"-"SYCL0","EXPM1","type=f32,ne_a=[128,2,2,2],v=0","support","0","no","SYCL"-"SYCL0","EXPM1","type=f32,ne_a=[5,7,11,13],v=0","support","0","no","SYCL"+"SYCL0","EXPM1","type=f32,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL"+"SYCL0","EXPM1","type=f32,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL""SYCL0","SOFTPLUS","type=f32,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL""SYCL0","SOFTPLUS","type=f32,ne_a=[5,7,11,13],v=0","support","1","yes","SYCL""SYCL0","GELU_ERF","type=f32,ne_a=[128,2,2,2],v=0","support","1","yes","SYCL"@@ -153,20 +153,20 @@"SYCL0","HARDSIGMOID","type=f32,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","EXP","type=f32,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL""SYCL0","EXP","type=f32,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL"-"SYCL0","EXPM1","type=f32,ne_a=[128,2,2,2],v=1","support","0","no","SYCL"-"SYCL0","EXPM1","type=f32,ne_a=[5,7,11,13],v=1","support","0","no","SYCL"+"SYCL0","EXPM1","type=f32,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL"+"SYCL0","EXPM1","type=f32,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","SOFTPLUS","type=f32,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL""SYCL0","SOFTPLUS","type=f32,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","GELU_ERF","type=f32,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL""SYCL0","GELU_ERF","type=f32,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL"-"SYCL0","FLOOR","type=f32,ne_a=[128,2,2,2],v=1","support","0","no","SYCL"-"SYCL0","FLOOR","type=f32,ne_a=[5,7,11,13],v=1","support","0","no","SYCL"+"SYCL0","FLOOR","type=f32,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL"+"SYCL0","FLOOR","type=f32,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","CEIL","type=f32,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL""SYCL0","CEIL","type=f32,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL"-"SYCL0","ROUND","type=f32,ne_a=[128,2,2,2],v=1","support","0","no","SYCL"-"SYCL0","ROUND","type=f32,ne_a=[5,7,11,13],v=1","support","0","no","SYCL"-"SYCL0","TRUNC","type=f32,ne_a=[128,2,2,2],v=1","support","0","no","SYCL"-"SYCL0","TRUNC","type=f32,ne_a=[5,7,11,13],v=1","support","0","no","SYCL"+"SYCL0","ROUND","type=f32,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL"+"SYCL0","ROUND","type=f32,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL"+"SYCL0","TRUNC","type=f32,ne_a=[128,2,2,2],v=1","support","1","yes","SYCL"+"SYCL0","TRUNC","type=f32,ne_a=[5,7,11,13],v=1","support","1","yes","SYCL""SYCL0","REGLU","type=f16,ne_a=[128,2,2,2],v=0,swapped=0","support","1","yes","SYCL""SYCL0","REGLU","type=f16,ne_a=[5,7,11,13],v=0,swapped=0","support","1","yes","SYCL""SYCL0","REGLU","type=f16,ne_a=[128,2,2,2],v=0,swapped=1","support","1","yes","SYCL"@@ -5105,6 +5105,7 @@"SYCL0","REPEAT","type=f32,ne=[10,5,4,1],nr=[1,1,1,2]","support","1","yes","SYCL""SYCL0","REPEAT","type=i32,ne=[10,5,4,1],nr=[2,1,1,1]","support","1","yes","SYCL""SYCL0","REPEAT","type=i16,ne=[10,5,4,1],nr=[1,1,1,2]","support","1","yes","SYCL"+"SYCL0","REPEAT","type=bf16,ne=[10,5,4,1],nr=[2,1,1,1]","support","1","yes","SYCL""SYCL0","REPEAT","type=f32,ne=[10,5,4,3],nr=[1,1,1,1]","support","1","yes","SYCL""SYCL0","REPEAT","type=f32,ne=[10,5,4,3],nr=[2,1,1,1]","support","1","yes","SYCL""SYCL0","REPEAT","type=f32,ne=[10,5,4,3],nr=[1,2,1,1]","support","1","yes","SYCL"@@ -5112,6 +5113,7 @@"SYCL0","REPEAT","type=f32,ne=[10,5,4,3],nr=[1,1,1,2]","support","1","yes","SYCL""SYCL0","REPEAT","type=i32,ne=[10,5,4,3],nr=[2,1,1,1]","support","1","yes","SYCL""SYCL0","REPEAT","type=i16,ne=[10,5,4,3],nr=[1,1,1,2]","support","1","yes","SYCL"+"SYCL0","REPEAT","type=bf16,ne=[10,5,4,3],nr=[2,1,1,1]","support","1","yes","SYCL""SYCL0","REPEAT_BACK","type=f32,ne=[8,6,4,2],nr=[1,1,1,1],v=0","support","1","yes","SYCL""SYCL0","REPEAT_BACK","type=f32,ne=[8,6,4,2],nr=[2,1,1,1],v=0","support","1","yes","SYCL""SYCL0","REPEAT_BACK","type=f32,ne=[8,6,4,2],nr=[1,2,1,1],v=0","support","1","yes","SYCL"@@ -9748,10 +9750,10 @@"SYCL0","COS","type=f16,ne=[10,2,2,2]","support","0","no","SYCL""SYCL0","CLAMP","type=f16,ne=[10,5,4,3],min=-0.500000,max=0.500000","support","0","no","SYCL""SYCL0","LEAKY_RELU","type=f16,ne_a=[10,5,4,3],negative_slope=0.100000","support","1","yes","SYCL"-"SYCL0","FLOOR","type=f16,ne=[10,2,2,2]","support","0","no","SYCL"+"SYCL0","FLOOR","type=f16,ne=[10,2,2,2]","support","1","yes","SYCL""SYCL0","CEIL","type=f16,ne=[10,2,2,2]","support","1","yes","SYCL"-"SYCL0","ROUND","type=f16,ne=[10,2,2,2]","support","0","no","SYCL"-"SYCL0","TRUNC","type=f16,ne=[10,2,2,2]","support","0","no","SYCL"+"SYCL0","ROUND","type=f16,ne=[10,2,2,2]","support","1","yes","SYCL"+"SYCL0","TRUNC","type=f16,ne=[10,2,2,2]","support","1","yes","SYCL""SYCL0","SQR","type=f16,ne=[7,1,5,3]","support","0","no","SYCL""SYCL0","SQR","type=f16,ne=[1024,1024,1,1]","support","0","no","SYCL""SYCL0","SQRT","type=f16,ne=[7,1,5,3]","support","0","no","SYCL"@@ -9766,14 +9768,14 @@"SYCL0","CLAMP","type=f16,ne=[1024,1024,1,1],min=-0.500000,max=0.500000","support","0","no","SYCL""SYCL0","LEAKY_RELU","type=f16,ne_a=[7,1,5,3],negative_slope=0.100000","support","1","yes","SYCL""SYCL0","LEAKY_RELU","type=f16,ne_a=[1024,1024,1,1],negative_slope=0.100000","support","1","yes","SYCL"-"SYCL0","FLOOR","type=f16,ne=[7,1,5,3]","support","0","no","SYCL"-"SYCL0","FLOOR","type=f16,ne=[1024,1024,1,1]","support","0","no","SYCL"+"SYCL0","FLOOR","type=f16,ne=[7,1,5,3]","support","1","yes","SYCL"+"SYCL0","FLOOR","type=f16,ne=[1024,1024,1,1]","support","1","yes","SYCL""SYCL0","CEIL","type=f16,ne=[7,1,5,3]","support","1","yes","SYCL""SYCL0","CEIL","type=f16,ne=[1024,1024,1,1]","support","1","yes","SYCL"-"SYCL0","ROUND","type=f16,ne=[7,1,5,3]","support","0","no","SYCL"-"SYCL0","ROUND","type=f16,ne=[1024,1024,1,1]","support","0","no","SYCL"-"SYCL0","TRUNC","type=f16,ne=[7,1,5,3]","support","0","no","SYCL"-"SYCL0","TRUNC","type=f16,ne=[1024,1024,1,1]","support","0","no","SYCL"+"SYCL0","ROUND","type=f16,ne=[7,1,5,3]","support","1","yes","SYCL"+"SYCL0","ROUND","type=f16,ne=[1024,1024,1,1]","support","1","yes","SYCL"+"SYCL0","TRUNC","type=f16,ne=[7,1,5,3]","support","1","yes","SYCL"+"SYCL0","TRUNC","type=f16,ne=[1024,1024,1,1]","support","1","yes","SYCL""SYCL0","SQR","type=f32,ne=[10,5,4,3]","support","1","yes","SYCL""SYCL0","SQRT","type=f32,ne=[10,3,3,2]","support","1","yes","SYCL""SYCL0","LOG","type=f32,ne=[10,5,4,3]","support","1","yes","SYCL"diff --git a/ggml/src/ggml-sycl/binbcast.cpp b/ggml/src/ggml-sycl/binbcast.cppindex 92dd18889f..ad2e6ca35e 100644--- a/ggml/src/ggml-sycl/binbcast.cpp+++ b/ggml/src/ggml-sycl/binbcast.cpp@@ -287,6 +287,13 @@ inline void ggml_sycl_op_bin_bcast(ggml_backend_sycl_context & ctx, const ggml_tne10, ne11, ne12, ne13, ne0, ne1, ne2, ne3, nb00, nb01, nb02, nb03, nb10, nb11, nb12, nb13, nb0, nb1, nb2,nb3, ggml_is_contiguous(src0), ggml_is_contiguous(src1), ggml_is_permuted(src0), ggml_is_permuted(src1),main_stream);+#ifdef GGML_SYCL_HAS_BF16+ } else if (src0->type == GGML_TYPE_BF16 && src1->type == GGML_TYPE_BF16 && dst->type == GGML_TYPE_BF16) {+ op()((const sycl::ext::oneapi::bfloat16 *) src0->data, (const sycl::ext::oneapi::bfloat16 *) src1->data,+ (sycl::ext::oneapi::bfloat16 *) dst->data, ne00, ne01, ne02, ne03, ne10, ne11, ne12, ne13, ne0, ne1, ne2,+ ne3, nb00, nb01, nb02, nb03, nb10, nb11, nb12, nb13, nb0, nb1, nb2, nb3, ggml_is_contiguous(src0),+ ggml_is_contiguous(src1), ggml_is_permuted(src0), ggml_is_permuted(src1), main_stream);+#endif} else {fprintf(stderr, "%s: unsupported types: dst: %s, src0: %s, src1: %s\n", __func__, ggml_type_name(dst->type),ggml_type_name(src0->type), ggml_type_name(src1->type));diff --git a/ggml/src/ggml-sycl/concat.cpp b/ggml/src/ggml-sycl/concat.cppindex d16215bc91..93e00d65fc 100644--- a/ggml/src/ggml-sycl/concat.cpp+++ b/ggml/src/ggml-sycl/concat.cpp@@ -10,6 +10,8 @@// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception//+#include "ggml.h"+#include "concat.hpp"static inline size_t elem_size(ggml_type t) {@@ -192,11 +194,29 @@ void ggml_sycl_op_concat(ggml_backend_sycl_context & ctx, ggml_tensor *dst) {case GGML_TYPE_F32:concat_impl_sycl<float>(ctx, dst);break;+ case GGML_TYPE_F16:+ concat_impl_sycl<sycl::half>(ctx, dst);+ break;+#ifdef GGML_SYCL_HAS_BF16+ case GGML_TYPE_BF16:+ concat_impl_sycl<sycl::ext::oneapi::bfloat16>(ctx, dst);+ break;+#endifcase GGML_TYPE_I32:concat_impl_sycl<int32_t>(ctx, dst);break;+ case GGML_TYPE_I16:+ concat_impl_sycl<int16_t>(ctx, dst);+ break;+ case GGML_TYPE_I64:+ concat_impl_sycl<int64_t>(ctx, dst);+ break;+ case GGML_TYPE_I8:+ concat_impl_sycl<int8_t>(ctx, dst);+ break;default:- GGML_ASSERT(false && "ggml_sycl_op_concat: unsupported type");+ fprintf(stderr, "%s: unsupported types: dst: %s\n", __func__, ggml_type_name(dst->type));+ GGML_ASSERT(false);break;}}diff --git a/ggml/src/ggml-sycl/element_wise.cpp b/ggml/src/ggml-sycl/element_wise.cppindex 249e80c826..aca68e58ee 100644--- a/ggml/src/ggml-sycl/element_wise.cpp+++ b/ggml/src/ggml-sycl/element_wise.cpp@@ -124,6 +124,11 @@ static __dpct_inline__ T op_exp(T x) {return sycl::exp(x);}+template<typename T>+static __dpct_inline__ T op_expm1(T x) {+ return sycl::expm1(x);+}+template<typename T>static __dpct_inline__ T op_log(T x) {if (x <= static_cast<T>(0)) {@@ -266,13 +271,6 @@ static void unary_op_clamp_kernel(const T * x, T * dst, const int k, const sycl:}}-template<typename T>-static void unary_op_floor_kernel(const T * x, T * dst, const int k, const sycl::nd_item<1> &item_ct1) {- SYCL_GLOBAL_ID_LOOP(k, item_ct1) {- dst[i] = op_floor(x[i]);- }-}-template<typename T>static void unary_op_ceil_kernel(const T * x, T * dst, const int k, const sycl::nd_item<1> &item_ct1) {SYCL_GLOBAL_ID_LOOP(k, item_ct1) {@@ -280,20 +278,6 @@ static void unary_op_ceil_kernel(const T * x, T * dst, const int k, const sycl::}}-template<typename T>-static void unary_op_round_kernel(const T * x, T * dst, const int k, const sycl::nd_item<1> &item_ct1) {- SYCL_GLOBAL_ID_LOOP(k, item_ct1) {- dst[i] = op_round(x[i]);- }-}--template<typename T>-static void unary_op_trunc_kernel(const T * x, T * dst, const int k, const sycl::nd_item<1> &item_ct1) {- SYCL_GLOBAL_ID_LOOP(k, item_ct1) {- dst[i] = op_trunc(x[i]);- }-}-template<typename T>static void clamp(const T * x, T * dst, const float min, const float max, const int k,const sycl::nd_item<1> &item_ct1) {@@ -605,6 +589,12 @@ static inline void ggml_sycl_op_exp(ggml_backend_sycl_context & ctx, ggml_tensor});}+static inline void ggml_sycl_op_expm1(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {+ ggml_sycl_detail::ggml_sycl_op_unary(ctx, dst, [](auto x) {+ return op_expm1(x);+ });+}+static inline void ggml_sycl_op_log(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {ggml_sycl_detail::dispatch_ggml_sycl_op_unary(ctx, dst,[](const auto* src, auto* dst_ptr, int k_elements, queue_ptr stream) {@@ -728,16 +718,9 @@ static inline void ggml_sycl_op_clamp(ggml_backend_sycl_context & ctx, ggml_tens}static inline void ggml_sycl_op_floor(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {- ggml_sycl_detail::dispatch_ggml_sycl_op_unary(ctx, dst,- [](const auto* src, auto* dst_ptr, int k_elements, queue_ptr stream) {- const int num_blocks = ceil_div(k_elements, 256);- stream->parallel_for(- sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(256),- sycl::range<1>(256)),- [=](sycl::nd_item<1> item_ct1) {- unary_op_floor_kernel(src, dst_ptr, k_elements, item_ct1);- });- });+ ggml_sycl_detail::ggml_sycl_op_unary(ctx, dst, [](auto x) {+ return op_floor(x);+ });}static inline void ggml_sycl_op_ceil(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {@@ -747,29 +730,15 @@ static inline void ggml_sycl_op_ceil(ggml_backend_sycl_context & ctx, ggml_tenso}static inline void ggml_sycl_op_round(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {- ggml_sycl_detail::dispatch_ggml_sycl_op_unary(ctx, dst,- [](const auto* src, auto* dst_ptr, int k_elements, queue_ptr stream) {- const int num_blocks = ceil_div(k_elements, 256);- stream->parallel_for(- sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(256),- sycl::range<1>(256)),- [=](sycl::nd_item<1> item_ct1) {- unary_op_round_kernel(src, dst_ptr, k_elements, item_ct1);- });- });+ ggml_sycl_detail::ggml_sycl_op_unary(ctx, dst, [](auto x) {+ return op_round(x);+ });}static inline void ggml_sycl_op_trunc(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {- ggml_sycl_detail::dispatch_ggml_sycl_op_unary(ctx, dst,- [](const auto* src, auto* dst_ptr, int k_elements, queue_ptr stream) {- const int num_blocks = ceil_div(k_elements, 256);- stream->parallel_for(- sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(256),- sycl::range<1>(256)),- [=](sycl::nd_item<1> item_ct1) {- unary_op_trunc_kernel(src, dst_ptr, k_elements, item_ct1);- });- });+ ggml_sycl_detail::ggml_sycl_op_unary(ctx, dst, [](auto x) {+ return op_trunc(x);+ });}static inline void ggml_sycl_op_acc(ggml_backend_sycl_context & ctx, ggml_tensor *dst) {@@ -1018,6 +987,11 @@ void ggml_sycl_exp(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {ggml_sycl_op_exp(ctx, dst);}+void ggml_sycl_expm1(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {+ scope_op_debug_print scope_dbg_print(__func__, dst, /*num_src=*/1);+ ggml_sycl_op_expm1(ctx, dst);+}+void ggml_sycl_log(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {scope_op_debug_print scope_dbg_print(__func__, dst, /*num_src=*/1);ggml_sycl_op_log(ctx, dst);diff --git a/ggml/src/ggml-sycl/element_wise.hpp b/ggml/src/ggml-sycl/element_wise.hppindex 997132166a..3bdc385968 100644--- a/ggml/src/ggml-sycl/element_wise.hpp+++ b/ggml/src/ggml-sycl/element_wise.hpp@@ -59,6 +59,8 @@ void ggml_sycl_hardswish(ggml_backend_sycl_context & ctx, ggml_tensor * dst);void ggml_sycl_exp(ggml_backend_sycl_context & ctx, ggml_tensor * dst);+void ggml_sycl_expm1(ggml_backend_sycl_context & ctx, ggml_tensor * dst);+void ggml_sycl_log(ggml_backend_sycl_context & ctx, ggml_tensor * dst);void ggml_sycl_softplus(ggml_backend_sycl_context & ctx, ggml_tensor * dst);diff --git a/ggml/src/ggml-sycl/ggml-sycl.cpp b/ggml/src/ggml-sycl/ggml-sycl.cppindex fb8665a02c..15ee53f7fd 100644--- a/ggml/src/ggml-sycl/ggml-sycl.cpp+++ b/ggml/src/ggml-sycl/ggml-sycl.cpp@@ -4489,6 +4489,9 @@ static bool ggml_sycl_compute_forward(ggml_backend_sycl_context & ctx, struct ggcase GGML_UNARY_OP_EXP:ggml_sycl_exp(ctx, dst);break;+ case GGML_UNARY_OP_EXPM1:+ ggml_sycl_expm1(ctx, dst);+ break;case GGML_UNARY_OP_SOFTPLUS:ggml_sycl_softplus(ctx, dst);break;@@ -5138,6 +5141,7 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const gcase GGML_UNARY_OP_GELU_QUICK:case GGML_UNARY_OP_GELU_ERF:case GGML_UNARY_OP_EXP:+ case GGML_UNARY_OP_EXPM1:case GGML_UNARY_OP_SOFTPLUS:case GGML_UNARY_OP_ELU:case GGML_UNARY_OP_CEIL:@@ -5145,11 +5149,7 @@ static bool ggml_backend_sycl_device_supports_op(ggml_backend_dev_t dev, const gcase GGML_UNARY_OP_FLOOR:case GGML_UNARY_OP_ROUND:case GGML_UNARY_OP_TRUNC:-#if defined (GGML_SYCL_F16)- return ggml_is_contiguous(op->src[0]) && (op->type == op->src[0]->type);-#else- 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);-#endif+ return true;default:return false;}