mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-10 23:48:01 -05:00
fix vectorized dtype repr [run_process_replay] (#6535)
This commit is contained in:
@@ -393,6 +393,10 @@ class TestUOpStr(unittest.TestCase):
|
||||
uop = UOp(UOps.CONST, dtypes.int, (), arg=Variable("a",1,10))
|
||||
assert str(eval(str(uop))) == str(uop)
|
||||
|
||||
def test_vectorized_str(self):
|
||||
vec = UOp(UOps.VECTORIZE, dtypes.int.vec(4), tuple(UOp.const(dtypes.int, x) for x in range(4)))
|
||||
assert str(eval(str(vec))) == str(vec)
|
||||
|
||||
class TestIndexingOrdering(unittest.TestCase):
|
||||
# NOTE: these tests skip type_verify since they add dtype to STORE
|
||||
@unittest.expectedFailure
|
||||
|
||||
@@ -13,7 +13,7 @@ class DType:
|
||||
name: str
|
||||
fmt: Optional[str]
|
||||
count: int
|
||||
def __repr__(self): return f"dtypes.{'_'*(c:=self.count!=1)}{INVERSE_DTYPES_DICT[self.name if not c else self.scalar().name]}{str(self.count)*c}"
|
||||
def __repr__(self): return f"dtypes.{INVERSE_DTYPES_DICT[self.scalar().name]}"+(f".vec({self.count})" if self.count > 1 else "")
|
||||
def vec(self, sz:int):
|
||||
assert self.count == 1, f"can't vectorize {self} with size {sz}"
|
||||
if sz == 1 or self.name == 'void': return self # void doesn't vectorize, and sz=1 is scalar
|
||||
|
||||
Reference in New Issue
Block a user