remove iter from uopgraph (#6110)

* remove iter from uopgraph

* linearize returns uops

* fix tests

* linearize in linearize

* tests fix

* touchup

* test failures
This commit is contained in:
George Hotz
2024-08-16 15:58:29 -07:00
committed by GitHub
parent 28c75bf2a6
commit 74ee9febec
15 changed files with 104 additions and 129 deletions

View File

@@ -21,18 +21,17 @@ if __name__ == "__main__":
sched = out.schedule()
asts = {x.ast.key:x.ast for x in sched if x.ast.op is UOps.SINK}.values()
uops = []
kernels = []
with Profiling(PROFILE):
with Timing("***** model uops in "):
for ast in asts:
k = Kernel(ast)
k.hand_coded_optimizations()
k.linearize()
uops.append((k.name, k.uops))
kernels.append(k)
with Profiling(PROFILE, fn="/tmp/schedule.prof"):
with Timing("***** model linearize in "):
for _,u in uops: u.linearize()
for k in kernels: k.linearize()
#renderer = Device[Device.DEFAULT].renderer
#with Profiling(PROFILE, fn="/tmp/schedule.prof"):

View File

@@ -155,7 +155,7 @@ def fuzz_linearizer(lin: Kernel, rtol=1e-2, atol=1e-2):
if not FUZZ_ALL_ACTIONS and test_lin.applied_opts: print(f"applied opts: {test_lin.applied_opts}")
# stop if kernel uops repeat
try: tuops = tuplize_uops(test_lin.linearize().uops.uops)
try: tuops = tuplize_uops(test_lin.linearize().uops)
except BaseException as e:
print(test_lin.ast)
print(test_lin.applied_opts)