MCPcopy Create free account
hub / github.com/apache/tvm / test_size_span

Function test_size_span

tests/python/tirx/test_layout.py:983–1064  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

981
982
983def test_size_span():
984 def tile_layout_size():
985 layout = TileLayout(S[(8, 8) : (8, 1)])
986 assert layout.size() == 64
987
988 tile_layout_size()
989
990 def swizzle_layout_size():
991 layout = SwizzleLayout(per_element=3, swizzle_len=3, atom_len=3)
992 assert layout.size() == 512
993 layout = SwizzleLayout(per_element=4, swizzle_len=3, atom_len=3)
994 assert layout.size() == 1024
995
996 swizzle_layout_size()
997
998 def compose_layout_size():
999 layout = ComposeLayout(
1000 SwizzleLayout(per_element=3, swizzle_len=3, atom_len=3),
1001 TileLayout(S[(8, 64) : (64, 1)]),
1002 )
1003 assert layout.size() == 512
1004
1005 compose_layout_size()
1006
1007 def tile_layout_span():
1008 layout = TileLayout(S[(8, 8) : (8, 1)])
1009 assert layout.span() == 64
1010 layout = TileLayout(S[(8, 6) : (8, 1)])
1011 assert layout.span() == 62
1012 layout = TileLayout(S[(8, 1, 4, 2) : (4 @ laneid, 2, 1 @ laneid, 1)])
1013 assert layout.span() == 2
1014
1015 tile_layout_span()
1016
1017 def swizzle_layout_span():
1018 layout = SwizzleLayout(per_element=3, swizzle_len=3, atom_len=3)
1019 assert layout.span() == 512
1020 layout = SwizzleLayout(per_element=4, swizzle_len=3, atom_len=3)
1021 assert layout.span() == 1024
1022
1023 swizzle_layout_span()
1024
1025 def compose_layout_span():
1026 layout = ComposeLayout(
1027 SwizzleLayout(per_element=3, swizzle_len=3, atom_len=3),
1028 TileLayout(S[(8, 64) : (64, 1)]),
1029 )
1030 assert layout.span() == 512
1031
1032 compose_layout_span()
1033
1034 def trainium_layout_tests():
1035 # TrainiumLayout tests
1036 layout = TileLayout(S[(8, 8) : (1 @ P, 1 @ F)])
1037 assert layout.size("P") == 8
1038 assert layout.size("F") == 8
1039
1040 layout = TileLayout(S[(8, 8, 8) : (64 @ F, 1 @ P, 1 @ F)])

Callers

nothing calls this directly

Calls 7

tile_layout_sizeFunction · 0.85
swizzle_layout_sizeFunction · 0.85
compose_layout_sizeFunction · 0.85
tile_layout_spanFunction · 0.85
swizzle_layout_spanFunction · 0.85
compose_layout_spanFunction · 0.85
trainium_layout_testsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…