mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-30 00:33:41 +08:00
Qualify Model Lab tests across runtimes
This commit is contained in:
@@ -79,6 +79,7 @@ class TestLaboratoryIdentity(unittest.TestCase):
|
||||
pair = LaboratoryPair.__new__(LaboratoryPair)
|
||||
pair.failed = False
|
||||
pair._last_outputs = None
|
||||
pair._layout_cache = None
|
||||
pair.lateral = Mock(spec_set=['last_warp'])
|
||||
pair.longitudinal = Mock(spec_set=['last_warp'])
|
||||
pair.lateral.last_warp = pair.longitudinal.last_warp = object()
|
||||
|
||||
@@ -47,13 +47,13 @@ class TestWeakLayout(unittest.TestCase):
|
||||
view = base[2:8]
|
||||
with installed(cache):
|
||||
first = view.uop.buffer.ensure_allocated()
|
||||
np.testing.assert_array_equal(first.numpy(), np.arange(2, 8, dtype=np.float32))
|
||||
np.testing.assert_array_equal(np.frombuffer(first.as_memoryview(), dtype=np.float32), np.arange(2, 8, dtype=np.float32))
|
||||
storage = base.uop.base.buffer
|
||||
storage.deallocate()
|
||||
storage.allocate(opaque=np.arange(16, dtype=np.float32) + 100)
|
||||
second = view.uop.buffer.ensure_allocated()
|
||||
self.assertIsNot(first, second)
|
||||
np.testing.assert_array_equal(second.numpy(), np.arange(2, 8, dtype=np.float32) + 100)
|
||||
np.testing.assert_array_equal(np.frombuffer(second.as_memoryview(), dtype=np.float32), np.arange(2, 8, dtype=np.float32) + 100)
|
||||
|
||||
def test_noncontiguous_buffers_still_refuse(self):
|
||||
cache = WeakLayoutMemo(ORIGINAL)
|
||||
|
||||
@@ -183,7 +183,10 @@ class TestAdmittedReplay(unittest.TestCase):
|
||||
def test_replaced_capture_linear_invalidates_bindings(self):
|
||||
x, jit, replay = self.ready()
|
||||
from tinygrad.engine import jit as module
|
||||
jit.captured._linear = jit.captured._linear.replace(tag='replacement')
|
||||
original = jit.captured._linear
|
||||
jit.captured._linear = original.replace(src=(*original.src, *original.src))
|
||||
self.assertIsNot(jit.captured._linear, original)
|
||||
jit.captured.__dict__.pop('linear', None)
|
||||
with patch.object(module, '_prepare_jit_inputs', wraps=module._prepare_jit_inputs) as prepare:
|
||||
np.testing.assert_array_equal(replay(x=x).numpy(), np.arange(8) + 1)
|
||||
self.assertGreaterEqual(prepare.call_count, 1)
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "937dc2b7cfa4df121866fa9c428c3fd1d6b6a23e93dab766a924e812dac67bc8", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "658cfbe1c701ab044b6c283f88aa5af931ceeda63ef3858648da08971aeede85", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user