@@ -346,6 +346,8 @@ static void * ggml_backend_sycl_buffer_get_base(ggml_backend_buffer_t buffer) {
346346static enum ggml_status
347347ggml_backend_sycl_buffer_init_tensor (ggml_backend_buffer_t buffer,
348348 ggml_tensor *tensor) try {
349+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
350+ debug_print_tensor (" : tensor=" , tensor, " \n " );
349351 ggml_backend_sycl_buffer_context * ctx = (ggml_backend_sycl_buffer_context *)buffer->context ;
350352
351353 if (tensor->view_src != NULL ) {
@@ -381,7 +383,9 @@ static void ggml_backend_sycl_buffer_set_tensor(ggml_backend_buffer_t buffer,
381383 ggml_tensor *tensor,
382384 const void *data, size_t offset,
383385 size_t size) try {
384-
386+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
387+ debug_print_tensor (" : tensor=" , tensor);
388+ GGML_SYCL_DEBUG (" size=%zu offset=%zu\n " , size, offset);
385389 ggml_backend_sycl_buffer_context * ctx = ( ggml_backend_sycl_buffer_context *)buffer->context ;
386390 ggml_sycl_set_device (ctx->device );
387391 auto stream = &(dpct::dev_mgr::instance ().get_device (ctx->device ).default_queue ());
@@ -406,7 +410,9 @@ static void ggml_backend_sycl_buffer_get_tensor(ggml_backend_buffer_t buffer,
406410 const ggml_tensor *tensor,
407411 void *data, size_t offset,
408412 size_t size) try {
409-
413+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
414+ debug_print_tensor (" : tensor=" , tensor);
415+ GGML_SYCL_DEBUG (" size=%zu offset=%zu\n " , size, offset);
410416 ggml_backend_sycl_buffer_context * ctx = ( ggml_backend_sycl_buffer_context *)buffer->context ;
411417
412418 ggml_sycl_set_device (ctx->device );
@@ -434,7 +440,12 @@ static bool
434440ggml_backend_sycl_buffer_cpy_tensor (ggml_backend_buffer_t buffer,
435441 const ggml_tensor *src,
436442 ggml_tensor *dst) try {
437- if (ggml_backend_buffer_is_sycl (src->buffer )) {
443+ bool is_cpy_supported = ggml_backend_buffer_is_sycl (src->buffer );
444+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
445+ debug_print_tensor (" : dst=" , dst);
446+ debug_print_tensor (" src=" , src);
447+ GGML_SYCL_DEBUG (" is_cpy_supported=%d\n " , is_cpy_supported);
448+ if (is_cpy_supported) {
438449 ggml_backend_sycl_buffer_context * src_ctx = (ggml_backend_sycl_buffer_context *)src->buffer ->context ;
439450 ggml_backend_sycl_buffer_context * dst_ctx = (ggml_backend_sycl_buffer_context *)dst->buffer ->context ;
440451
@@ -491,7 +502,8 @@ ggml_backend_sycl_buffer_cpy_tensor(ggml_backend_buffer_t buffer,
491502
492503static void ggml_backend_sycl_buffer_clear (ggml_backend_buffer_t buffer,
493504 uint8_t value) try {
494- ggml_backend_sycl_buffer_context * ctx = ( ggml_backend_sycl_buffer_context *)buffer->context ;
505+ GGML_SYCL_DEBUG (" [SYCL] call %s: size=%zu\n " , __func__, buffer->size );
506+ ggml_backend_sycl_buffer_context * ctx = ( ggml_backend_sycl_buffer_context *)buffer->context ;
495507
496508 ggml_sycl_set_device (ctx->device );
497509 queue_ptr stream = ctx->stream ;
@@ -510,7 +522,9 @@ catch (sycl::exception const &exc) {
510522
511523static void ggml_backend_sycl_buffer_memset_tensor (ggml_backend_buffer_t buffer, ggml_tensor * tensor, uint8_t value,
512524 size_t offset, size_t size) {
513- GGML_SYCL_DEBUG (" [SYCL] call %s\n " , __func__);
525+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
526+ debug_print_tensor (" : tensor=" , tensor);
527+ GGML_SYCL_DEBUG (" size=%zu offset=%zu value=%u\n " , size, offset, value);
514528 ggml_backend_sycl_buffer_context * ctx = (ggml_backend_sycl_buffer_context *) buffer->context ;
515529 SYCL_CHECK (ggml_sycl_set_device (ctx->device ));
516530 auto stream = &(dpct::dev_mgr::instance ().get_device (ctx->device ).default_queue ());
@@ -788,6 +802,8 @@ static void * ggml_backend_sycl_split_buffer_get_base(ggml_backend_buffer_t buff
788802static enum ggml_status
789803ggml_backend_sycl_split_buffer_init_tensor (ggml_backend_buffer_t buffer,
790804 ggml_tensor *tensor) try {
805+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
806+ debug_print_tensor (" : tensor=" , tensor, " \n " );
791807 GGML_ASSERT (tensor->view_src == nullptr ); // views of split tensors are not supported
792808
793809 ggml_backend_sycl_split_buffer_context * ctx = (ggml_backend_sycl_split_buffer_context *)buffer->context ;
@@ -872,6 +888,9 @@ static void
872888ggml_backend_sycl_split_buffer_set_tensor (ggml_backend_buffer_t buffer,
873889 ggml_tensor *tensor, const void *data,
874890 size_t offset, size_t size) try {
891+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
892+ debug_print_tensor (" : tensor=" , tensor);
893+ GGML_SYCL_DEBUG (" size=%zu offset=%zu\n " , size, offset);
875894 // split tensors must always be set in their entirety at once
876895 GGML_ASSERT (offset == 0 );
877896 GGML_ASSERT (size == ggml_nbytes (tensor));
@@ -925,6 +944,9 @@ static void
925944ggml_backend_sycl_split_buffer_get_tensor (ggml_backend_buffer_t buffer,
926945 const ggml_tensor *tensor, void *data,
927946 size_t offset, size_t size) try {
947+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
948+ debug_print_tensor (" : tensor=" , tensor);
949+ GGML_SYCL_DEBUG (" size=%zu offset=%zu\n " , size, offset);
928950 // split tensors must always be set in their entirety at once
929951 GGML_ASSERT (offset == 0 );
930952 GGML_ASSERT (size == ggml_nbytes (tensor));
@@ -3723,6 +3745,9 @@ static void ggml_backend_sycl_set_tensor_async(ggml_backend_t backend,
37233745 ggml_tensor *tensor,
37243746 const void *data, size_t offset,
37253747 size_t size) try {
3748+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
3749+ debug_print_tensor (" : tensor=" , tensor);
3750+ GGML_SYCL_DEBUG (" size=%zu offset=%zu\n " , size, offset);
37263751 ggml_backend_sycl_context * sycl_ctx = (ggml_backend_sycl_context *)backend->context ;
37273752 ggml_backend_buffer_t buf = tensor->view_src ? tensor->view_src ->buffer : tensor->buffer ;
37283753
@@ -3741,6 +3766,9 @@ static void ggml_backend_sycl_get_tensor_async(ggml_backend_t backend,
37413766 const ggml_tensor *tensor,
37423767 void *data, size_t offset,
37433768 size_t size) try {
3769+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
3770+ debug_print_tensor (" : tensor=" , tensor);
3771+ GGML_SYCL_DEBUG (" size=%zu offset=%zu\n " , size, offset);
37443772 ggml_backend_sycl_context * sycl_ctx = (ggml_backend_sycl_context *)backend->context ;
37453773 ggml_backend_buffer_t buf = tensor->view_src ? tensor->view_src ->buffer : tensor->buffer ;
37463774
@@ -3759,7 +3787,12 @@ static bool ggml_backend_sycl_cpy_tensor_async(ggml_backend_t backend,
37593787 const ggml_tensor *src,
37603788 ggml_tensor *dst) try {
37613789 ggml_backend_sycl_context * sycl_ctx = (ggml_backend_sycl_context *)backend->context ;
3762- if (dst->buffer ->buft == ggml_backend_sycl_buffer_type (sycl_ctx->device ) && ggml_backend_buffer_is_sycl (src->buffer )) {
3790+ bool is_cpy_supported = dst->buffer ->buft == ggml_backend_sycl_buffer_type (sycl_ctx->device ) && ggml_backend_buffer_is_sycl (src->buffer );
3791+ GGML_SYCL_DEBUG (" [SYCL] call %s" , __func__);
3792+ debug_print_tensor (" : dst=" , dst);
3793+ debug_print_tensor (" src=" , src);
3794+ GGML_SYCL_DEBUG (" is_cpy_supported=%d\n " , is_cpy_supported);
3795+ if (is_cpy_supported) {
37633796 /*
37643797 DPCT1009:215: SYCL uses exceptions to report errors and does not use the
37653798 error codes. The original code was commented out and a warning string
@@ -3780,6 +3813,7 @@ catch (sycl::exception const &exc) {
37803813}
37813814
37823815static void ggml_backend_sycl_synchronize (ggml_backend_t backend) try {
3816+ GGML_SYCL_DEBUG (" [SYCL] call %s\n " , __func__);
37833817 ggml_backend_sycl_context * sycl_ctx = (ggml_backend_sycl_context *)backend->context ;
37843818 const queue_ptr stream = sycl_ctx->stream (sycl_ctx->device , 0 );
37853819 SYCL_CHECK (CHECK_TRY_ERROR ((stream)->wait ()));
@@ -3881,7 +3915,7 @@ catch (sycl::exception const &exc)
38813915}
38823916
38833917static void ggml_backend_sycl_event_wait (ggml_backend_t backend, ggml_backend_event_t event) try {
3884-
3918+ GGML_SYCL_DEBUG ( " [SYCL] call %s \n " , __func__);
38853919 sycl::event* sycl_event = static_cast <sycl::event*>(event->context );
38863920
38873921 if (ggml_backend_is_sycl (backend)) {
@@ -4276,6 +4310,7 @@ static void ggml_backend_sycl_device_event_free(ggml_backend_dev_t dev, ggml_bac
42764310
42774311static void ggml_backend_sycl_device_event_synchronize (ggml_backend_dev_t dev, ggml_backend_event_t event) try {
42784312 GGML_UNUSED (dev);
4313+ GGML_SYCL_DEBUG (" [SYCL] call %s\n " , __func__);
42794314
42804315 sycl::event *sycl_event = static_cast <sycl::event *>(event->context );
42814316 SYCL_CHECK (CHECK_TRY_ERROR (sycl_event->wait ()));
0 commit comments