more symbolic test, ModNode is wrong
MODIFY
test/test_symbolic.py
test/test_symbolic.py
@@ -96,6 +96,8 @@ class TestSymbolicNumeric(unittest.TestCase):
def test_times_2(self): self.helper_test_numeric(lambda x: x*2)
def test_times_2_plus_3(self): self.helper_test_numeric(lambda x: x*2 + 3)
def test_times_2_plus_3_mod_4(self): self.helper_test_numeric(lambda x: (x*2 + 3)%4)
+ def test_times_2_plus_3_div_4(self): self.helper_test_numeric(lambda x: (x*2 + 3)//4)
+ def test_times_2_plus_3_div_4_mod_4(self): self.helper_test_numeric(lambda x: (x*2 + 3)//4%4)
if __name__ == '__main__':
unittest.main()

MODIFY
tinygrad/shape/symbolic.py
tinygrad/shape/symbolic.py
@@ -117,7 +117,8 @@ class RedNode(Node):
class MulNode(OpNode): op, minmax = "*", staticmethod(lambda a,b: (a.min*b, a.max*b))
class DivNode(OpNode): op, minmax = "//", staticmethod(lambda a,b: (int(a.min/b), int(a.max/b)))
-# TODO: this is wrong! should be flipped
+# TODO: this is wrong! should be flipped or something!
+# though if you change it to (0,b-1) it breaks VALIDHACKS=1
class ModNode(OpNode): op, minmax = "%", staticmethod(lambda a,b: (min(a.min, 0), max(a.max, b-1)))
class GeNode(OpNode): op, minmax = ">=", staticmethod(lambda a,b: (0,1))
class LtNode(OpNode): op, minmax = "<", staticmethod(lambda a,b: (0,1))

more symbolic test, ModNode is wrong