diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 920b8af72d..4454fcf628 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -225,7 +225,9 @@ jobs: run: PYTHONPATH=. THREEFRY=1 GPU=1 python3 -m pytest test/test_randomness.py test/test_jit.py --durations=20 - if: ${{ matrix.task == 'onnx' }} name: Test UOP_IS_SYMBOLIC - run: PYTHONPATH=. UOP_IS_SYMBOLIC=1 GPU=1 python3 -m pytest -n=auto test/test_ops.py -k "conv and not (test_padded_conv3d or test_conv2d_bs_4_cin_3 or test_conv2d or test_conv2d_bs_4_cin_1 or test_strided_conv_transpose2d)" --durations=20 + run: | + PYTHONPATH=. UOP_IS_SYMBOLIC=1 GPU=1 python3 -m pytest -n=auto test/test_ops.py -k "conv and not (test_padded_conv3d or test_conv2d_bs_4_cin_3 or test_conv2d or test_conv2d_bs_4_cin_1 or test_strided_conv_transpose2d)" --durations=20 + PYTHONPATH=. UOP_IS_SYMBOLIC=1 python -m pytest -rA test/test_linearizer_failures.py::TestLinearizerFailures::test_failure_47 --durations=20 - if: ${{ matrix.task == 'onnx' }} name: Run handcode_opt run: PYTHONPATH=. MODEL=resnet GPU=1 DEBUG=1 BS=4 HALF=0 python3 examples/handcode_opt.py diff --git a/test/unit/test_uop_symbolic.py b/test/unit/test_uop_symbolic.py index 611fe29e29..a9ab9aed5c 100644 --- a/test/unit/test_uop_symbolic.py +++ b/test/unit/test_uop_symbolic.py @@ -261,6 +261,7 @@ class TestSymbolic(unittest.TestCase): # TODO: simplify further self.helper_test_variable((1+Variable("a", 0, 3))*(-2)+12, 4, 10, {"((a*-2)+10)", "(((a+1)*(-2))+12)"}) + @unittest.expectedFailure def test_mod_mul_sum(self): self.helper_test_variable(Node.sum([Variable("b", 0, 2), Variable("a", 0, 5)*10])%9, 0, 7, "(a+b)") diff --git a/tinygrad/codegen/uopgraph.py b/tinygrad/codegen/uopgraph.py index c782685eb5..9301674ba5 100644 --- a/tinygrad/codegen/uopgraph.py +++ b/tinygrad/codegen/uopgraph.py @@ -245,7 +245,7 @@ constant_folder = PatternMatcher([ x*(c0.arg%c1.arg)%c1 if 0 < c1.arg <= c0.arg else (x%(c1.arg//c0.arg))*c0 if c1.arg%c0.arg == 0 else None), # mul add mod (((NOp.cvar('c0')*NOp.var('x'))+NOp.var('x2')) % NOp.cvar('c1'), - lambda x,x2,c0,c1: x2%c1 if (r:=c0.arg%c1.arg) == 0 else (x*r+x2)%c1 if 0 < c1.arg <= c0.arg else None), + lambda x,x2,c0,c1: x2%c1 if c0.arg%c1.arg == 0 else None), # mod mod ((NOp.var('x') % NOp.cvar('c0')) % NOp.cvar('c1'), lambda x,c0,c1: x % c1 if c0.arg % c1.arg == 0 else None), # -(x+y) -> -x + -y