marcsun13 HF Staff commited on
Commit
91d239e
·
verified ·
1 Parent(s): 4a6bf26

Uploaded using `kernel-builder`.

Browse files
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:d6f5cda7143d4352cb1671e340f7495aed1c0005ddef924f687e74117c15775b
3
- size 814816
 
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 _gguf_kernels_metal_b4f7ed2
3
- ops = torch.ops._gguf_kernels_metal_b4f7ed2
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_gguf_kernels_metal_b4f7ed2::{op_name}"
 
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": "gguf-kernels",
3
- "id": "_gguf_kernels_metal_b4f7ed2",
4
  "version": 1,
5
  "license": "MIT",
6
  "python-depends": [],
@@ -10,9 +10,9 @@
10
  "digest": {
11
  "algorithm": "sha256",
12
  "files": {
13
- "__init__.py": "GoFcHJbbJ9C8b40XNznMxsTcC+CV9kaFE8a1DP763kU=",
14
- "_gguf_kernels_metal_b4f7ed2.abi3.so": "1vXNpxQ9Q1LLFnHjQPdJWu0cAAXd75JPaH50EXwVd1s=",
15
- "_ops.py": "nK7J3dCzRE3uvmtyRDGFaZJ7dOcht804Bgq4RVGex0E="
16
  }
17
  },
18
  "provenance": {
@@ -22,7 +22,7 @@
22
  "dirty": false
23
  },
24
  "kernel": {
25
- "sha": "b4f7ed2480df20d04cd0e47b5a18518bfd712b6e",
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:6a58f765ed13fc4403ab86e82143dabadba2a63d0ebeba855787516f881189d8
3
- size 814816
 
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 _gguf_kernels_metal_b4f7ed2
3
- ops = torch.ops._gguf_kernels_metal_b4f7ed2
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_gguf_kernels_metal_b4f7ed2::{op_name}"
 
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": "gguf-kernels",
3
- "id": "_gguf_kernels_metal_b4f7ed2",
4
  "version": 1,
5
  "license": "MIT",
6
  "python-depends": [],
@@ -10,9 +10,9 @@
10
  "digest": {
11
  "algorithm": "sha256",
12
  "files": {
13
- "__init__.py": "GoFcHJbbJ9C8b40XNznMxsTcC+CV9kaFE8a1DP763kU=",
14
- "_gguf_kernels_metal_b4f7ed2.abi3.so": "alj3Ze0T/EQDq4boIUPautuipj0OvrqFV4dRb4gRidg=",
15
- "_ops.py": "nK7J3dCzRE3uvmtyRDGFaZJ7dOcht804Bgq4RVGex0E="
16
  }
17
  },
18
  "provenance": {
@@ -22,7 +22,7 @@
22
  "dirty": false
23
  },
24
  "kernel": {
25
- "sha": "b4f7ed2480df20d04cd0e47b5a18518bfd712b6e",
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
  }