mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
faster?
This commit is contained in:
parent
943bde47ab
commit
ccd18a803c
3 changed files with 5 additions and 2 deletions
|
|
@ -132,6 +132,7 @@ if __name__ == "__main__":
|
|||
#k.apply_opt(Opt(OptOps.PADTO, 4, 4))
|
||||
k.apply_opt(Opt(OptOps.UNROLL, 1, 0))
|
||||
k.apply_opt(Opt(OptOps.UPCAST, 2, 128))
|
||||
k.apply_opt(Opt(OptOps.UPCAST, 1, 2))
|
||||
elif knum == 5:
|
||||
k.apply_opt(Opt(OptOps.UNROLL, 1, 0))
|
||||
k.apply_opt(Opt(OptOps.UPCAST, 2, 0))
|
||||
|
|
|
|||
|
|
@ -196,7 +196,8 @@ gep_pushing = PatternMatcher([
|
|||
|
||||
symbolic = symbolic_simple+PatternMatcher([
|
||||
# ** COMMUTATIVE flipping (only for ints) **
|
||||
(UPat(GroupOp.Commutative, dtype=dtypes.int, name='x'), lambda x: x.replace(src=x.src[::-1]) if x.src[1].tuplize < x.src[0].tuplize else None),
|
||||
# NOTE: this can break merging vector math by only flipping some of them
|
||||
#(UPat(GroupOp.Commutative, dtype=dtypes.int, name='x'), lambda x: x.replace(src=x.src[::-1]) if x.src[1].tuplize < x.src[0].tuplize else None),
|
||||
# ** boolean algebra **
|
||||
(UPat.var("x") | (UPat.var("x") & UPat.var()), lambda x: x), # x|(x&y) -> x
|
||||
# ** combine terms **
|
||||
|
|
|
|||
|
|
@ -163,7 +163,8 @@ def prefetch_l1(ld:UOp):
|
|||
def vectorize_shuffle(x:UOp):
|
||||
if not all(s.op in {Ops.GEP, Ops.CONST} for s in x.src): return None
|
||||
gepped = dedup([s.src[0] for s in x.src if s.op is Ops.GEP])
|
||||
if len(gepped) < 2: return None
|
||||
if len(gepped) != 3: return None
|
||||
if not all(x.dtype.scalar() is dtypes.uchar and x.dtype.count == 128 for x in gepped): return None
|
||||
arg = []
|
||||
for s in x.src:
|
||||
if s.op is Ops.GEP:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue