char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

David Spruillsycl : support --split-mode tensor (#24152)e9fb3b3fc

char/aliceai-t5-moe
2.3 KiB57 linesraw
1//
2//  MIT license
3//  Copyright (C) 2024 Intel Corporation
4//  SPDX-License-Identifier: MIT
5//
6
7#pragma once
8
9#include "ggml.h"
10#include "ggml-backend.h"
11
12#define GGML_SYCL_NAME "SYCL"
13#define GGML_SYCL_MAX_DEVICES 48
14
15#ifdef  __cplusplus
16extern "C" {
17#endif
18
19// backend API
20GGML_BACKEND_API ggml_backend_t ggml_backend_sycl_init(int device);
21
22GGML_BACKEND_API bool ggml_backend_is_sycl(ggml_backend_t backend);
23
24// devide buffer
25GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_buffer_type(int device);
26
27// split tensor buffer that splits matrices by rows across multiple devices
28GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_split_buffer_type(const float * tensor_split);
29
30// Tensor parallelism (--split-mode tensor): comm_init/free/allreduce_tensor
31// trio queried by the meta-backend via ggml_backend_reg_get_proc_address.
32// See typedefs in ggml/include/ggml-backend.h. Mirrors the CUDA backend's
33// pattern (ggml_backend_cuda_comm_*).
34GGML_BACKEND_API void * ggml_backend_sycl_comm_init(ggml_backend_t * backends, size_t n_backends);
35GGML_BACKEND_API void   ggml_backend_sycl_comm_free(void * comm_ctx);
36GGML_BACKEND_API bool   ggml_backend_sycl_comm_allreduce_tensor(void * comm_ctx, struct ggml_tensor ** tensors);
37
38// pinned host buffer for use with the CPU backend for faster copies between CPU and GPU
39GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_host_buffer_type(void);
40
41GGML_BACKEND_API void ggml_backend_sycl_print_sycl_devices(void);
42GGML_BACKEND_API void ggml_backend_sycl_get_gpu_list(int *id_list, int max_len);
43GGML_BACKEND_API void ggml_backend_sycl_get_device_description(int device,
44                                                       char *description,
45                                                       size_t description_size);
46GGML_BACKEND_API int  ggml_backend_sycl_get_device_count();
47GGML_BACKEND_API void ggml_backend_sycl_get_device_memory(int device, size_t *free, size_t *total);
48
49// SYCL doesn't support registering host memory, keep here for reference
50// GGML_BACKEND_API bool ggml_backend_sycl_register_host_buffer(void * buffer, size_t size);
51// GGML_BACKEND_API void ggml_backend_sycl_unregister_host_buffer(void * buffer);
52
53GGML_BACKEND_API ggml_backend_reg_t ggml_backend_sycl_reg(void);
54
55#ifdef  __cplusplus
56}
57#endif