fix UOp repr with Variable in arg (#6236)

This commit is contained in:
chenyu
2024-08-22 11:06:33 -04:00
committed by GitHub
parent 3fc8203475
commit 08539f08b0
2 changed files with 7 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ from tinygrad.renderer import Program
from tinygrad.engine.schedule import create_schedule
from tinygrad.engine.realize import CompiledRunner, lower_schedule_item, get_kernel
from tinygrad.codegen.uopgraph import linearize_uop, full_graph_rewrite
from tinygrad.shape.symbolic import Variable
from test.helpers import is_dtype_supported, TestUOps as TestEqUOps
def to_uops_list(u:List[UOp], opts=None, skip_check=False) -> List[UOp]: return linearize_uop(full_graph_rewrite(UOp.sink(*u), opts), skip_check)
@@ -380,6 +381,10 @@ class TestUOpStr(TestEqUOps):
a = NOp(UOps.CONST, dtypes.float, (), 2.0, name="c0") + NOp(UOps.CONST, dtypes.float, (), 3.0, name="c1")
assert str(eval(str(a))) == str(a)
def test_variable_const(self):
uop = UOp(UOps.CONST, dtypes.int, (), arg=Variable("a",1,10))
assert str(eval(str(uop))) == str(uop)
class TestIndexingOrdering(unittest.TestCase):
# NOTE: these tests skip type_verify since they add dtype to STORE
@unittest.expectedFailure