Skip to content

Commit 7544ad4

Browse files
aiskabetlen
andauthored
fix: bind ggml abort and backend guid API (#169)
* feat: bind ggml abort and backend guid APIs * fix: sync ggml public API bindings --------- Co-authored-by: abetlen <abetlen@gmail.com>
1 parent d12a040 commit 7544ad4

2 files changed

Lines changed: 29 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- fix: sync ggml binding signatures by @aisk in #170
10+
- fix: bind ggml abort and backend guid API by @aisk in #169
11+
- fix: sync updated gguf and backend binding signatures by @aisk in #170
1112

1213
## [0.0.43]
1314

ggml/ggml.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,21 @@ def ggml_set_abort_callback(callback: ggml_abort_callback_t, /) -> ggml_abort_ca
333333
...
334334

335335

336+
# GGML_API void ggml_abort(const char * file, int line, const char * fmt, ...);
337+
@ggml_function(
338+
"ggml_abort",
339+
[ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p],
340+
None,
341+
)
342+
def ggml_abort(
343+
file: bytes,
344+
line: Union[ctypes.c_int, int],
345+
fmt: bytes,
346+
*args: Any,
347+
) -> None:
348+
...
349+
350+
336351
# // ieee 754-2008 half-precision float16
337352
# // todo: make this not an integral type
338353
# typedef uint16_t ggml_fp16_t;
@@ -12634,11 +12649,13 @@ def ggml_gallocr_new(
1263412649
# GGML_API ggml_gallocr_t ggml_gallocr_new_n(ggml_backend_buffer_type_t * bufts, int n_bufs);
1263512650
@ggml_function(
1263612651
"ggml_gallocr_new_n",
12637-
[ggml_backend_buffer_type_t_ctypes, ctypes.c_int],
12652+
[ctypes.POINTER(ggml_backend_buffer_type_t_ctypes), ctypes.c_int],
1263812653
ggml_gallocr_ctypes,
1263912654
)
1264012655
def ggml_gallocr_new_n(
12641-
bufts: Union[ggml_backend_buffer_type_t, int], n_bufs: int, /
12656+
bufts: "ctypes._Pointer[ggml_backend_buffer_type_t]", # type: ignore
12657+
n_bufs: int,
12658+
/,
1264212659
) -> Optional[ggml_gallocr]:
1264312660
...
1264412661

@@ -13061,7 +13078,14 @@ def ggml_backend_buffer_reset(buffer: Union[ggml_backend_buffer_t, int], /):
1306113078

1306213079

1306313080
# GGML_API ggml_guid_t ggml_backend_guid(ggml_backend_t backend);
13064-
def ggml_backend_guid(backend: Union[ggml_backend_t, int], /) -> int:
13081+
@ggml_function(
13082+
"ggml_backend_guid",
13083+
[ggml_backend_t_ctypes],
13084+
ggml_guid_t_ctypes,
13085+
)
13086+
def ggml_backend_guid(
13087+
backend: Union[ggml_backend_t, int], /
13088+
) -> Optional[ggml_guid_t]:
1306513089
...
1306613090

1306713091

0 commit comments

Comments
 (0)