reintroduce merge views in update benchmark (#3279)

* Reapply "take merge views from corsix branch" (#3278)

This reverts commit d298916232.

* reintroduce merge views
This commit is contained in:
George Hotz
2024-01-30 09:47:20 -08:00
committed by GitHub
parent d298916232
commit 09f2952dc3
3 changed files with 85 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
import unittest
from tinygrad import Tensor, GlobalCounters
from tinygrad.helpers import Timing, CI, Profiling, WINO
from tinygrad.helpers import Timing, CI, Profiling, WINO, DEBUG
from tinygrad.ops import LoadOps
from tinygrad.codegen.linearizer import Linearizer
@@ -28,6 +28,12 @@ class TestWinograd(unittest.TestCase):
l = Linearizer(s.ast)
l.hand_coded_optimizations()
l.linearize()
if DEBUG >= 2: print(f"{len(l.sts):4d} shapetrackers with max {max(len(x.views) for x in l.sts)} views")
for st in l.sts:
assert len(st.views) <= 2, "too many views in winograd"
if DEBUG >= 3:
print(f"{len(st.views):3d} views")
for v in st.views: print(v)
def test_profile(self):
x,w = Tensor.rand(1,4,9,9).realize(), Tensor.rand(4,4,3,3).realize()