File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1157,13 +1157,28 @@ static const char * ggml_backend_sycl_host_buffer_type_name(ggml_backend_buffer_
11571157 GGML_UNUSED (buft);
11581158}
11591159
1160+ inline void * aligned_malloc_host (size_t alignment, size_t size) {
1161+ #ifdef _WIN32
1162+ return _aligned_malloc (size, alignment);
1163+ #else
1164+ return aligned_alloc (alignment, size);
1165+ #endif
1166+ }
1167+
1168+ inline void free_aligned_mem_host (void * memblock) {
1169+ #ifdef _WIN32
1170+ _aligned_free (memblock);
1171+ #else
1172+ free (memblock);
1173+ #endif
1174+ }
1175+
11601176static void ggml_backend_sycl_host_buffer_free_buffer (ggml_backend_buffer_t buffer) {
1161- ggml_sycl_host_free ( buffer->context );
1177+ free_aligned_mem_host (( void *) buffer->context );
11621178}
11631179
11641180static ggml_backend_buffer_t ggml_backend_sycl_host_buffer_type_alloc_buffer (ggml_backend_buffer_type_t buft, size_t size) {
1165- void * ptr = ggml_sycl_host_malloc (size);
1166-
1181+ void * ptr = aligned_malloc_host (TENSOR_ALIGNMENT, size);
11671182 if (ptr == nullptr ) {
11681183 // fallback to cpu buffer
11691184 return ggml_backend_buft_alloc_buffer (ggml_backend_cpu_buffer_type (), size);
You can’t perform that action at this time.
0 commit comments