summaryrefslogtreecommitdiff
path: root/ggml-cuda.h
diff options
context:
space:
mode:
authorslaren <slarengh@gmail.com>2024-01-12 20:07:38 +0100
committerGitHub <noreply@github.com>2024-01-12 20:07:38 +0100
commite7e4df031b9e29d4b55a4e0b0295187f6b213db1 (patch)
tree93211b7800be3c2c5f9eb1d55f3b7b3acdc56c9b /ggml-cuda.h
parent584d674be622fbf1578694ada6e62eebedbfd377 (diff)
llama : ggml-backend integration (#4766)
* llama : ggml-backend integration * ggml-backend : add names to buffers * fix unmap after loading * batched-bench : add tensor_split param * llama : check for null tensor_split * ggml-backend : increase GGML_MAX_BACKENDS * improve graph splitting, partial fix for --no-kv-offload * cuda : add ggml-backend split buffer support * cuda : do not create buffer types for devices that don't exist (fixes usage without CUDA devices available) * ggml : fix null backend dereference (#4807) * ggml : fix null backend dereference * ggml : also check ggml_backend_is_cpu * test-backend-ops : check buffer allocation failures * llama : add cparam (split_mode) and command line argument (--split-mode, -sm) to configure the split mode (none, layer or row) * ggml : fix mul_mat_id work size * llama : rewrite session kv load/set without graphs * minor * llama : only initialize used backends, free backends on context free * llama : abort ctx if cuda backend init fails * llama : rewrite lora with ggml-backend and compute on CPU ggml-ci * llama : only map to a backend buffer the region of the file mapping containing the tensors used in the buffer * opencl : add ggml-backend buffer type * cuda : only use batched_cublas with batched mat muls (fixes fp16 tg perf) * llama : on Metal, by default offload the full model ggml-ci * metal : page align the data ptr (#4854) * Apply suggestions from code review Co-authored-by: Johannes Gäßler <johannesg@5d6.de> * cuda : fix split buffer free * address review comments * llama-bench : add split-mode parameter * fix whitespace * opencl : fix double initialization * server : add --split-mode parameter * use async copy and compute to improve multi-gpu performance ggml-ci * use async memcpys to copy the graph outputs to the CPU * fix opencl * use a host buffer for the cpu compute buffer for faster copies to the gpu --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com> Co-authored-by: Johannes Gäßler <johannesg@5d6.de>
Diffstat (limited to 'ggml-cuda.h')
-rw-r--r--ggml-cuda.h26
1 files changed, 7 insertions, 19 deletions
diff --git a/ggml-cuda.h b/ggml-cuda.h
index cdb0c0c4..d19cbf3f 100644
--- a/ggml-cuda.h
+++ b/ggml-cuda.h
@@ -27,22 +27,6 @@ GGML_API void * ggml_cuda_host_malloc(size_t size);
GGML_API void ggml_cuda_host_free(void * ptr);
GGML_API bool ggml_cuda_can_mul_mat(const struct ggml_tensor * src0, const struct ggml_tensor * src1, struct ggml_tensor * dst);
-GGML_API void ggml_cuda_set_tensor_split(const float * tensor_split);
-GGML_API void ggml_cuda_transform_tensor(void * data, struct ggml_tensor * tensor);
-GGML_API void ggml_cuda_free_data(struct ggml_tensor * tensor);
-
-GGML_API void ggml_cuda_assign_buffers(struct ggml_tensor * tensor);
-GGML_API void ggml_cuda_assign_buffers_no_scratch(struct ggml_tensor * tensor);
-GGML_API void ggml_cuda_assign_buffers_force_inplace(struct ggml_tensor * tensor);
-
-GGML_API void ggml_cuda_assign_buffers_no_alloc(struct ggml_tensor * tensor);
-GGML_API void ggml_cuda_assign_scratch_offset(struct ggml_tensor * tensor, size_t offset);
-GGML_API void ggml_cuda_copy_to_device(struct ggml_tensor * tensor);
-
-GGML_API void ggml_cuda_set_main_device(int main_device);
-GGML_API void ggml_cuda_set_mul_mat_q(bool mul_mat_q);
-GGML_API void ggml_cuda_set_scratch_size(size_t scratch_size);
-GGML_API void ggml_cuda_free_scratch(void);
GGML_API bool ggml_cuda_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor);
GGML_API int ggml_cuda_get_device_count(void);
@@ -52,13 +36,17 @@ GGML_API void ggml_cuda_get_device_description(int device, char * description,
GGML_API ggml_backend_t ggml_backend_cuda_init(int device);
GGML_API bool ggml_backend_is_cuda(ggml_backend_t backend);
-GGML_API int ggml_backend_cuda_get_device(ggml_backend_t backend);
GGML_API ggml_backend_buffer_type_t ggml_backend_cuda_buffer_type(int device);
-
-// pinned host buffer for use with CPU backend for faster copies between CPU and GPU
+// split tensor buffer that splits matrices by rows across multiple devices
+GGML_API ggml_backend_buffer_type_t ggml_backend_cuda_split_buffer_type(const float * tensor_split);
+// pinned host buffer for use with the CPU backend for faster copies between CPU and GPU
GGML_API ggml_backend_buffer_type_t ggml_backend_cuda_host_buffer_type(void);
+GGML_API int ggml_backend_cuda_get_device_count(void);
+GGML_API void ggml_backend_cuda_get_device_description(int device, char * description, size_t description_size);
+GGML_API void ggml_backend_cuda_get_device_memory(int device, size_t * free, size_t * total);
+
#ifdef __cplusplus
}
#endif