interplane.Get Omega
Read in your language

ggml

[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)

Brought by drakestapleton

branch master Branches Tags History

ggml / include / ggml-sycl.h

59 lines · 2492 bytes Raw Blame History
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(int main_device, 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
39// pins on device 0 - a copy between another device and this memory can fail,
40// use ggml_backend_dev_host_buffer_type to pin on the device that does the copy
41GGML_BACKEND_API ggml_backend_buffer_type_t ggml_backend_sycl_host_buffer_type(void);
42
43GGML_BACKEND_API void ggml_backend_sycl_print_sycl_devices(void);
44GGML_BACKEND_API void ggml_backend_sycl_get_gpu_list(int *id_list, int max_len);
45GGML_BACKEND_API void ggml_backend_sycl_get_device_description(int device,
46 char *description,
47 size_t description_size);
48GGML_BACKEND_API int ggml_backend_sycl_get_device_count(void);
49GGML_BACKEND_API void ggml_backend_sycl_get_device_memory(int device, size_t *free, size_t *total);
50
51// SYCL doesn't support registering host memory, keep here for reference
52// GGML_BACKEND_API bool ggml_backend_sycl_register_host_buffer(void * buffer, size_t size);
53// GGML_BACKEND_API void ggml_backend_sycl_unregister_host_buffer(void * buffer);
54
55GGML_BACKEND_API ggml_backend_reg_t ggml_backend_sycl_reg(void);
56
57#ifdef __cplusplus
58}
59#endif