ggml-sycl.h 1.72 KB
Newer Older
xuxzh1's avatar
init  
xuxzh1 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//
//  MIT license
//  Copyright (C) 2024 Intel Corporation
//  SPDX-License-Identifier: MIT
//

#pragma once

#include "ggml.h"
#include "ggml-backend.h"

#define GGML_SYCL_NAME "SYCL"
#define GGML_SYCL_MAX_DEVICES 48

#ifdef  __cplusplus
extern "C" {
#endif

// backend API
xuxzh1's avatar
update  
xuxzh1 committed
20
21
22
GGML_BACKEND_API ggml_backend_t ggml_backend_sycl_init(int device);

GGML_BACKEND_API bool ggml_backend_is_sycl(ggml_backend_t backend);
xuxzh1's avatar
init  
xuxzh1 committed
23
24

// devide buffer
xuxzh1's avatar
update  
xuxzh1 committed
25
GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_buffer_type(int device);
xuxzh1's avatar
init  
xuxzh1 committed
26
27

// split tensor buffer that splits matrices by rows across multiple devices
xuxzh1's avatar
update  
xuxzh1 committed
28
GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_split_buffer_type(const float * tensor_split);
xuxzh1's avatar
init  
xuxzh1 committed
29
30

// pinned host buffer for use with the CPU backend for faster copies between CPU and GPU
xuxzh1's avatar
update  
xuxzh1 committed
31
GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_host_buffer_type(void);
xuxzh1's avatar
init  
xuxzh1 committed
32

xuxzh1's avatar
update  
xuxzh1 committed
33
34
35
36
37
38
39
GGML_BACKEND_API void ggml_backend_sycl_print_sycl_devices(void);
GGML_BACKEND_API void ggml_backend_sycl_get_gpu_list(int *id_list, int max_len);
GGML_BACKEND_API void ggml_backend_sycl_get_device_description(int device,
                                                       char *description,
                                                       size_t description_size);
GGML_BACKEND_API int  ggml_backend_sycl_get_device_count();
GGML_BACKEND_API void ggml_backend_sycl_get_device_memory(int device, size_t *free, size_t *total);
xuxzh1's avatar
init  
xuxzh1 committed
40
41

// SYCL doesn't support registering host memory, keep here for reference
xuxzh1's avatar
update  
xuxzh1 committed
42
43
44
45
46
// GGML_BACKEND_API bool ggml_backend_sycl_register_host_buffer(void * buffer, size_t size);
// GGML_BACKEND_API void ggml_backend_sycl_unregister_host_buffer(void * buffer);

GGML_BACKEND_API ggml_backend_reg_t ggml_backend_sycl_reg(void);

xuxzh1's avatar
init  
xuxzh1 committed
47
48
49
#ifdef  __cplusplus
}
#endif