move in optimize

This commit is contained in:
2025-10-23 16:47:45 +08:00
parent ad6dd64fee
commit 6c66cbe5a1
+3 -3
View File
@@ -19,13 +19,13 @@ from tinygrad.codegen.late.control_flow import CFGContext, pm_add_ends, pm_split
def full_rewrite_to_sink(sink:UOp, ren:Renderer|None=None, optimize:bool=True) -> UOp:
if ren is None: ren = Renderer()
# TODO: fix expander remove this
sink = graph_rewrite(sink, pm_add_buffers_local, name="add locals early")
# first we optimize
if optimize:
if QUANTIZE and ren.device in {"CPU", "DSP"}: sink = graph_rewrite(sink, pm_quant, name="quantize")
# TODO: fix expander and remove this
sink = graph_rewrite(sink, pm_add_buffers_local, name="add locals early")
# split ranges
sink = graph_rewrite(sink, pm_split_ranges+pm_flatten_range, ctx={}, name="split ranges")