fix _to_const_val and const folding around it (#4017)

* fix _to_const_val and const folding around it

is_unrealized_contiguous_const is too strict and almost never hit if const is expanded.
suffice to check if there's no pad

* that test is folded

* test_const_folding
This commit is contained in:
chenyu
2024-03-31 13:09:23 -04:00
committed by GitHub
parent 2abb474d43
commit 7f859593b8
5 changed files with 67 additions and 8 deletions

View File

@@ -338,11 +338,6 @@ class TestJit(unittest.TestCase):
assert isinstance(jf.jit_cache[1].prg, graph_t)
def test_jit_const_inputs(self):
@TinyJit
def f(x,y): return (x+y).realize()
for _ in range(5):
np.testing.assert_equal(f(Tensor.ones(3), Tensor.zeros(3)).numpy(), np.ones(3))
@TinyJit
def g(x,y,z): return (x+y+z).realize()
for i in range(5):