Revert "add block uops and modify tests (#7931)" (#7932)

This reverts commit 6f4519ff45.
This commit is contained in:
George Hotz
2024-11-28 13:15:41 +08:00
committed by GitHub
parent 6f4519ff45
commit 32dbab945c
4 changed files with 7 additions and 15 deletions

View File

@@ -902,8 +902,7 @@ class TestLinearizer(unittest.TestCase):
lin = helper_linearizer_opt(out, wanna_output=[a.numpy().sum()*a.numpy().sum()])[0]
# RANGE -> LOAD -> ASSIGN -> ALU
end = max(i for i,u in enumerate(lin.uops) if u.op is Ops.ENDRANGE)
# the INDEX can be first
assert lin.uops[end+1].op in GroupOp.ALU or lin.uops[end+2].op in GroupOp.ALU
assert lin.uops[end+1].op in GroupOp.ALU
def test_range_outer_op_after_phi_nested_range(self):
a = Tensor.randn(2, ).realize()
@@ -911,8 +910,7 @@ class TestLinearizer(unittest.TestCase):
lin = helper_linearizer_opt(out, wanna_output=[(np.broadcast_to(a.numpy().reshape(2, 1), (2, 3))).sum()*2])[0]
# RANGE -> LOAD -> ASSIGN -> ALU
end = max(i for i,u in enumerate(lin.uops) if u.op is Ops.ENDRANGE)
# the INDEX can be first
assert lin.uops[end+1].op in GroupOp.ALU or lin.uops[end+2].op in GroupOp.ALU
assert lin.uops[end+1].op in GroupOp.ALU
def test_load_dedup(self):
# for different leaves in the AST, the same loads may occur.

View File

@@ -336,9 +336,8 @@ class TestAssembly(unittest.TestCase):
a2 = UOp(Ops.MUL, dtypes.int, (l1, c2))
uops = to_uops_list([a1,a2], opts=Device[Device.DEFAULT].renderer)
Device[Device.DEFAULT].renderer.render("test", uops)
ops = [x.op for x in uops]
self.assertIn(Ops.SHL, ops)
self.assertIn(Ops.MUL, ops)
self.assertEqual(uops[-1].op, Ops.SHL)
self.assertEqual(uops[-2].op, Ops.MUL)
def test_bitshift_right(self):
g1 = UOp(Ops.DEFINE_GLOBAL, dtypes.int32.ptr(), (), 0)
@@ -349,9 +348,8 @@ class TestAssembly(unittest.TestCase):
a2 = UOp(Ops.IDIV, dtypes.int, (l1, c2))
uops = to_uops_list([a1,a2], opts=Device[Device.DEFAULT].renderer)
Device[Device.DEFAULT].renderer.render("test", uops)
ops = [x.op for x in uops]
self.assertIn(Ops.SHR, ops)
self.assertIn(Ops.IDIV, ops)
self.assertEqual(uops[-1].op, Ops.SHR)
self.assertEqual(uops[-2].op, Ops.IDIV)
class TestUOpMethod(unittest.TestCase):
@unittest.skip("uops lt no longer ordered")