Revert "move llvm_bf16_cast to renderer for CLANG and LLVM [pr] (#8720)" (#8786)

This reverts commit af0452f116.
This commit is contained in:
George Hotz
2025-01-28 18:59:02 +09:00
committed by GitHub
parent 5d62aa28dc
commit 80089536e5
5 changed files with 18 additions and 26 deletions

View File

@@ -298,7 +298,7 @@ class TestDiskTensor(unittest.TestCase):
ret = t.bitcast(dtypes.uint16).to("CLANG") + 1
assert ret.tolist() == [2827, 3341, 3855, 4369]
def _simulate_bf16_disk_tensor(self):
def test_bf16_disk_write_read(self):
t = Tensor([10000, -1, -1000, -10000, 20], dtype=dtypes.float32)
t.to(f"disk:{temp('dt_bf16_disk_write_read_f32')}").realize()
@@ -308,17 +308,8 @@ class TestDiskTensor(unittest.TestCase):
with open(temp('dt_bf16_disk_write_read_bf16'), "wb") as f: f.write(adat)
t = Tensor.empty(5, dtype=dtypes.bfloat16, device=f"disk:{temp('dt_bf16_disk_write_read_bf16')}")
ct = t.to(Device.DEFAULT)
return ct, [9984., -1, -1000, -9984, 20]
@unittest.skipIf(Device.DEFAULT == "LLVM", "cast to float16 on llvmlite is not supported")
def test_bf16_disk_write_read(self):
t, val = self._simulate_bf16_disk_tensor()
assert t.cast(dtypes.float16).numpy().tolist() == val
def test_bf16_disk_write_read_float32(self):
t, val = self._simulate_bf16_disk_tensor()
assert t.cast(dtypes.float32).numpy().tolist() == val
ct = t.llvm_bf16_cast(dtypes.float)
assert ct.numpy().tolist() == [9984., -1, -1000, -9984, 20]
def test_copy_from_disk(self):
fn = pathlib.Path(temp("dt_copy_from_disk"))