@@ -57,7 +57,7 @@ void print_cpu_detail() {
5757 auto global_mem_size = prop.get_global_mem_size ()/1000000 ;
5858 std::string res= " [SYCL] CPU: [" +name+" ] Memory: [" +std::to_string (global_mem_size)+" M]\n " ;
5959
60- fprintf (stderr, " %s" , res.c_str ());
60+ GGML_LOG_INFO ( " %s" , res.c_str ());
6161}
6262
6363static ggml_sycl_device_info ggml_sycl_init () {
@@ -67,24 +67,24 @@ static ggml_sycl_device_info ggml_sycl_init() {
6767
6868 info.device_count = dpct::dev_mgr::instance ().device_count ();
6969 if (info.device_count == 0 ) {
70- fprintf (stderr, " %s: failed to initialize " GGML_SYCL_NAME " : %s\n " , __func__);
70+ GGML_LOG_ERROR ( " %s: failed to initialize " GGML_SYCL_NAME " : %s\n " , __func__);
7171 return info;
7272 }
7373
7474 GGML_ASSERT (info.device_count <= GGML_SYCL_MAX_DEVICES);
7575
7676 int64_t total_vram = 0 ;
7777#if defined(GGML_SYCL_FORCE_MMQ)
78- fprintf (stderr, " %s: GGML_SYCL_FORCE_MMQ: yes\n " , __func__);
78+ GGML_LOG_INFO ( " %s: GGML_SYCL_FORCE_MMQ: yes\n " , __func__);
7979#else
80- fprintf (stderr, " %s: GGML_SYCL_FORCE_MMQ: no\n " , __func__);
80+ GGML_LOG_INFO ( " %s: GGML_SYCL_FORCE_MMQ: no\n " , __func__);
8181#endif
8282#if defined(SYCL_USE_XMX)
83- fprintf (stderr, " %s: SYCL_USE_XMX: yes\n " , __func__);
83+ GGML_LOG_INFO ( " %s: SYCL_USE_XMX: yes\n " , __func__);
8484#else
85- fprintf (stderr, " %s: SYCL_USE_XMX: no\n " , __func__);
85+ GGML_LOG_INFO ( " %s: SYCL_USE_XMX: no\n " , __func__);
8686#endif
87- fprintf (stderr, " %s: found %d " GGML_SYCL_NAME " devices\n " , __func__, info.device_count );
87+ GGML_LOG_INFO ( " %s: found %d " GGML_SYCL_NAME " devices\n " , __func__, info.device_count );
8888
8989 for (int i = 0 ; i < info.device_count ; ++i) {
9090 info.devices [i].vmm = 0 ;
@@ -130,7 +130,7 @@ void print_device_detail(int id, sycl::device &device, std::string device_type)
130130
131131 auto global_mem_size = prop.get_global_mem_size ()/1000000 ;
132132
133- fprintf (stderr, " |%2d|%19s|%39s|%7s|%7d|%8d|%5d|%6luM|%21s|\n " , id, device_type.c_str (),
133+ GGML_LOG_INFO ( " |%2d|%19s|%39s|%7s|%7d|%8d|%5d|%6luM|%21s|\n " , id, device_type.c_str (),
134134 name.c_str (), version.c_str (), prop.get_max_compute_units (),
135135 prop.get_max_work_group_size (), prop.get_max_sub_group_size (),
136136 global_mem_size, device.get_info <sycl::info::device::driver_version>().c_str ());
@@ -140,11 +140,11 @@ void ggml_backend_sycl_print_sycl_devices() {
140140 GGML_SYCL_DEBUG (" [SYCL] call ggml_backend_sycl_print_sycl_devices\n " );
141141 int device_count = dpct::dev_mgr::instance ().device_count ();
142142 std::map<std::string, size_t > DeviceNums;
143- fprintf (stderr, " found %d SYCL devices:\n " , device_count);
144- fprintf (stderr, " | | | | |Max | |Max |Global | |\n " );
145- fprintf (stderr, " | | | | |compute|Max work|sub |mem | |\n " );
146- fprintf (stderr, " |ID| Device Type| Name|Version|units |group |group|size | Driver version|\n " );
147- fprintf (stderr, " |--|-------------------|---------------------------------------|-------|-------|--------|-----|-------|---------------------|\n " );
143+ GGML_LOG_INFO ( " found %d SYCL devices:\n " , device_count);
144+ GGML_LOG_INFO ( " | | | | |Max | |Max |Global | |\n " );
145+ GGML_LOG_INFO ( " | | | | |compute|Max work|sub |mem | |\n " );
146+ GGML_LOG_INFO ( " |ID| Device Type| Name|Version|units |group |group|size | Driver version|\n " );
147+ GGML_LOG_INFO ( " |--|-------------------|---------------------------------------|-------|-------|--------|-----|-------|---------------------|\n " );
148148 for (int id = 0 ; id < device_count; ++id) {
149149 sycl::device device = dpct::dev_mgr::instance ().get_device (id);
150150 sycl::backend backend = device.get_backend ();
@@ -174,22 +174,22 @@ static void ggml_check_sycl() try {
174174 static bool initialized = false ;
175175
176176 if (!initialized) {
177- fprintf (stderr, " [SYCL] call ggml_check_sycl\n " );
177+ GGML_LOG_DEBUG ( " [SYCL] call ggml_check_sycl\n " );
178178 g_ggml_sycl_debug = get_sycl_env (" GGML_SYCL_DEBUG" , 0 );
179179
180- fprintf (stderr, " %s: GGML_SYCL_DEBUG: %d\n " , __func__, g_ggml_sycl_debug);
180+ GGML_LOG_INFO ( " %s: GGML_SYCL_DEBUG: %d\n " , __func__, g_ggml_sycl_debug);
181181
182182#if defined(GGML_SYCL_F16)
183- fprintf (stderr, " %s: GGML_SYCL_F16: yes\n " , __func__);
183+ GGML_LOG_INFO ( " %s: GGML_SYCL_F16: yes\n " , __func__);
184184#else
185- fprintf (stderr, " %s: GGML_SYCL_F16: no\n " , __func__);
185+ GGML_LOG_INFO ( " %s: GGML_SYCL_F16: no\n " , __func__);
186186#endif
187187
188188/* NOT REMOVE, keep it for next optimize for XMX.
189189#if defined(SYCL_USE_XMX)
190- fprintf(stderr, "%s: SYCL_USE_XMX: yes\n", __func__);
190+ GGML_LOG_INFO( "%s: SYCL_USE_XMX: yes\n", __func__);
191191#else
192- fprintf(stderr, "%s: SYCL_USE_XMX: no\n", __func__);
192+ GGML_LOG_INFO( "%s: SYCL_USE_XMX: no\n", __func__);
193193#endif
194194*/
195195
@@ -225,7 +225,7 @@ inline void check_allow_gpu_index(const int device_index) {
225225 __func__,
226226 device_index,
227227 ggml_sycl_info ().device_count - 1 );
228- fprintf (stderr, " %s\n " , error_buf);
228+ GGML_LOG_ERROR ( " %s\n " , error_buf);
229229 assert (false );
230230 }
231231}
@@ -499,7 +499,7 @@ ggml_backend_sycl_buffer_type_alloc_buffer(ggml_backend_buffer_type_t buft,
499499 SYCL_CHECK (CHECK_TRY_ERROR (dev_ptr = (void *)sycl::malloc_device (
500500 size, *stream)));
501501 if (!dev_ptr) {
502- fprintf (stderr, " %s: can't malloc %lu Bytes memory on device" , __func__, size);
502+ GGML_LOG_ERROR ( " %s: can't malloc %lu Bytes memory on device" , __func__, size);
503503 return nullptr ;
504504 }
505505 ggml_backend_sycl_buffer_context * ctx = new ggml_backend_sycl_buffer_context (buft_ctx->device , dev_ptr, buft_ctx->stream );
@@ -1180,15 +1180,15 @@ struct ggml_sycl_pool_leg : public ggml_sycl_pool {
11801180 CHECK_TRY_ERROR (ptr = (void *)sycl::malloc_device (
11811181 look_ahead_size, *qptr)));
11821182 if (!ptr) {
1183- fprintf (stderr, " %s: can't malloc %lu Bytes memory on device" , __func__, look_ahead_size);
1183+ GGML_LOG_ERROR ( " %s: can't malloc %lu Bytes memory on device" , __func__, look_ahead_size);
11841184 return nullptr ;
11851185 }
11861186
11871187 *actual_size = look_ahead_size;
11881188 pool_size += look_ahead_size;
11891189
11901190 #ifdef DEBUG_SYCL_MALLOC
1191- fprintf (stderr, " %s[%d]: %d buffers, max_size = %u MB, pool_size = %u MB, requested %u MB\n " , __func__, id, nnz,
1191+ GGML_LOG_DEBUG ( " %s[%d]: %d buffers, max_size = %u MB, pool_size = %u MB, requested %u MB\n " , __func__, id, nnz,
11921192 (uint32_t )(max_size/1024 /1024 ), (uint32_t )(g_sycl_pool_size[id]/1024 /1024 ), (uint32_t )(size/1024 /1024 ));
11931193 #endif
11941194 // GGML_SYCL_DEBUG("ggml_sycl_pool_malloc_leg look_ahead_size=%lu, return %p\n", look_ahead_size, ptr);
@@ -1204,7 +1204,7 @@ struct ggml_sycl_pool_leg : public ggml_sycl_pool {
12041204 return ;
12051205 }
12061206 }
1207- fprintf (stderr, " WARNING: sycl buffer pool full, increase MAX_sycl_BUFFERS\n " );
1207+ GGML_LOG_WARN ( " WARNING: sycl buffer pool full, increase MAX_sycl_BUFFERS\n " );
12081208 SYCL_CHECK (CHECK_TRY_ERROR (sycl::free (ptr, *qptr)));
12091209 pool_size -= size;
12101210 }
@@ -2978,7 +2978,7 @@ static void ggml_sycl_op_get_rows(ggml_backend_sycl_context & ctx, const ggml_te
29782978 break ;
29792979 default :
29802980 // TODO: k-quants
2981- fprintf (stderr, " %s: unsupported type: %s\n " , __func__, ggml_type_name (src0->type ));
2981+ GGML_LOG_ERROR ( " %s: unsupported type: %s\n " , __func__, ggml_type_name (src0->type ));
29822982 GGML_ABORT (" fatal error" );
29832983 break ;
29842984 }
@@ -3006,7 +3006,7 @@ inline void ggml_sycl_op_bin_bcast(ggml_backend_sycl_context & ctx, const ggml_t
30063006 op ()(ctx, src0, src1, dst, (const int16_t *)src0_dd, (const int16_t *)src1_dd, (int16_t *)dst_dd,
30073007 main_stream);
30083008 } else {
3009- fprintf (stderr, " %s: unsupported types: dst: %s, src0: %s, src1: %s\n " , __func__,
3009+ GGML_LOG_ERROR ( " %s: unsupported types: dst: %s, src0: %s, src1: %s\n " , __func__,
30103010 ggml_type_name (dst->type ), ggml_type_name (src0->type ), ggml_type_name (src1->type ));
30113011 GGML_ABORT (" fatal error" );
30123012 }
@@ -4630,7 +4630,7 @@ static void ggml_sycl_cpy(ggml_backend_sycl_context & ctx, const ggml_tensor *sr
46304630 } else if (src0->type == GGML_TYPE_I32 && src1->type == GGML_TYPE_I32) {
46314631 ggml_cpy_i32_i32_sycl (src0_ddc, src1_ddc, ne, ne00, ne01, ne02, nb00, nb01, nb02, nb03, ne10, ne11, ne12, nb10, nb11, nb12, nb13, main_stream);
46324632 } else {
4633- fprintf (stderr, " %s: unsupported type combination (%s to %s)\n " , __func__,
4633+ GGML_LOG_ERROR ( " %s: unsupported type combination (%s to %s)\n " , __func__,
46344634 ggml_type_name (src0->type ), ggml_type_name (src1->type ));
46354635 GGML_ABORT (" fatal error" );
46364636 }
@@ -4695,7 +4695,7 @@ void ggml_sycl_set_main_device(const int main_device) try {
46954695 dpct::device_info prop;
46964696 SYCL_CHECK (CHECK_TRY_ERROR (dpct::get_device_info (
46974697 prop, dpct::dev_mgr::instance ().get_device (main_device))));
4698- fprintf (stderr, " Using device %d (%s) as main device\n " ,
4698+ GGML_LOG_DEBUG ( " Using device %d (%s) as main device\n " ,
46994699 main_device, prop.get_name ());
47004700 }
47014701}
@@ -5008,7 +5008,7 @@ static ggml_status ggml_backend_sycl_graph_compute(ggml_backend_t backend, ggml_
50085008#endif
50095009 bool ok = ggml_sycl_compute_forward (*sycl_ctx, node);
50105010 if (!ok) {
5011- fprintf (stderr, " %s: error: op not supported %s (%s)\n " , __func__, node->name , ggml_op_name (node->op ));
5011+ GGML_LOG_ERROR ( " %s: error: op not supported %s (%s)\n " , __func__, node->name , ggml_op_name (node->op ));
50125012 }
50135013 GGML_ASSERT (ok);
50145014 }
@@ -5481,7 +5481,7 @@ ggml_backend_t ggml_backend_sycl_init(int device) {
54815481
54825482 ggml_backend_sycl_context * ctx = new ggml_backend_sycl_context (device);
54835483 if (ctx == nullptr ) {
5484- fprintf (stderr, " %s: error: failed to allocate context\n " , __func__);
5484+ GGML_LOG_ERROR ( " %s: error: failed to allocate context\n " , __func__);
54855485 return nullptr ;
54865486 };
54875487
0 commit comments