import tests from CL metal texture fix
MODIFY
test/test_mnist.py
test/test_mnist.py
@@ -44,7 +44,6 @@ class TinyConvNet:
x = x.reshape(shape=[x.shape[0], -1])
return x.dot(self.l1).logsoftmax()
-@unittest.skipUnless(getattr(Device, "OPENCL", None) is None or Device.DEFAULT != Device.OPENCL, "OOM on OpenCL")
class TestMNIST(unittest.TestCase):
def test_sgd_onestep(self):
np.random.seed(1337)

MODIFY
test/test_net_speed.py
test/test_net_speed.py
@@ -19,7 +19,6 @@ def stop_profile(pr, sort='cumtime'):
ps.sort_stats(sort)
ps.print_stats(0.2)
-@unittest.skipUnless(getattr(Device, "OPENCL", None) is None or Device.DEFAULT != Device.OPENCL, "OOM on OpenCL")
class TestConvSpeed(unittest.TestCase):
def test_mnist(self):

MODIFY
test/test_ops.py
test/test_ops.py
@@ -8,6 +8,7 @@ from tinygrad.tensor import Tensor, Device
def helper_test_op(shps, torch_fxn, tinygrad_fxn, atol=1e-6, rtol=1e-3, grad_atol=1e-6, grad_rtol=1e-3, forward_only=False, vals=None, a=-0.5, b=20):
torch.manual_seed(0)
+ np.random.seed(0)
if shps is None:
ts = [torch.tensor(x, requires_grad=True) for x in vals]
else:
@@ -213,6 +214,19 @@ class TestOps(unittest.TestCase):
lambda x,w: torch.nn.functional.conv2d(x, w),
lambda x,w: x.conv2d(w), atol=1e-4)
+ def test_large_bs_conv(self):
+ # large batch size can cause OpenCL image to exceed max image height on macOS
+ # (or cause the conv kernel to overflow short sampling coords)
+ helper_test_op([(4096,3,3,3), (1,3,3,3)],
+ lambda x,w: torch.nn.functional.conv2d(x, w),
+ lambda x,w: x.conv2d(w), atol=1e-4, rtol=1e-2)
+
+ def test_large_ic_conv(self):
+ # large input channel count can cause OpenCL image to exceed max image width on macOS
+ helper_test_op([(1,2048,3,3), (1,2048,3,3)],
+ lambda x,w: torch.nn.functional.conv2d(x, w),
+ lambda x,w: x.conv2d(w), atol=1e-4)
+
def test_biased_conv2d(self):
C = 8
helper_test_op([(1,C,5,5), (C,C,1,1), (C,)],

MODIFY
test/test_train.py
test/test_train.py
@@ -25,7 +25,6 @@ def train_one_step(model,X,Y):
et = time.time()-st
print("done in %.2f ms" % (et*1000.))
-@unittest.skipUnless(getattr(Device, "OPENCL", None) is None or Device.DEFAULT != Device.OPENCL, "OOM on OpenCL")
class TestTrain(unittest.TestCase):
def test_efficientnet(self):
model = EfficientNet(0)

import tests from CL metal texture fix