Uploaded using `kernel-builder`.
Browse files- build/torch212-metal-aarch64-darwin/__init__.py +17 -1
- build/torch212-metal-aarch64-darwin/{_gguf_kernels_metal_b4f7ed2.abi3.so → _ggml_quantization_metal_09da59d.abi3.so} +2 -2
- build/torch212-metal-aarch64-darwin/_ops.py +3 -3
- build/torch212-metal-aarch64-darwin/metadata.json +6 -6
- build/torch213-metal-aarch64-darwin/__init__.py +17 -1
- build/torch213-metal-aarch64-darwin/{_gguf_kernels_metal_b4f7ed2.abi3.so → _ggml_quantization_metal_09da59d.abi3.so} +2 -2
- build/torch213-metal-aarch64-darwin/_ops.py +3 -3
- build/torch213-metal-aarch64-darwin/metadata.json +6 -6
build/torch212-metal-aarch64-darwin/__init__.py
CHANGED
|
@@ -14,7 +14,7 @@ import torch
|
|
| 14 |
from ._ops import add_op_namespace_prefix, ops
|
| 15 |
|
| 16 |
|
| 17 |
-
__all__ = ["GEMV_TYPES", "MAX_GEMV_ROWS", "dequantize", "mul_mat_vec"]
|
| 18 |
|
| 19 |
# Upstream's MMVQ_MAX_BATCH_SIZE: `mul_mat_vec` has no implementation beyond this many rows, so a
|
| 20 |
# caller with more (prefill) dequantizes and uses an ordinary matmul.
|
|
@@ -32,6 +32,17 @@ except AttributeError:
|
|
| 32 |
GEMV_TYPES = frozenset({2, 3, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 29, 39, 40, 41, 42})
|
| 33 |
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
def dequantize(
|
| 36 |
blocks: torch.Tensor, ggml_type: int, rows: int, cols: int, dtype: torch.dtype
|
| 37 |
) -> torch.Tensor:
|
|
@@ -52,6 +63,11 @@ def mul_mat_vec(
|
|
| 52 |
|
| 53 |
|
| 54 |
# Without these, torch.compile cannot trace the ops and breaks the graph at every call.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
@torch.library.register_fake(add_op_namespace_prefix("dequantize"))
|
| 56 |
def _dequantize_fake(blocks, ggml_type, rows, cols, dtype):
|
| 57 |
return blocks.new_empty((rows, cols), dtype=dtype)
|
|
|
|
| 14 |
from ._ops import add_op_namespace_prefix, ops
|
| 15 |
|
| 16 |
|
| 17 |
+
__all__ = ["GEMV_TYPES", "MAX_GEMV_ROWS", "dequantize", "get_rows", "mul_mat_vec"]
|
| 18 |
|
| 19 |
# Upstream's MMVQ_MAX_BATCH_SIZE: `mul_mat_vec` has no implementation beyond this many rows, so a
|
| 20 |
# caller with more (prefill) dequantizes and uses an ordinary matmul.
|
|
|
|
| 32 |
GEMV_TYPES = frozenset({2, 3, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 29, 39, 40, 41, 42})
|
| 33 |
|
| 34 |
|
| 35 |
+
def get_rows(
|
| 36 |
+
blocks: torch.Tensor, indices: torch.Tensor, ggml_type: int, cols: int, dtype: torch.dtype
|
| 37 |
+
) -> torch.Tensor:
|
| 38 |
+
"""The rows `indices` names, unpacked: `(rows, bytes_per_row)` uint8 -> `(len(indices), cols)`.
|
| 39 |
+
|
| 40 |
+
ggml's `get_rows`, which dequantizes as it gathers -- so reading a few rows out of a large table
|
| 41 |
+
never touches the rest.
|
| 42 |
+
"""
|
| 43 |
+
return ops.get_rows(blocks, indices, ggml_type, cols, dtype)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
def dequantize(
|
| 47 |
blocks: torch.Tensor, ggml_type: int, rows: int, cols: int, dtype: torch.dtype
|
| 48 |
) -> torch.Tensor:
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
# Without these, torch.compile cannot trace the ops and breaks the graph at every call.
|
| 66 |
+
@torch.library.register_fake(add_op_namespace_prefix("get_rows"))
|
| 67 |
+
def _get_rows_fake(blocks, indices, ggml_type, cols, dtype):
|
| 68 |
+
return blocks.new_empty((indices.numel(), cols), dtype=dtype)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
@torch.library.register_fake(add_op_namespace_prefix("dequantize"))
|
| 72 |
def _dequantize_fake(blocks, ggml_type, rows, cols, dtype):
|
| 73 |
return blocks.new_empty((rows, cols), dtype=dtype)
|
build/torch212-metal-aarch64-darwin/{_gguf_kernels_metal_b4f7ed2.abi3.so → _ggml_quantization_metal_09da59d.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f3ec2c0bd762a1cb5855006a816cdb22f18c11e969006d17131460e35e577ebb
|
| 3 |
+
size 817976
|
build/torch212-metal-aarch64-darwin/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _ggml_quantization_metal_09da59d
|
| 3 |
+
ops = torch.ops._ggml_quantization_metal_09da59d
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_ggml_quantization_metal_09da59d::{op_name}"
|
build/torch212-metal-aarch64-darwin/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
-
"name": "
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
@@ -10,9 +10,9 @@
|
|
| 10 |
"digest": {
|
| 11 |
"algorithm": "sha256",
|
| 12 |
"files": {
|
| 13 |
-
"__init__.py": "
|
| 14 |
-
"
|
| 15 |
-
"_ops.py": "
|
| 16 |
}
|
| 17 |
},
|
| 18 |
"provenance": {
|
|
@@ -22,7 +22,7 @@
|
|
| 22 |
"dirty": false
|
| 23 |
},
|
| 24 |
"kernel": {
|
| 25 |
-
"sha": "
|
| 26 |
"dirty": false
|
| 27 |
}
|
| 28 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"name": "ggml-quantization",
|
| 3 |
+
"id": "_ggml_quantization_metal_09da59d",
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
|
|
| 10 |
"digest": {
|
| 11 |
"algorithm": "sha256",
|
| 12 |
"files": {
|
| 13 |
+
"__init__.py": "68gDnPDp55W5ZSVOVBPJqML9O/YHq9mzcdCvNs4rnEg=",
|
| 14 |
+
"_ggml_quantization_metal_09da59d.abi3.so": "8+wsC9dioctYVQBqgWzbIvGMEelpAG0XExRg415Xfrs=",
|
| 15 |
+
"_ops.py": "KPScFwQZRvXLLvmzyYkY4+0hIJB+X5ZJ9opUxecMnZs="
|
| 16 |
}
|
| 17 |
},
|
| 18 |
"provenance": {
|
|
|
|
| 22 |
"dirty": false
|
| 23 |
},
|
| 24 |
"kernel": {
|
| 25 |
+
"sha": "09da59d51d3f73baa39a941eb07bf6c386223f82",
|
| 26 |
"dirty": false
|
| 27 |
}
|
| 28 |
}
|
build/torch213-metal-aarch64-darwin/__init__.py
CHANGED
|
@@ -14,7 +14,7 @@ import torch
|
|
| 14 |
from ._ops import add_op_namespace_prefix, ops
|
| 15 |
|
| 16 |
|
| 17 |
-
__all__ = ["GEMV_TYPES", "MAX_GEMV_ROWS", "dequantize", "mul_mat_vec"]
|
| 18 |
|
| 19 |
# Upstream's MMVQ_MAX_BATCH_SIZE: `mul_mat_vec` has no implementation beyond this many rows, so a
|
| 20 |
# caller with more (prefill) dequantizes and uses an ordinary matmul.
|
|
@@ -32,6 +32,17 @@ except AttributeError:
|
|
| 32 |
GEMV_TYPES = frozenset({2, 3, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 29, 39, 40, 41, 42})
|
| 33 |
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
def dequantize(
|
| 36 |
blocks: torch.Tensor, ggml_type: int, rows: int, cols: int, dtype: torch.dtype
|
| 37 |
) -> torch.Tensor:
|
|
@@ -52,6 +63,11 @@ def mul_mat_vec(
|
|
| 52 |
|
| 53 |
|
| 54 |
# Without these, torch.compile cannot trace the ops and breaks the graph at every call.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
@torch.library.register_fake(add_op_namespace_prefix("dequantize"))
|
| 56 |
def _dequantize_fake(blocks, ggml_type, rows, cols, dtype):
|
| 57 |
return blocks.new_empty((rows, cols), dtype=dtype)
|
|
|
|
| 14 |
from ._ops import add_op_namespace_prefix, ops
|
| 15 |
|
| 16 |
|
| 17 |
+
__all__ = ["GEMV_TYPES", "MAX_GEMV_ROWS", "dequantize", "get_rows", "mul_mat_vec"]
|
| 18 |
|
| 19 |
# Upstream's MMVQ_MAX_BATCH_SIZE: `mul_mat_vec` has no implementation beyond this many rows, so a
|
| 20 |
# caller with more (prefill) dequantizes and uses an ordinary matmul.
|
|
|
|
| 32 |
GEMV_TYPES = frozenset({2, 3, 6, 7, 8, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 29, 39, 40, 41, 42})
|
| 33 |
|
| 34 |
|
| 35 |
+
def get_rows(
|
| 36 |
+
blocks: torch.Tensor, indices: torch.Tensor, ggml_type: int, cols: int, dtype: torch.dtype
|
| 37 |
+
) -> torch.Tensor:
|
| 38 |
+
"""The rows `indices` names, unpacked: `(rows, bytes_per_row)` uint8 -> `(len(indices), cols)`.
|
| 39 |
+
|
| 40 |
+
ggml's `get_rows`, which dequantizes as it gathers -- so reading a few rows out of a large table
|
| 41 |
+
never touches the rest.
|
| 42 |
+
"""
|
| 43 |
+
return ops.get_rows(blocks, indices, ggml_type, cols, dtype)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
def dequantize(
|
| 47 |
blocks: torch.Tensor, ggml_type: int, rows: int, cols: int, dtype: torch.dtype
|
| 48 |
) -> torch.Tensor:
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
# Without these, torch.compile cannot trace the ops and breaks the graph at every call.
|
| 66 |
+
@torch.library.register_fake(add_op_namespace_prefix("get_rows"))
|
| 67 |
+
def _get_rows_fake(blocks, indices, ggml_type, cols, dtype):
|
| 68 |
+
return blocks.new_empty((indices.numel(), cols), dtype=dtype)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
@torch.library.register_fake(add_op_namespace_prefix("dequantize"))
|
| 72 |
def _dequantize_fake(blocks, ggml_type, rows, cols, dtype):
|
| 73 |
return blocks.new_empty((rows, cols), dtype=dtype)
|
build/torch213-metal-aarch64-darwin/{_gguf_kernels_metal_b4f7ed2.abi3.so → _ggml_quantization_metal_09da59d.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:391156ef4b8ec8f557c1ecb59a89d716a289e41e1c3853c6f0566330aafe196a
|
| 3 |
+
size 817976
|
build/torch213-metal-aarch64-darwin/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _ggml_quantization_metal_09da59d
|
| 3 |
+
ops = torch.ops._ggml_quantization_metal_09da59d
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_ggml_quantization_metal_09da59d::{op_name}"
|
build/torch213-metal-aarch64-darwin/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
-
"name": "
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
@@ -10,9 +10,9 @@
|
|
| 10 |
"digest": {
|
| 11 |
"algorithm": "sha256",
|
| 12 |
"files": {
|
| 13 |
-
"__init__.py": "
|
| 14 |
-
"
|
| 15 |
-
"_ops.py": "
|
| 16 |
}
|
| 17 |
},
|
| 18 |
"provenance": {
|
|
@@ -22,7 +22,7 @@
|
|
| 22 |
"dirty": false
|
| 23 |
},
|
| 24 |
"kernel": {
|
| 25 |
-
"sha": "
|
| 26 |
"dirty": false
|
| 27 |
}
|
| 28 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"name": "ggml-quantization",
|
| 3 |
+
"id": "_ggml_quantization_metal_09da59d",
|
| 4 |
"version": 1,
|
| 5 |
"license": "MIT",
|
| 6 |
"python-depends": [],
|
|
|
|
| 10 |
"digest": {
|
| 11 |
"algorithm": "sha256",
|
| 12 |
"files": {
|
| 13 |
+
"__init__.py": "68gDnPDp55W5ZSVOVBPJqML9O/YHq9mzcdCvNs4rnEg=",
|
| 14 |
+
"_ggml_quantization_metal_09da59d.abi3.so": "ORFW70uOyPVXwey1monXFqKJ5B4cOFPG8FZjMKr+GWo=",
|
| 15 |
+
"_ops.py": "KPScFwQZRvXLLvmzyYkY4+0hIJB+X5ZJ9opUxecMnZs="
|
| 16 |
}
|
| 17 |
},
|
| 18 |
"provenance": {
|
|
|
|
| 22 |
"dirty": false
|
| 23 |
},
|
| 24 |
"kernel": {
|
| 25 |
+
"sha": "09da59d51d3f73baa39a941eb07bf6c386223f82",
|
| 26 |
"dirty": false
|
| 27 |
}
|
| 28 |
}
|