File size: 1,785 Bytes
2c20074
 
 
 
 
9534e0b
 
2c20074
 
55a081e
2c20074
97231ed
77f577c
 
 
2c20074
90ac035
55a081e
90ac035
2c20074
 
 
 
 
 
d297b20
 
 
 
77f577c
9534e0b
d297b20
 
 
 
9534e0b
 
 
 
 
 
 
 
d297b20
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# One backend per `[kernel.*]` section, all implementing the same two entry points declared in
# torch-ext/torch_binding.h. Adding Metal means adding a section and a `gguf_metal/` directory —
# no change to the bindings' schema or to the Python API.
#
# `vendor/` is a pinned subset of llama.cpp (revision in vendor/UPSTREAM); refresh it with
# `python vendor.py --rev <sha>`. It holds upstream's Metal kernels as they ship -- no local copy is
# generated from them.

[general]
name = "ggml-quantization"
version = 1
license = "MIT"
# Metal only for now. The cuda kernel and its build section were dropped rather than kept building
# untested -- `git log -- gguf_cuda` has them, and `vendor/` still carries ggml's cuda sources.
backends = ["metal"]

[general.hub]
repo-id = "marcsun13/ggml-quantization"

[torch]
src = [
    "torch-ext/torch_binding.cpp",
    "torch-ext/torch_binding.h",
]

[kernel.gguf_metal]
backend = "metal"
depends = ["torch"]
# ggml-metal.metal includes "ggml-common.h" from vendor/src, so the shader compile needs it
# on its include path.
include = ["gguf_metal", "torch-ext", "vendor/src", "vendor/src/ggml-metal", "vendor/src/ggml-metal/kernels"]
src = [
    "gguf_metal/gguf_metal.cpp",
    "gguf_metal/ggml_dispatch.mm",
    "gguf_metal/common.h",
    # Upstream's Metal kernels, compiled as they ship: one file per operation, so a package
    # lists the ones it dispatches.
    "vendor/src/ggml-metal/kernels/mul_mv.metal",
    "vendor/src/ggml-metal/kernels/mul_mm.metal",
    "vendor/src/ggml-metal/kernels/quantize.metal",
    "vendor/src/ggml-metal/kernels/common.h",
    "vendor/src/ggml-metal/kernels/dequantize.h",
    "vendor/src/ggml-metal/kernels/quantize.h",
    "vendor/src/ggml-metal/ggml-metal-impl.h",
    "vendor/src/ggml-common.h",
]