(self)
| 106 | for i, buf in enumerate(b): np.testing.assert_equal(expected[i], np.frombuffer(buf.as_memoryview(), np.int32)) |
| 107 | |
| 108 | def test_order_write_read_same_buf(self): |
| 109 | d0 = Device.DEFAULT |
| 110 | b = [make_buffer(d0, fill=True) for _ in range(5)] |
| 111 | c: dict[Buffer,UOp] = {} |
| 112 | |
| 113 | calls = [ |
| 114 | get_ast(d0, 2).call(get_buf_uop(b[0],c), get_buf_uop(b[1],c), get_buf_uop(b[2],c), metadata=()), |
| 115 | get_ast(d0, 2).call(get_buf_uop(b[1],c), get_buf_uop(b[0],c), get_buf_uop(b[4],c), metadata=()), |
| 116 | ] |
| 117 | |
| 118 | zero_bufs([b[0], b[1]]) |
| 119 | run_schedule(calls) |
| 120 | expected = [np.frombuffer(x.as_memoryview(), np.int32).copy() for x in b] |
| 121 | |
| 122 | for _ in range(RUN_CNT): |
| 123 | zero_bufs([b[0], b[1]]) |
| 124 | make_graph(Device[d0].graph, calls)([], {}) |
| 125 | for i, buf in enumerate(b): np.testing.assert_equal(expected[i], np.frombuffer(buf.as_memoryview(), np.int32)) |
| 126 | |
| 127 | def test_order_copy_writed(self): |
| 128 | self.skip_if_not_multigraph() |
nothing calls this directly
no test coverage detected