forked from tinygrad/tinygrad
investigate opts mismatches (#12020)
This commit is contained in:
+4
-2
@@ -21,8 +21,10 @@ if __name__ == "__main__":
|
||||
|
||||
if opt1 != opt2:
|
||||
print(f"******* {i:6d}")
|
||||
print("Kernel: ", lin.colored_shape(), opt1)
|
||||
print("Scheduler: ", sch.colored_shape(), opt2)
|
||||
print("Kernel: ", lin.colored_shape(), "->", lin.apply_opts(opt1).colored_shape())
|
||||
print("Scheduler: ", sch.colored_shape(), "->", sch.apply_opts(opt2).colored_shape())
|
||||
print(opt1)
|
||||
print(opt2)
|
||||
else:
|
||||
good += 1
|
||||
print(f"******* {i:6d} MATCH {good/(i+1)*100:.2f}%")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
import math, itertools
|
||||
from collections import defaultdict
|
||||
from typing import cast, Final
|
||||
from typing import cast, Final, Sequence
|
||||
from tinygrad.uop.ops import PatternMatcher, UPat, Ops, UOp, KernelInfo, graph_rewrite, _substitute, AxisType, ssimplify
|
||||
from tinygrad.uop.symbolic import symbolic_flat
|
||||
from tinygrad.device import Buffer
|
||||
@@ -145,6 +146,10 @@ class Scheduler:
|
||||
return axis
|
||||
except IndexError as e: raise KernelOptError from e
|
||||
|
||||
def apply_opts(self, opts:Sequence[Opt]) -> Scheduler:
|
||||
for opt in opts: self.apply_opt(opt)
|
||||
return self
|
||||
|
||||
def apply_opt(self, opt:Opt, append_opt:bool=True):
|
||||
if opt.op is OptOps.NOLOCALS:
|
||||
check(all(x not in {AxisType.LOCAL, AxisType.GROUP_REDUCE} for x in self.axis_types), "no locals can't have locals")
|
||||
|
||||
Reference in New Issue
Block a user