()
| 271 | |
| 272 | |
| 273 | def test_normalize_tile_layout(): |
| 274 | def case1(): |
| 275 | layout = TileLayout(S[(8, 8, 8, 4, 2) : (512, 64, 8, 2, 1)]) |
| 276 | layout_expected = TileLayout(S[4096:1]) |
| 277 | assert_structural_equal(layout_expected, layout.canonicalize()) |
| 278 | |
| 279 | case1() |
| 280 | |
| 281 | def case2(): |
| 282 | layout = TileLayout(S[(8, 8, 1, 8, 4, 2) : (512, 64, 160, 8, 2, 1)]) |
| 283 | layout_expected = TileLayout(S[4096:1]) |
| 284 | assert_structural_equal(layout_expected, layout.canonicalize()) |
| 285 | |
| 286 | case2() |
| 287 | |
| 288 | def case3(): |
| 289 | layout = TileLayout(S[(8, 8, 8, 4, 1, 1) : (512, 64, 8, 2, 1, 1)]) |
| 290 | layout_expected = TileLayout(S[2048:2]) |
| 291 | assert_structural_equal(layout_expected, layout.canonicalize()) |
| 292 | |
| 293 | case3() |
| 294 | |
| 295 | def case4(): |
| 296 | layout = TileLayout(S[(8, 8, 1, 1, 1, 4, 1, 1) : (512, 64, 1, 1, 1, 2, 1, 1)]) |
| 297 | layout_expected = TileLayout(S[(64, 4) : (64, 2)]) |
| 298 | assert_structural_equal(layout_expected, layout.canonicalize()) |
| 299 | |
| 300 | case4() |
| 301 | |
| 302 | def case5(): |
| 303 | layout = TileLayout(S[(2, 3, 6) : (18, 6, 1)]) |
| 304 | layout_expected = TileLayout(S[36:1]) |
| 305 | assert_structural_equal(layout_expected, layout.canonicalize()) |
| 306 | |
| 307 | case5() |
| 308 | |
| 309 | def case6(): |
| 310 | layout = TileLayout(S[(8, 2, 3, 6) : (6, 18, 6, 1)]) |
| 311 | layout_expected = TileLayout(S[(8, 36) : (6, 1)]) |
| 312 | assert_structural_equal(layout_expected, layout.canonicalize()) |
| 313 | |
| 314 | case6() |
| 315 | |
| 316 | def case7(): |
| 317 | layout = TileLayout(S[(8, 2, 3, 6) : (6, 24, 6, 1)]) |
| 318 | layout_expected = TileLayout(S[(8, 2, 18) : (6, 24, 1)]) |
| 319 | assert_structural_equal(layout_expected, layout.canonicalize()) |
| 320 | |
| 321 | case7() |
| 322 | |
| 323 | def case8(): |
| 324 | layout = TileLayout(S[(8, 2, 4, 2, 3, 6) : (2, 1, 4, 24, 6, 1)]) |
| 325 | layout_expected = TileLayout(S[(16, 4, 2, 18) : (1, 4, 24, 1)]) |
| 326 | assert_structural_equal(layout_expected, layout.canonicalize()) |
| 327 | |
| 328 | case8() |
| 329 | |
| 330 | def case9(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…