Skip to content

Commit 9c42e0c

Browse files
MengAiDevMengAiDev
authored andcommitted
fix(sycl): improve memory allocation error message for devices
- Replace generic error message with more specific information - Use %zu format specifier for size_t type - Add device ID to the error message - Simplify memory allocation code
1 parent 9eaa51e commit 9c42e0c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,14 +1235,9 @@ struct ggml_sycl_pool_leg : public ggml_sycl_pool {
12351235
b.size = 0;
12361236
return ptr;
12371237
}
1238-
void * ptr;
1239-
size_t look_ahead_size = (size_t) (1.05 * size);
1240-
1241-
SYCL_CHECK(
1242-
CHECK_TRY_ERROR(ptr = (void *)sycl::malloc_device(
1243-
look_ahead_size, *qptr)));
1238+
void * ptr = sycl::malloc_device(look_ahead_size, *qptr);
12441239
if (!ptr) {
1245-
GGML_LOG_ERROR("%s: can't allocate %lu Bytes of memory on device/GPU\n", __func__, look_ahead_size);
1240+
GGML_LOG_ERROR("%s: failed to allocate %zu bytes on device %d\n", __func__, look_ahead_size, id);
12461241
return nullptr;
12471242
}
12481243

0 commit comments

Comments
 (0)