From 95aa6d8ccd986459c5220872dbe8aa8ece36e152 Mon Sep 17 00:00:00 2001 From: chenyu Date: Wed, 14 Aug 2024 16:57:39 -0400 Subject: [PATCH] remove redundant x/c pattern [run_process_replay] (#6082) there's no div and 1/c is const folded --- tinygrad/codegen/uopgraph.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tinygrad/codegen/uopgraph.py b/tinygrad/codegen/uopgraph.py index 3f73433226..0ce6baa0c8 100644 --- a/tinygrad/codegen/uopgraph.py +++ b/tinygrad/codegen/uopgraph.py @@ -258,7 +258,6 @@ constant_folder = PatternMatcher([ (NOp.var('x') // 1, lambda x: x), # x//1 -> x (NOp.var('x') // -1, lambda x: -x), # x//-1 -> -x (NOp.var('x') / NOp.var('x'), lambda x: x.const(1)), # x/x -> 1 - (NOp.var('x') / NOp.cvar('c'), lambda x,c: x*exec_alu(UnaryOps.RECIP, c.dtype, [c.arg])), # x/c -> x*(1/c) # ** zero folding ** # x*0 -> 0 or 0*x -> 0 # if x is nan or inf it should render the nan value.