Marc Sun Claude Opus 5 (1M context) commited on
Commit
09da59d
·
1 Parent(s): 1f05408

rebuild metal for get_rows, and track artifacts by glob

Browse files

The published `.so` predates `get_rows`, so a client that asks for it gets an AttributeError and
falls back to unpacking whole tensors. Rebuilt from a clean tree, so the module carries the commit
it was built from rather than a `_dirty` name.

`.gitattributes` listed every artifact by path, one line per rebuild, and the entries outlived the
files. One glob covers whatever hash the next build stamps in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

.gitattributes CHANGED
@@ -33,28 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
- build/torch210-cxx11-cu126-x86_64-linux/_gguf_kernels_20260805124229.abi3.so filter=lfs diff=lfs merge=lfs -text
37
- build/torch210-cxx11-cu128-x86_64-linux/_gguf_kernels_20260805124229.abi3.so filter=lfs diff=lfs merge=lfs -text
38
- build/torch210-cxx11-cu130-x86_64-linux/_gguf_kernels_20260805124229.abi3.so filter=lfs diff=lfs merge=lfs -text
39
- build/torch28-cxx11-cu126-x86_64-linux/_gguf_kernels_20260805124229.abi3.so filter=lfs diff=lfs merge=lfs -text
40
- build/torch28-cxx11-cu128-x86_64-linux/_gguf_kernels_20260805124229.abi3.so filter=lfs diff=lfs merge=lfs -text
41
- build/torch28-cxx11-cu129-x86_64-linux/_gguf_kernels_20260805124229.abi3.so filter=lfs diff=lfs merge=lfs -text
42
- build/torch29-cxx11-cu126-x86_64-linux/_gguf_kernels_20260805124229.abi3.so filter=lfs diff=lfs merge=lfs -text
43
- build/torch29-cxx11-cu128-x86_64-linux/_gguf_kernels_20260805124229.abi3.so filter=lfs diff=lfs merge=lfs -text
44
- build/torch29-cxx11-cu130-x86_64-linux/_gguf_kernels_20260805124229.abi3.so filter=lfs diff=lfs merge=lfs -text
45
- build/torch211-cxx11-cu126-x86_64-linux/_gguf_kernels_cuda_e4e2164.abi3.so filter=lfs diff=lfs merge=lfs -text
46
- build/torch211-cxx11-cu128-x86_64-linux/_gguf_kernels_cuda_e4e2164.abi3.so filter=lfs diff=lfs merge=lfs -text
47
- build/torch211-cxx11-cu130-x86_64-linux/_gguf_kernels_cuda_e4e2164.abi3.so filter=lfs diff=lfs merge=lfs -text
48
- build/torch212-cxx11-cu126-x86_64-linux/_gguf_kernels_cuda_e4e2164.abi3.so filter=lfs diff=lfs merge=lfs -text
49
- build/torch212-cxx11-cu130-x86_64-linux/_gguf_kernels_cuda_e4e2164.abi3.so filter=lfs diff=lfs merge=lfs -text
50
- build/torch212-cxx11-cu132-x86_64-linux/_gguf_kernels_cuda_e4e2164.abi3.so filter=lfs diff=lfs merge=lfs -text
51
- build/torch212-metal-aarch64-darwin/_gguf_kernels_metal_0becb0a.abi3.so filter=lfs diff=lfs merge=lfs -text
52
- build/torch213-metal-aarch64-darwin/_gguf_kernels_metal_0becb0a.abi3.so filter=lfs diff=lfs merge=lfs -text
53
- build/torch212-cxx11-cu126-x86_64-linux/_gguf_kernels_cuda_1df3b99.abi3.so filter=lfs diff=lfs merge=lfs -text
54
- build/torch212-cxx11-cu130-x86_64-linux/_gguf_kernels_cuda_1df3b99.abi3.so filter=lfs diff=lfs merge=lfs -text
55
- build/torch212-cxx11-cu132-x86_64-linux/_gguf_kernels_cuda_1df3b99.abi3.so filter=lfs diff=lfs merge=lfs -text
56
- build/torch213-cxx11-cu126-x86_64-linux/_gguf_kernels_cuda_1df3b99.abi3.so filter=lfs diff=lfs merge=lfs -text
57
- build/torch213-cxx11-cu130-x86_64-linux/_gguf_kernels_cuda_1df3b99.abi3.so filter=lfs diff=lfs merge=lfs -text
58
- build/torch213-cxx11-cu132-x86_64-linux/_gguf_kernels_cuda_1df3b99.abi3.so filter=lfs diff=lfs merge=lfs -text
59
- build/torch212-metal-aarch64-darwin/_gguf_kernels_metal_7b10656.abi3.so filter=lfs diff=lfs merge=lfs -text
60
- build/torch213-metal-aarch64-darwin/_gguf_kernels_metal_7b10656.abi3.so filter=lfs diff=lfs merge=lfs -text
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ # Every built artifact, whatever hash the build stamps into its name.
37
+ build/**/*.abi3.so filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_7b10656.abi3.so → _ggml_quantization_metal_1f05408.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d5ea02aab35301ff5a378d86de62477becd6604cd56ef6000802c15677c9375d
3
- size 814816
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d731041e5f08c864b02363a29e9431fc8343d20c3e809456e83aedcb0108d609
3
+ size 817976
build/torch212-metal-aarch64-darwin/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _gguf_kernels_metal_7b10656
3
- ops = torch.ops._gguf_kernels_metal_7b10656
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_gguf_kernels_metal_7b10656::{op_name}"
 
1
  import torch
2
+ from . import _ggml_quantization_metal_1f05408
3
+ ops = torch.ops._ggml_quantization_metal_1f05408
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_ggml_quantization_metal_1f05408::{op_name}"
build/torch212-metal-aarch64-darwin/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
- "name": "gguf-kernels",
3
- "id": "_gguf_kernels_metal_7b10656",
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_7b10656.abi3.so": "1eoCqrNTAf9aN42G3mJHe+zWYEzVbvYACALBVnfJN10=",
15
- "_ops.py": "nwCRMS2OmSxach0Edkf8TLdxZXmrrMhMJntgxLN2MAI="
16
  }
17
  },
18
  "provenance": {
@@ -22,7 +22,7 @@
22
  "dirty": false
23
  },
24
  "kernel": {
25
- "sha": "7b106564513dead0e4416ea0c7d3898eb23e0ca2",
26
  "dirty": false
27
  }
28
  }
 
1
  {
2
+ "name": "ggml-quantization",
3
+ "id": "_ggml_quantization_metal_1f05408",
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_1f05408.abi3.so": "1zEEHl8IyGSwI2OinpQx/IND0gw+gJRW6DrtywEI1gk=",
15
+ "_ops.py": "jWnZSZuckU1udyY5AEqxJlvw8JDXMqm58DgbvdbdlpI="
16
  }
17
  },
18
  "provenance": {
 
22
  "dirty": false
23
  },
24
  "kernel": {
25
+ "sha": "1f0540807daf50af68e13f6e6db55bf3440101b3",
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_7b10656.abi3.so → _ggml_quantization_metal_1f05408.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e6dbb2eaefd58d768f8a9e30e89b08f1f7a139648b12fb8924a34caccbd8d066
3
- size 814816
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd4351ef7e2f79914badfece93f4d372e5146f8bbb1b4b7399fadffd8634f90c
3
+ size 817976
build/torch213-metal-aarch64-darwin/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _gguf_kernels_metal_7b10656
3
- ops = torch.ops._gguf_kernels_metal_7b10656
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_gguf_kernels_metal_7b10656::{op_name}"
 
1
  import torch
2
+ from . import _ggml_quantization_metal_1f05408
3
+ ops = torch.ops._ggml_quantization_metal_1f05408
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_ggml_quantization_metal_1f05408::{op_name}"
build/torch213-metal-aarch64-darwin/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
- "name": "gguf-kernels",
3
- "id": "_gguf_kernels_metal_7b10656",
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_7b10656.abi3.so": "5tuy6u/VjXaPip4w6JsI8fehOWSLEvuJJKNMrMvY0GY=",
15
- "_ops.py": "nwCRMS2OmSxach0Edkf8TLdxZXmrrMhMJntgxLN2MAI="
16
  }
17
  },
18
  "provenance": {
@@ -22,7 +22,7 @@
22
  "dirty": false
23
  },
24
  "kernel": {
25
- "sha": "7b106564513dead0e4416ea0c7d3898eb23e0ca2",
26
  "dirty": false
27
  }
28
  }
 
1
  {
2
+ "name": "ggml-quantization",
3
+ "id": "_ggml_quantization_metal_1f05408",
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_1f05408.abi3.so": "/UNR734veZFLrf7Ok/TTcuUUb4u7G0tzmfrf/YY0+Qw=",
15
+ "_ops.py": "jWnZSZuckU1udyY5AEqxJlvw8JDXMqm58DgbvdbdlpI="
16
  }
17
  },
18
  "provenance": {
 
22
  "dirty": false
23
  },
24
  "kernel": {
25
+ "sha": "1f0540807daf50af68e13f6e6db55bf3440101b3",
26
  "dirty": false
27
  }
28
  }