Skip to content

Commit e139b9c

Browse files
committed
rope: add try catch sycl exception and debug log
1 parent e5b79de commit e139b9c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2906,11 +2906,6 @@ static void ggml_sycl_dup(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
29062906
ggml_sycl_cpy(ctx, dst->src[0], dst);
29072907
}
29082908

2909-
static void ggml_sycl_rope(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
2910-
GGML_ASSERT(ggml_is_contiguous(dst->src[0])); // TODO: this restriction is temporary until non-cont support is implemented
2911-
ggml_sycl_op_rope(ctx, dst);
2912-
}
2913-
29142909
static void ggml_sycl_pool2d(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
29152910
ggml_sycl_op_pool2d(ctx, dst);
29162911
}

ggml/src/ggml-sycl/rope.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static void rope_neox_sycl(
192192
}
193193
}
194194

195-
void ggml_sycl_op_rope(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
195+
static void ggml_sycl_op_rope(ggml_backend_sycl_context & ctx, ggml_tensor * dst) try {
196196

197197
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32 || dst->src[0]->type == GGML_TYPE_F16);
198198
GGML_ASSERT(dst->type == GGML_TYPE_F32 || dst->type == GGML_TYPE_F16);
@@ -272,4 +272,15 @@ void ggml_sycl_op_rope(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
272272
GGML_ABORT("fatal error");
273273
}
274274
}
275+
} catch (const sycl::exception & exc) {
276+
std::cerr << exc.what() << "Exception caught at file:" << __FILE__ << ", line:" << __LINE__ << std::endl;
277+
std::exit(1);
278+
}
279+
280+
void ggml_sycl_rope(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
281+
GGML_ASSERT(
282+
ggml_is_contiguous(dst->src[0])); // TODO: this restriction is temporary until non-cont support is implemented
283+
GGML_SYCL_DEBUG("call %s\n", __func__);
284+
ggml_sycl_op_rope(ctx, dst);
285+
GGML_SYCL_DEBUG("call %s done\n", __func__);
275286
}

ggml/src/ggml-sycl/rope.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
#include "common.hpp"
1717

18-
void ggml_sycl_op_rope(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
18+
void ggml_sycl_rope(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
1919

2020
#endif // GGML_SYCL_ROPE_HPP

0 commit comments

Comments
 (0)