Skip to content

Commit

Permalink
Pull latest metal fixes from llama.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
LLukas22 committed Jul 27, 2023
1 parent 13e3d2a commit 3d5df47
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/ggml/sys/llama-cpp
Submodule llama-cpp updated 5 files
+1 −0 CMakeLists.txt
+2 −1 Makefile
+101 −77 ggml.c
+19 −2 ggml.h
+18 −17 llama.cpp
32 changes: 30 additions & 2 deletions crates/ggml/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,18 @@ pub const ggml_unary_op_GGML_UNARY_OP_GELU: ggml_unary_op = 7;
pub const ggml_unary_op_GGML_UNARY_OP_GELU_QUICK: ggml_unary_op = 8;
pub const ggml_unary_op_GGML_UNARY_OP_SILU: ggml_unary_op = 9;
pub type ggml_unary_op = ::std::os::raw::c_int;
pub const ggml_object_type_GGML_OBJECT_TENSOR: ggml_object_type = 0;
pub const ggml_object_type_GGML_OBJECT_GRAPH: ggml_object_type = 1;
pub const ggml_object_type_GGML_OBJECT_WORK_BUFFER: ggml_object_type = 2;
pub type ggml_object_type = ::std::os::raw::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_object {
pub offs: usize,
pub size: usize,
pub next: *mut ggml_object,
pub padding: [::std::os::raw::c_char; 8usize],
pub type_: ggml_object_type,
pub padding: [::std::os::raw::c_char; 4usize],
}
#[test]
fn bindgen_test_layout_ggml_object() {
Expand Down Expand Up @@ -211,8 +216,18 @@ fn bindgen_test_layout_ggml_object() {
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize },
unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(ggml_object),
"::",
stringify!(type_)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(ggml_object),
Expand Down Expand Up @@ -633,6 +648,7 @@ fn bindgen_test_layout_ggml_cgraph() {
)
);
}
pub const GGML_GRAPH_SIZE: usize = 164520;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ggml_scratch {
Expand Down Expand Up @@ -1845,6 +1861,18 @@ extern "C" {
keep: bool,
) -> ggml_cgraph;
}
extern "C" {
pub fn ggml_new_graph(ctx: *mut ggml_context) -> *mut ggml_cgraph;
}
extern "C" {
pub fn ggml_build_forward_ctx(
ctx: *mut ggml_context,
tensor: *mut ggml_tensor,
) -> *mut ggml_cgraph;
}
extern "C" {
pub fn ggml_graph_overhead() -> usize;
}
extern "C" {
pub fn ggml_graph_plan(
cgraph: *mut ggml_cgraph,
Expand Down

0 comments on commit 3d5df47

Please sign in to comment.