tinygrad 0.9.1__py3-none-any.whl → 0.9.2__py3-none-any.whl
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.
- tinygrad/codegen/kernel.py +248 -115
- tinygrad/codegen/lowerer.py +215 -0
- tinygrad/codegen/transcendental.py +310 -0
- tinygrad/codegen/uopgraph.py +622 -0
- tinygrad/codegen/uops.py +235 -393
- tinygrad/device.py +428 -69
- tinygrad/dtype.py +18 -4
- tinygrad/engine/graph.py +19 -32
- tinygrad/engine/jit.py +148 -70
- tinygrad/engine/realize.py +127 -51
- tinygrad/engine/schedule.py +259 -216
- tinygrad/engine/search.py +29 -22
- tinygrad/function.py +9 -0
- tinygrad/helpers.py +87 -49
- tinygrad/lazy.py +34 -35
- tinygrad/multi.py +41 -36
- tinygrad/nn/__init__.py +39 -22
- tinygrad/nn/state.py +3 -3
- tinygrad/ops.py +63 -62
- tinygrad/renderer/__init__.py +43 -21
- tinygrad/renderer/assembly.py +104 -106
- tinygrad/renderer/cstyle.py +87 -60
- tinygrad/renderer/llvmir.py +21 -30
- tinygrad/runtime/autogen/amd_gpu.py +25208 -5753
- tinygrad/runtime/autogen/cuda.py +6 -162
- tinygrad/runtime/autogen/kfd.py +32 -0
- tinygrad/runtime/autogen/libc.py +4260 -0
- tinygrad/runtime/autogen/nvrtc.py +579 -0
- tinygrad/runtime/graph/clang.py +2 -2
- tinygrad/runtime/graph/cuda.py +8 -11
- tinygrad/runtime/graph/hcq.py +120 -107
- tinygrad/runtime/graph/metal.py +18 -15
- tinygrad/runtime/ops_amd.py +197 -305
- tinygrad/runtime/ops_clang.py +2 -2
- tinygrad/runtime/ops_cuda.py +36 -94
- tinygrad/runtime/ops_disk.py +3 -7
- tinygrad/runtime/ops_gpu.py +4 -2
- tinygrad/runtime/ops_hip.py +70 -0
- tinygrad/runtime/ops_metal.py +38 -27
- tinygrad/runtime/ops_nv.py +283 -363
- tinygrad/runtime/ops_python.py +26 -30
- tinygrad/runtime/support/compiler_cuda.py +78 -0
- tinygrad/runtime/{driver/hip_comgr.py → support/compiler_hip.py} +15 -1
- tinygrad/runtime/support/elf.py +38 -0
- tinygrad/shape/shapetracker.py +5 -14
- tinygrad/shape/symbolic.py +4 -8
- tinygrad/shape/view.py +34 -22
- tinygrad/tensor.py +399 -97
- {tinygrad-0.9.1.dist-info → tinygrad-0.9.2.dist-info}/METADATA +49 -48
- tinygrad-0.9.2.dist-info/RECORD +70 -0
- {tinygrad-0.9.1.dist-info → tinygrad-0.9.2.dist-info}/WHEEL +1 -1
- tinygrad/codegen/linearizer.py +0 -528
- tinygrad-0.9.1.dist-info/RECORD +0 -63
- /tinygrad/runtime/{driver → support}/__init__.py +0 -0
- {tinygrad-0.9.1.dist-info → tinygrad-0.9.2.dist-info}/LICENSE +0 -0
- {tinygrad-0.9.1.dist-info → tinygrad-0.9.2.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tinygrad
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.2
|
4
4
|
Summary: You like pytorch? You like micrograd? You love tinygrad! <3
|
5
5
|
Author: George Hotz
|
6
6
|
License: MIT
|
@@ -10,49 +10,51 @@ Requires-Python: >=3.8
|
|
10
10
|
Description-Content-Type: text/markdown
|
11
11
|
License-File: LICENSE
|
12
12
|
Requires-Dist: numpy
|
13
|
-
Requires-Dist: pyobjc-framework-Metal
|
14
|
-
Requires-Dist: pyobjc-framework-libdispatch
|
13
|
+
Requires-Dist: pyobjc-framework-Metal; platform_system == "Darwin"
|
14
|
+
Requires-Dist: pyobjc-framework-libdispatch; platform_system == "Darwin"
|
15
15
|
Provides-Extra: arm
|
16
|
-
Requires-Dist: unicorn
|
16
|
+
Requires-Dist: unicorn; extra == "arm"
|
17
17
|
Provides-Extra: docs
|
18
|
-
Requires-Dist: mkdocs
|
19
|
-
Requires-Dist:
|
20
|
-
Requires-Dist:
|
21
|
-
Requires-Dist: markdown-
|
22
|
-
Requires-Dist:
|
18
|
+
Requires-Dist: mkdocs; extra == "docs"
|
19
|
+
Requires-Dist: mkdocs-material; extra == "docs"
|
20
|
+
Requires-Dist: mkdocstrings[python]; extra == "docs"
|
21
|
+
Requires-Dist: markdown-callouts; extra == "docs"
|
22
|
+
Requires-Dist: markdown-exec[ansi]; extra == "docs"
|
23
|
+
Requires-Dist: black; extra == "docs"
|
23
24
|
Provides-Extra: linting
|
24
|
-
Requires-Dist: pylint
|
25
|
-
Requires-Dist: mypy
|
26
|
-
Requires-Dist: typing-extensions
|
27
|
-
Requires-Dist: pre-commit
|
28
|
-
Requires-Dist: ruff
|
29
|
-
Requires-Dist: types-tqdm
|
25
|
+
Requires-Dist: pylint; extra == "linting"
|
26
|
+
Requires-Dist: mypy; extra == "linting"
|
27
|
+
Requires-Dist: typing-extensions; extra == "linting"
|
28
|
+
Requires-Dist: pre-commit; extra == "linting"
|
29
|
+
Requires-Dist: ruff; extra == "linting"
|
30
|
+
Requires-Dist: types-tqdm; extra == "linting"
|
30
31
|
Provides-Extra: llvm
|
31
|
-
Requires-Dist: llvmlite
|
32
|
+
Requires-Dist: llvmlite; extra == "llvm"
|
32
33
|
Provides-Extra: testing
|
33
|
-
Requires-Dist: torch
|
34
|
-
Requires-Dist: pillow
|
35
|
-
Requires-Dist: pytest
|
36
|
-
Requires-Dist: pytest-xdist
|
37
|
-
Requires-Dist: onnx
|
38
|
-
Requires-Dist: onnx2torch
|
39
|
-
Requires-Dist: opencv-python
|
40
|
-
Requires-Dist: tabulate
|
41
|
-
Requires-Dist: tqdm
|
42
|
-
Requires-Dist: safetensors
|
43
|
-
Requires-Dist: transformers
|
44
|
-
Requires-Dist: sentencepiece
|
45
|
-
Requires-Dist: tiktoken
|
46
|
-
Requires-Dist:
|
47
|
-
Requires-Dist:
|
48
|
-
Requires-Dist:
|
49
|
-
Requires-Dist:
|
50
|
-
Requires-Dist:
|
34
|
+
Requires-Dist: torch; extra == "testing"
|
35
|
+
Requires-Dist: pillow; extra == "testing"
|
36
|
+
Requires-Dist: pytest; extra == "testing"
|
37
|
+
Requires-Dist: pytest-xdist; extra == "testing"
|
38
|
+
Requires-Dist: onnx==1.16.0; extra == "testing"
|
39
|
+
Requires-Dist: onnx2torch; extra == "testing"
|
40
|
+
Requires-Dist: opencv-python; extra == "testing"
|
41
|
+
Requires-Dist: tabulate; extra == "testing"
|
42
|
+
Requires-Dist: tqdm; extra == "testing"
|
43
|
+
Requires-Dist: safetensors; extra == "testing"
|
44
|
+
Requires-Dist: transformers; extra == "testing"
|
45
|
+
Requires-Dist: sentencepiece; extra == "testing"
|
46
|
+
Requires-Dist: tiktoken; extra == "testing"
|
47
|
+
Requires-Dist: blobfile; extra == "testing"
|
48
|
+
Requires-Dist: librosa; extra == "testing"
|
49
|
+
Requires-Dist: networkx; extra == "testing"
|
50
|
+
Requires-Dist: hypothesis; extra == "testing"
|
51
|
+
Requires-Dist: nibabel; extra == "testing"
|
52
|
+
Requires-Dist: bottle; extra == "testing"
|
51
53
|
Provides-Extra: testing_tf
|
52
|
-
Requires-Dist: tensorflow
|
53
|
-
Requires-Dist: tensorflow-addons
|
54
|
+
Requires-Dist: tensorflow==2.15.1; extra == "testing-tf"
|
55
|
+
Requires-Dist: tensorflow-addons; extra == "testing-tf"
|
54
56
|
Provides-Extra: triton
|
55
|
-
Requires-Dist: triton-nightly
|
57
|
+
Requires-Dist: triton-nightly>=2.1.0.dev20231014192330; extra == "triton"
|
56
58
|
|
57
59
|
<div align="center">
|
58
60
|
|
@@ -107,7 +109,7 @@ And we can change `DEBUG` to `4` to see the generated code.
|
|
107
109
|
As it turns out, 90% of what you need for neural networks are a decent autograd/tensor library.
|
108
110
|
Throw in an optimizer, a data loader, and some compute, and you have all you need.
|
109
111
|
|
110
|
-
```
|
112
|
+
```python
|
111
113
|
from tinygrad import Tensor, nn
|
112
114
|
|
113
115
|
class LinearNet:
|
@@ -122,11 +124,12 @@ optim = nn.optim.Adam([model.l1, model.l2], lr=0.001)
|
|
122
124
|
|
123
125
|
x, y = Tensor.rand(4, 1, 28, 28), Tensor([2,4,3,7]) # replace with real mnist dataloader
|
124
126
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
127
|
+
with Tensor.train():
|
128
|
+
for i in range(10):
|
129
|
+
optim.zero_grad()
|
130
|
+
loss = model(x).sparse_categorical_crossentropy(y).backward()
|
131
|
+
optim.step()
|
132
|
+
print(i, loss.item())
|
130
133
|
```
|
131
134
|
|
132
135
|
See [examples/beautiful_mnist.py](examples/beautiful_mnist.py) for the full version that gets 98% in ~5 seconds
|
@@ -169,7 +172,7 @@ Documentation along with a quick start guide can be found on the [docs website](
|
|
169
172
|
|
170
173
|
### Quick example comparing to PyTorch
|
171
174
|
|
172
|
-
```
|
175
|
+
```python
|
173
176
|
from tinygrad import Tensor
|
174
177
|
|
175
178
|
x = Tensor.eye(3, requires_grad=True)
|
@@ -182,7 +185,7 @@ print(y.grad.numpy()) # dz/dy
|
|
182
185
|
```
|
183
186
|
|
184
187
|
The same thing but in PyTorch:
|
185
|
-
```
|
188
|
+
```python
|
186
189
|
import torch
|
187
190
|
|
188
191
|
x = torch.eye(3, requires_grad=True)
|
@@ -230,6 +233,4 @@ python3 -m pytest test/ # whole test suite
|
|
230
233
|
|
231
234
|
#### Process replay tests
|
232
235
|
|
233
|
-
[Process replay](https://github.com/tinygrad/tinygrad/blob/master/test/external/process_replay/process_replay.py)
|
234
|
-
|
235
|
-
You can enable process replay by adding [run_process_replay] to your PR title. [example](https://github.com/tinygrad/tinygrad/pull/4995). Note that you should keep your branch up-to-date with master.
|
236
|
+
[Process replay](https://github.com/tinygrad/tinygrad/blob/master/test/external/process_replay/process_replay.py) compares your PR's generated kernels against master. If your PR is a refactor or speedup without any expected behavior change, It should include [run_process_replay] in the PR title, [example](https://github.com/tinygrad/tinygrad/pull/4995). Note that you should keep your branch up-to-date with master.
|
@@ -0,0 +1,70 @@
|
|
1
|
+
tinygrad/__init__.py,sha256=jC-35zswLSXLuRRThG_o6yar6qQjLCqmeaFCj_XKN08,449
|
2
|
+
tinygrad/device.py,sha256=uvDwBQJJQlgWazCezWs1S-3WaQ_MLRTmwa73oTtvK64,34152
|
3
|
+
tinygrad/dtype.py,sha256=Hh5l5DjdKEAbBNEMYXOo6GfFvnrpufT3__PIapfod9c,6983
|
4
|
+
tinygrad/function.py,sha256=TbwXlfkw6_KV2NTZlmKSXM8sQ6W_ptHNYfKk3iEvhRM,9843
|
5
|
+
tinygrad/helpers.py,sha256=lpNJdhTYVOOCt-ucOQcx_CXHOLJibJr8Rq9Qj2vtxQE,19623
|
6
|
+
tinygrad/lazy.py,sha256=sLvHJXAlRUIb_IFrgYG1Z-67a07Cp5W3wkjC1g9a5ZQ,13519
|
7
|
+
tinygrad/multi.py,sha256=AM140sWiJ1fMonrFeNgSToQpIPLVBROTtUKip7j-Kfc,11826
|
8
|
+
tinygrad/ops.py,sha256=U7VnO3tzTiMYz2uZWLIqABeUMLYGeMlqF_HKKa1bJSM,9126
|
9
|
+
tinygrad/tensor.py,sha256=-ecQNXusEaviQ2GekU-gT9gCmm4bgK-W6z0Ks8ZU2NE,146572
|
10
|
+
tinygrad/codegen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
+
tinygrad/codegen/kernel.py,sha256=ujW3FP_QhVaN3DkHFIYn6T3C_lAn4B46J9wA7egpVEg,45498
|
12
|
+
tinygrad/codegen/lowerer.py,sha256=QlSvyfC0ArBeU9fk1p8EDmvDUk3h09foLXavduGQb8s,12785
|
13
|
+
tinygrad/codegen/transcendental.py,sha256=StsilaZrKsFkhr87Hi-phIY33GE3-JwpsdeWKlkTnMI,15952
|
14
|
+
tinygrad/codegen/uopgraph.py,sha256=dqoFYaYzIi-d84BW5icla52h5tBt3XTpW0pZMEh9VmQ,34703
|
15
|
+
tinygrad/codegen/uops.py,sha256=nNGawVwDip1wrjmZo4_h3IzVZdlDekAzE-DBLb0e6MM,17982
|
16
|
+
tinygrad/engine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
+
tinygrad/engine/graph.py,sha256=UVWidfzq-0egC2eTdWipHq1KcVL2QDCEDdKRlQLyBII,4460
|
18
|
+
tinygrad/engine/jit.py,sha256=UgtJvQ4l0qwEnODsq0pnlrjSu4QNVR_MzePUmMLunqs,14913
|
19
|
+
tinygrad/engine/realize.py,sha256=IZIprUiLK7ZXCNoNwwncMGXHzisPZrPujDRvn1FPBJw,16278
|
20
|
+
tinygrad/engine/schedule.py,sha256=m3ZXuzwuBNTSJfZEmPScEIK9CjuJlzpsA0pQpIw6RNA,23267
|
21
|
+
tinygrad/engine/search.py,sha256=USdp09qeI77O-X49dRpdcqkkttJSeqrhkYzZidHuvtw,11897
|
22
|
+
tinygrad/nn/__init__.py,sha256=1qBOLiX4dO-rnT18vAcgQmS3HZLGk3mamWwJDkgrghM,13455
|
23
|
+
tinygrad/nn/datasets.py,sha256=3tau-L-HiopP1leFDXZV-VamCR0DxOhAu6wVOkAVSZY,493
|
24
|
+
tinygrad/nn/optim.py,sha256=zf85kwumpS17fk1NBjUfe7tOUE7-XH37SL-LjgAfva8,6799
|
25
|
+
tinygrad/nn/state.py,sha256=JuD5wupcbELMI3wUKxcWMXHXUQ838ShNtWSZCz2uO0o,10016
|
26
|
+
tinygrad/renderer/__init__.py,sha256=qim-xGwt5Pz1ka9p4b8SQxwZ4ulYwbAa3Y5XV_SVhM0,3794
|
27
|
+
tinygrad/renderer/assembly.py,sha256=oDfgdTGkfhQ3aN8x0M0GJUU3wDZzHNP13gukSllTxvU,17890
|
28
|
+
tinygrad/renderer/cstyle.py,sha256=7YuYBkHPHXTrudXbGsyDK3h9CG28Qn68V7x4HrCB428,26022
|
29
|
+
tinygrad/renderer/llvmir.py,sha256=uu688N3pJC90lZrZ2PXiByjZltYjmRBjaOn9RJBGT24,9585
|
30
|
+
tinygrad/runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
|
+
tinygrad/runtime/ops_amd.py,sha256=1vAvFM4mk4tQa9fCJAG618HEhnQGQg6Db8QaVLukfJE,27117
|
32
|
+
tinygrad/runtime/ops_clang.py,sha256=0Hhb3du_Spr0z3qdDBx40eb2O1tIcCOFYBxrJTVoY3Y,1475
|
33
|
+
tinygrad/runtime/ops_cuda.py,sha256=7CXzI0WgzVpQu5zFZ03vxlMqkv97f5vRR88JXPi1dDE,6857
|
34
|
+
tinygrad/runtime/ops_disk.py,sha256=OuLPnVRGkuNutF25N53dGkALcJl7ECCf_0TwYSZADas,6497
|
35
|
+
tinygrad/runtime/ops_gpu.py,sha256=w1n95YB84ltLbRqyaWhzAryCUCzqhf8Epk1TzU4Hp6U,7774
|
36
|
+
tinygrad/runtime/ops_hip.py,sha256=enZW_uDl50BFkqAkJF6QC4Rx88DHAyM8R6EAZFvQRWM,3788
|
37
|
+
tinygrad/runtime/ops_llvm.py,sha256=dODiyVSlPofHyDIZrD-V74h8W1d94VPnr_-A4gNbSO4,2229
|
38
|
+
tinygrad/runtime/ops_metal.py,sha256=6WgzA2Y60rlMZecf-qflmEdHigSvqFpYK4hAm70aeUI,6674
|
39
|
+
tinygrad/runtime/ops_npy.py,sha256=HSDb47vcbPvDiG3EmSGPC0W-EPO9O5R0TqlQKnYxANU,404
|
40
|
+
tinygrad/runtime/ops_nv.py,sha256=yBPtq2Klq1vdAHOzYjWrt3X6zwj3UxgmOo_hOLgxItg,34748
|
41
|
+
tinygrad/runtime/ops_python.py,sha256=xjISZGZCYicTSCFV51lwMXrZ4muDxsFgm8ErAzLsI1k,10991
|
42
|
+
tinygrad/runtime/autogen/amd_gpu.py,sha256=gDCxBDhI_1RLVQ5inKrO9KSAq7QhtLiOTzEYNMbgC1c,1271208
|
43
|
+
tinygrad/runtime/autogen/comgr.py,sha256=mhQtuF_vGDrJZD3iyQ_38FrS_2jp3WtImNZPC4TBuAg,39793
|
44
|
+
tinygrad/runtime/autogen/cuda.py,sha256=N0QyaMvQumr_HZh7fusCHM1d4o4mYti3Wq1MN7JSKr8,243920
|
45
|
+
tinygrad/runtime/autogen/hip.py,sha256=1yUHDCwL3KkD15if2Q1Ud3GbJiR7DxsNorKZTCINw54,245532
|
46
|
+
tinygrad/runtime/autogen/hsa.py,sha256=7Hsrn17HmChyeFOSX_3Fnzl9c0COtq2Z2ExqGu5FNiU,277716
|
47
|
+
tinygrad/runtime/autogen/io_uring.py,sha256=cWYzokworiNV1x4I6eBmZpqV2nCt5B_rVEDx7pFP2W0,57664
|
48
|
+
tinygrad/runtime/autogen/kfd.py,sha256=aPLkNzFB0TPzqYbY_Rw9kQNsm2jOSeLcqqjYfKltGVo,32532
|
49
|
+
tinygrad/runtime/autogen/libc.py,sha256=WeDH4TUlfLcDN6LkjmbQqhaPBILMOsJYGA3IA2q60yQ,110850
|
50
|
+
tinygrad/runtime/autogen/nv_gpu.py,sha256=Hd8p-ay8dbdqFwvGyEtXLX3Ymjr3DP1XSRMAe0zKrq4,1686859
|
51
|
+
tinygrad/runtime/autogen/nvrtc.py,sha256=19te2-TW5suFy85KnJox3CPOmeeml5YxqIDeL-Bx_m4,23132
|
52
|
+
tinygrad/runtime/autogen/opencl.py,sha256=aW-luGFF5PXFEZ6SgrGANhA9qpkI-fZyEsmDfpez2Ss,82654
|
53
|
+
tinygrad/runtime/graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
|
+
tinygrad/runtime/graph/clang.py,sha256=6AW8IHFVmfecLpi41OMGyZudzLNgyWZqvQgWvKb04FU,2005
|
55
|
+
tinygrad/runtime/graph/cuda.py,sha256=MpM5Fi7cN6ESTSakROxK-jLa8IztDMa8dY8UMYXJlIU,5117
|
56
|
+
tinygrad/runtime/graph/hcq.py,sha256=XpS8f_h8oGCjwXFtW0iJL7Lrash2L82CZUUCKN6NeAE,12407
|
57
|
+
tinygrad/runtime/graph/metal.py,sha256=6EZm1IRg77JSzLtgOh95GgALrfXRchBEJs50yKpU2Hc,4786
|
58
|
+
tinygrad/runtime/support/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
59
|
+
tinygrad/runtime/support/compiler_cuda.py,sha256=kbDAsqlOeAm6XHQ0-2zzxvcEJTSC35aWbYHu_Fcy4KM,5421
|
60
|
+
tinygrad/runtime/support/compiler_hip.py,sha256=XzmNLtGM8xhSeCnh0IVINke9JJRpJ0VLzBA0RH3DNbU,4427
|
61
|
+
tinygrad/runtime/support/elf.py,sha256=FVoZu5r83RPk8ArBVpmOcbPDbtSz6hiv_OTCrQ9REHA,2385
|
62
|
+
tinygrad/shape/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
63
|
+
tinygrad/shape/shapetracker.py,sha256=Wi8W64w8k1TsN-vnTCoSRFUWsxhvJ-21GC4QU4JhsSU,5683
|
64
|
+
tinygrad/shape/symbolic.py,sha256=XQ_OwzhiwVKJbKscAeXZHIu6cv_P139YoR4a6W6Knjw,16521
|
65
|
+
tinygrad/shape/view.py,sha256=E0FslOAyLKUgc3_jGDR5L9GyGDLI_lDVHNzhnl4J2H4,18659
|
66
|
+
tinygrad-0.9.2.dist-info/LICENSE,sha256=ABRhUPEILzINYIukgazD-_rPipkUNUwslrb0RxnV6Xc,1058
|
67
|
+
tinygrad-0.9.2.dist-info/METADATA,sha256=AiBpX2rbHzNdkeLd4M9q85nT4vZPDvfPapqJFbphdNk,10949
|
68
|
+
tinygrad-0.9.2.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
69
|
+
tinygrad-0.9.2.dist-info/top_level.txt,sha256=vDABMCWBFQnx2kn9Azueu88FP-1klQdePoHikQhHymc,9
|
70
|
+
tinygrad-0.9.2.dist-info/RECORD,,
|