| 1488 | |
| 1489 | |
| 1490 | def test_unpack(): |
| 1491 | def case1(): |
| 1492 | layout = TileLayout(S[(8, 8) : (8, 1)]) |
| 1493 | layout_expected = TileLayout(S[(8, 16) : (16, 1)]) |
| 1494 | assert_structural_equal(layout.unpack(2).canonicalize(), layout_expected.canonicalize()) |
| 1495 | |
| 1496 | case1() |
| 1497 | |
| 1498 | def case2(): |
| 1499 | layout = SwizzleLayout(per_element=3, swizzle_len=3, atom_len=3) |
| 1500 | layout_expected = SwizzleLayout(per_element=4, swizzle_len=3, atom_len=3) |
| 1501 | assert_structural_equal(layout.unpack(2).canonicalize(), layout_expected.canonicalize()) |
| 1502 | |
| 1503 | case2() |
| 1504 | |
| 1505 | def case3(): |
| 1506 | layout = ComposeLayout( |
| 1507 | SwizzleLayout(per_element=3, swizzle_len=3, atom_len=3), |
| 1508 | TileLayout(S[(8, 64) : (64, 1)]), |
| 1509 | ) |
| 1510 | layout_expected = ComposeLayout( |
| 1511 | SwizzleLayout(per_element=4, swizzle_len=3, atom_len=3), |
| 1512 | TileLayout(S[(8, 128) : (128, 1)]), |
| 1513 | ) |
| 1514 | assert_structural_equal(layout.unpack(2).canonicalize(), layout_expected.canonicalize()) |
| 1515 | |
| 1516 | case3() |
| 1517 | |
| 1518 | |
| 1519 | def test_pack(): |