mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-10 23:48:01 -05:00
hotfix: early fold image to image cast store (#7681)
* hotfix: early fold image to image cast store * count out meta ops
This commit is contained in:
@@ -248,8 +248,8 @@ do_realize = PatternMatcher([
|
||||
# always realize meta ops
|
||||
(UPatLoadStore(UPat((Ops.ASSIGN, Ops.CONTIGUOUS, *GroupOp.Meta))), realize),
|
||||
# don't realize image to image casts
|
||||
(UPatLoadStore(UPat(Ops.CAST, src=(UPat(Ops.LOAD, name="x"),), dtype=dtypes.float)).view(name="view"), lambda ctx,x,view,**kwargs: r.view(view.st)
|
||||
if (r:=ctx.get(b:=x.buf_uop)) is not None and r.op is Ops.STORE and isinstance(b.dtype, ImageDType) else None),
|
||||
(UPatLoadStore(UPat(Ops.CAST, src=(UPat(Ops.LOAD, name="x"),), dtype=dtypes.float)).view(name="v"), lambda ctx,x,v,**kwargs: r.src[2].view(v.st)
|
||||
if (r:=ctx.get(b:=x.buf_uop)) is not None and r.op is Ops.STORE and isinstance(b.dtype, ImageDType) and r.src[2].op not in GroupOp.Meta else None),
|
||||
# realize before expand or unsafe pad ops
|
||||
(UPatLoadStore(UPat.var("base")).view(name="view"), realize_view),
|
||||
# realize before COPY or BUFFER_VIEW
|
||||
|
||||
Reference in New Issue
Block a user