| 1517 | |
| 1518 | |
| 1519 | def test_pack(): |
| 1520 | def case1(): |
| 1521 | layout = TileLayout(S[(8, 16) : (16, 1)]) |
| 1522 | layout_expected = TileLayout(S[(8, 8) : (8, 1)]) |
| 1523 | assert_structural_equal(layout.pack(2).canonicalize(), layout_expected.canonicalize()) |
| 1524 | |
| 1525 | case1() |
| 1526 | |
| 1527 | def case2(): |
| 1528 | layout = SwizzleLayout(per_element=4, swizzle_len=3, atom_len=3) |
| 1529 | layout_expected = SwizzleLayout(per_element=3, swizzle_len=3, atom_len=3) |
| 1530 | assert_structural_equal(layout.pack(2).canonicalize(), layout_expected.canonicalize()) |
| 1531 | |
| 1532 | case2() |
| 1533 | |
| 1534 | def case3(): |
| 1535 | layout = ComposeLayout( |
| 1536 | SwizzleLayout(per_element=4, swizzle_len=3, atom_len=3), |
| 1537 | TileLayout(S[(8, 128) : (128, 1)]), |
| 1538 | ) |
| 1539 | layout_expected = ComposeLayout( |
| 1540 | SwizzleLayout(per_element=3, swizzle_len=3, atom_len=3), |
| 1541 | TileLayout(S[(8, 64) : (64, 1)]), |
| 1542 | ) |
| 1543 | assert_structural_equal(layout.pack(2).canonicalize(), layout_expected.canonicalize()) |
| 1544 | |
| 1545 | case3() |
| 1546 | |
| 1547 | |
| 1548 | def test_slice(): |