remove redundant mod 1 pattern [run_process_replay] (#5832)

it's folded because min==max
This commit is contained in:
chenyu
2024-07-31 01:12:05 -04:00
committed by GitHub
parent ed556c260e
commit 5560bda509
2 changed files with 1 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
from __future__ import annotations
import itertools, functools
from dataclasses import replace
from dataclasses import dataclass, replace
from collections import defaultdict
from typing import Optional, List, Tuple, cast, Dict, Union, Final, DefaultDict, Any
@@ -16,7 +16,6 @@ from tinygrad.shape.view import strides_for_shape
from tinygrad.codegen.uops import UOps, flops_mem
from tinygrad.codegen.uopgraph import UOpGraph
from tinygrad.codegen.lowerer import lazyop_to_uop
from dataclasses import dataclass
from enum import Enum, auto
class OptOps(Enum):

View File

@@ -246,8 +246,6 @@ constant_folder = PatternMatcher([
(((NOp.var('x') * NOp.cvar('c0')) % NOp.cvar('c1')) % NOp.cvar('c0'), lambda x,c0,c1: x.const(0)),
# -(x+y) -> -x + -y
#(-(NOp.var("x") + NOp.var("y")), lambda x,y: (-x)+(-y)),
# x%1 -> 0
(NOp.var("x") % NOp.const(None, 1), lambda x: x.const(0)),
# (x*c0)+(x*c1) -> x*(c0+c1)
(NOp.var("x") * NOp.cvar("c0") + NOp.var("x") * NOp.cvar("c1"), lambda x,c0,c1: x*exec_alu(BinaryOps.ADD, x.dtype, [c0.arg, c1.arg])),
# (x*c0)+(y*c0) -> (x+y)*c0