ninetoothed 0.9.0__tar.gz → 0.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. ninetoothed-0.11.0/.github/workflows/publish-to-pypi.yml +92 -0
  2. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/PKG-INFO +1 -1
  3. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/pyproject.toml +1 -1
  4. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/src/ninetoothed/jit.py +5 -2
  5. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/src/ninetoothed/tensor.py +22 -15
  6. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/.github/workflows/pytest.yml +0 -0
  7. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/.github/workflows/ruff.yml +0 -0
  8. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/.gitignore +0 -0
  9. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/LICENSE +0 -0
  10. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/README.md +0 -0
  11. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/docs/README.zh.md +0 -0
  12. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/docs/source/_static/matmul-tiling.png +0 -0
  13. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/docs/source/_static/ninetoothed-logo.png +0 -0
  14. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/docs/source/_static/vecadd-tiling.png +0 -0
  15. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/requirements.txt +0 -0
  16. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/src/ninetoothed/__init__.py +0 -0
  17. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/src/ninetoothed/language.py +0 -0
  18. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/src/ninetoothed/naming.py +0 -0
  19. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/src/ninetoothed/symbol.py +0 -0
  20. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/src/ninetoothed/torchifier.py +0 -0
  21. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/tests/__init__.py +0 -0
  22. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/tests/skippers.py +0 -0
  23. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/tests/test_add.py +0 -0
  24. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/tests/test_addmm.py +0 -0
  25. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/tests/test_matmul.py +0 -0
  26. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/tests/test_naming.py +0 -0
  27. {ninetoothed-0.9.0 → ninetoothed-0.11.0}/tests/test_softmax.py +0 -0
@@ -0,0 +1,92 @@
1
+ name: Publish Python 🐍 distribution 📦 to PyPI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ name: Build distribution 📦
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ with:
13
+ persist-credentials: false
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.x"
18
+ - name: Install pypa/build
19
+ run: >-
20
+ python3 -m
21
+ pip install
22
+ build
23
+ --user
24
+ - name: Build a binary wheel and a source tarball
25
+ run: python3 -m build
26
+ - name: Store the distribution packages
27
+ uses: actions/upload-artifact@v4
28
+ with:
29
+ name: python-package-distributions
30
+ path: dist/
31
+
32
+ publish-to-pypi:
33
+ name: >-
34
+ Publish Python 🐍 distribution 📦 to PyPI
35
+ if: startsWith(github.ref, 'refs/tags/')
36
+ needs:
37
+ - build
38
+ runs-on: ubuntu-latest
39
+ environment:
40
+ name: pypi
41
+ url: https://pypi.org/p/ninetoothed
42
+ permissions:
43
+ id-token: write
44
+
45
+ steps:
46
+ - name: Download all the dists
47
+ uses: actions/download-artifact@v4
48
+ with:
49
+ name: python-package-distributions
50
+ path: dist/
51
+ - name: Publish distribution 📦 to PyPI
52
+ uses: pypa/gh-action-pypi-publish@release/v1
53
+
54
+ github-release:
55
+ name: >-
56
+ Sign the Python 🐍 distribution 📦 with Sigstore
57
+ and upload them to GitHub Release
58
+ needs:
59
+ - publish-to-pypi
60
+ runs-on: ubuntu-latest
61
+
62
+ permissions:
63
+ contents: write
64
+ id-token: write
65
+
66
+ steps:
67
+ - name: Download all the dists
68
+ uses: actions/download-artifact@v4
69
+ with:
70
+ name: python-package-distributions
71
+ path: dist/
72
+ - name: Sign the dists with Sigstore
73
+ uses: sigstore/gh-action-sigstore-python@v3.0.0
74
+ with:
75
+ inputs: >-
76
+ ./dist/*.tar.gz
77
+ ./dist/*.whl
78
+ - name: Create GitHub Release
79
+ env:
80
+ GITHUB_TOKEN: ${{ github.token }}
81
+ run: >-
82
+ gh release create
83
+ "$GITHUB_REF_NAME"
84
+ --repo "$GITHUB_REPOSITORY"
85
+ --notes ""
86
+ - name: Upload artifact signatures to GitHub Release
87
+ env:
88
+ GITHUB_TOKEN: ${{ github.token }}
89
+ run: >-
90
+ gh release upload
91
+ "$GITHUB_REF_NAME" dist/**
92
+ --repo "$GITHUB_REPOSITORY"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ninetoothed
3
- Version: 0.9.0
3
+ Version: 0.11.0
4
4
  Summary: A domain-specific language based on Triton but providing higher-level abstraction.
5
5
  Project-URL: Homepage, https://github.com/InfiniTensor/ninetoothed
6
6
  Project-URL: Issues, https://github.com/InfiniTensor/ninetoothed/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ninetoothed"
7
- version = "0.9.0"
7
+ version = "0.11.0"
8
8
  authors = [{ name = "Jiacheng Huang", email = "huangjiacheng0709@outlook.com" }]
9
9
  description = "A domain-specific language based on Triton but providing higher-level abstraction."
10
10
  readme = "README.md"
@@ -479,7 +479,7 @@ class CodeGenerator(ast.NodeTransformer):
479
479
  def _complete_indices(self, tensor, indices):
480
480
  indices = list(self._generate_pid_indices(tensor) + tuple(indices))
481
481
 
482
- for size in tensor.inmost().shape:
482
+ for size in tensor.innermost().shape:
483
483
  if Symbol.is_name(size):
484
484
  name = size.node.id
485
485
  if not naming.is_meta(name):
@@ -514,7 +514,10 @@ class CodeGenerator(ast.NodeTransformer):
514
514
 
515
515
  @staticmethod
516
516
  def _generate_slices(tensor, dim):
517
- return tuple(slice(None) if i == dim else None for i in range(tensor.ndim))
517
+ return tuple(
518
+ slice(None) if target_dim == dim else None
519
+ for target_dim in tensor.innermost().target_dims
520
+ )
518
521
 
519
522
  @staticmethod
520
523
  def _generate_offsets(tensor, indices):
@@ -112,14 +112,10 @@ class Tensor:
112
112
  strides=inner_strides,
113
113
  source=self.source,
114
114
  source_dims=self.source_dims,
115
- target=self.target,
116
- target_dims=self.target_dims,
117
115
  ),
118
116
  strides=outer_strides,
119
117
  source=self.source,
120
118
  source_dims=self.source_dims,
121
- target=self.target,
122
- target_dims=self.target_dims,
123
119
  )
124
120
 
125
121
  def expand(self, shape):
@@ -136,23 +132,28 @@ class Tensor:
136
132
  ],
137
133
  source=self.source,
138
134
  source_dims=self.source_dims,
139
- target=self.target,
140
135
  target_dims=self.target_dims,
141
136
  )
142
137
 
143
138
  def squeeze(self, dim):
139
+ if not isinstance(dim, tuple):
140
+ dim = (dim,)
141
+
144
142
  # TODO: Add error handling.
145
143
  return type(self)(
146
- shape=[size for i, size in enumerate(self.shape) if dim != i],
144
+ shape=[size for i, size in enumerate(self.shape) if i not in dim],
147
145
  dtype=self.dtype,
148
- strides=[stride for i, stride in enumerate(self.strides) if dim != i],
146
+ strides=[stride for i, stride in enumerate(self.strides) if i not in dim],
149
147
  source=self.source,
150
148
  source_dims=[
151
- source_dim for i, source_dim in enumerate(self.source_dims) if dim != i
149
+ source_dim
150
+ for i, source_dim in enumerate(self.source_dims)
151
+ if i not in dim
152
152
  ],
153
- target=self.target,
154
153
  target_dims=[
155
- target_dim for i, target_dim in enumerate(self.target_dims) if dim != i
154
+ target_dim
155
+ for i, target_dim in enumerate(self.target_dims)
156
+ if i not in dim
156
157
  ],
157
158
  )
158
159
 
@@ -173,7 +174,6 @@ class Tensor:
173
174
  strides=new_strides,
174
175
  source=self.source,
175
176
  source_dims=new_source_dims,
176
- target=self.target,
177
177
  target_dims=self.target_dims,
178
178
  )
179
179
 
@@ -204,14 +204,21 @@ class Tensor:
204
204
  leading_source_dims + (flattening_source_dims,) + trailing_source_dims
205
205
  )
206
206
 
207
+ leading_target_dims = self.target_dims[:start_dim]
208
+ flattening_target_dims = self.target_dims[start_dim:end_dim]
209
+ trailing_target_dims = self.target_dims[end_dim:]
210
+
211
+ new_target_dims = (
212
+ leading_target_dims + (flattening_target_dims[-1],) + trailing_target_dims
213
+ )
214
+
207
215
  return type(self)(
208
216
  shape=new_shape,
209
217
  dtype=self.dtype,
210
218
  strides=new_strides,
211
219
  source=self.source,
212
220
  source_dims=new_source_dims,
213
- target=self.target,
214
- target_dims=self.target_dims,
221
+ target_dims=new_target_dims,
215
222
  )
216
223
 
217
224
  def ravel(self):
@@ -250,11 +257,11 @@ class Tensor:
250
257
  | (self.source.names() if self.source is not self else set())
251
258
  )
252
259
 
253
- def inmost(self):
260
+ def innermost(self):
254
261
  if not isinstance(self.dtype, type(self)):
255
262
  return self
256
263
 
257
- return self.dtype.inmost()
264
+ return self.dtype.innermost()
258
265
 
259
266
  def pointer_string(self):
260
267
  return f"{self.name}_pointer"
File without changes
File without changes
File without changes