mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-09 15:08:02 -05:00
move all VIEW -> LOAD rules to big graph rewrite [pr] (#7936)
* move all VIEW -> LOAD rules to big graph rewrite [pr] * comments
This commit is contained in:
@@ -183,7 +183,6 @@ to_si = PatternMatcher([
|
||||
|
||||
lazy = PatternMatcher([
|
||||
(UPat(tuple(Ops), name="x"), lambda ctx,x: ctx.metadata.add(m) if (m:=ctx.ops_metadata.get(x)) is not None else None),
|
||||
(UPat(Ops.BUFFER, name="b").view(name="v"), lambda ctx,b,v: UOp(Ops.PRELOAD if b in ctx.assigns else Ops.LOAD, v.dtype, (b, v.st.to_uop()))),
|
||||
(UPat(Ops.CONTIGUOUS, src=(UPat.var("x"),)), lambda ctx,x: x),
|
||||
])
|
||||
|
||||
@@ -372,6 +371,8 @@ break_sched = PatternMatcher([
|
||||
(UPatSrc({Ops.CONST, Ops.BIND}), generate_valid),
|
||||
# everything else is a VIEW of BUFFER that either realizes or fuses
|
||||
(UPatSrc(), lambda ctx,b,to_store,base: append_kernel(ctx, b, to_store, base) if b in ctx.realizes else append_op(ctx, b, to_store)),
|
||||
# just load realized buffers
|
||||
(UPat(Ops.BUFFER, name="b").view(name="v"), lambda ctx,b,v: UOp(Ops.PRELOAD if b in ctx.assigns else Ops.LOAD, v.dtype, (b, v.st.to_uop()))),
|
||||
])
|
||||
|
||||
@track_rewrites(named=True)
|
||||
|
||||
Reference in New Issue
Block a user