From af935e7d32f88d0e64386c49d963208c4210efda Mon Sep 17 00:00:00 2001 From: chenyu Date: Tue, 30 Sep 2025 11:45:30 +0800 Subject: [PATCH] Revert "reduce const folding (#12344)" (#12349) This reverts commit 8e508a99276a54252de67deeb191f1f041faa647. --- .github/workflows/test.yml | 2 +- tinygrad/schedule/rangeify.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 934ce57076..24715bd5b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -536,7 +536,7 @@ jobs: test/test_outerworld_range.py test/test_randomness.py test/test_nn.py test/test_arange.py test/test_tensor.py test/test_optim.py \ test/test_setitem.py test/test_assign.py - name: Test const folding - run: CPU=1 RANGEIFY=1 python3 -m pytest -n auto --durations 20 test/test_const_folding.py -k "not test_cast_padded and not TestMultiConstFolding" + run: CPU=1 RANGEIFY=1 python3 -m pytest -n auto --durations 20 test/test_const_folding.py -k "not test_cast_padded and not TestReduceOpsConstFolding and not TestMultiConstFolding" - name: Test multitensor run: | CPU=1 RANGEIFY=1 python3 test/test_multitensor.py TestMultiTensor.test_matmul_shard_1_1 TestMultiTensor.test_simple_add_W TestMultiTensor.test_simple_reduce \ diff --git a/tinygrad/schedule/rangeify.py b/tinygrad/schedule/rangeify.py index 05a207ae23..c77fbf7d37 100644 --- a/tinygrad/schedule/rangeify.py +++ b/tinygrad/schedule/rangeify.py @@ -5,8 +5,6 @@ from tinygrad.dtype import dtypes, PtrDType, ImageDType, AddrSpace from tinygrad.uop.ops import PatternMatcher, UPat, Ops, UOp, resolve, GroupOp, RewriteNotReady, _substitute, ssimplify from tinygrad.uop.symbolic import sym, symbolic_simple from tinygrad.helpers import argsort, prod, all_same, pluralize, getenv, RANGEIFY, Context, flatten, dedup -from tinygrad.codegen.simplify import pm_reduce_simplify - from tinygrad.schedule.kernelize import Kernel from tinygrad.uop.ops import track_rewrites, graph_rewrite, identity_element, sint, AxisType @@ -630,7 +628,7 @@ def get_rangeify_map(sink:UOp) -> dict[UOp, UOp]: # rangeify tsink = graph_rewrite(tsink, pm_rangeify, ctx=RangeifyContext(), bottom_up=True, name="rangeify") # NOTE: sym (vs symbolic_simple) breaks things here because ranges with len 1 aren't handled right - tsink = graph_rewrite(tsink, symbolic_simple+pm_reduce_simplify, name="symbolic") # this supports const folding + tsink = graph_rewrite(tsink, symbolic_simple, name="symbolic") # this supports const folding tsink = graph_rewrite(tsink, pm_cleanups, bottom_up=True, name="remove costly buffers") # rebuild the sink with all the BUFFERIZEs with tags, this is what's ending up in the tensor graph