Skip to content

Commit c3b7a62

Browse files
authored
Support reshaping tiled uint32 tensors, re-enable models that had OOM due to conv (#1017)
* Update target wrappers since reshaping tiled uint32 tensors is now supported * Increase l1_small_size in conftest so conv's no longer cause OOM with program cache enabled * Update stack target wrapper to convert to RM to get ViLT passing
1 parent 4c253c9 commit c3b7a62

File tree

10 files changed

+21
-26
lines changed

10 files changed

+21
-26
lines changed

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def input_var_check_ttnn(request):
6767
@pytest.fixture(scope="session")
6868
def device(request):
6969
# TODO(tt-metal#13746): Currently L1 small size needs to be manually determined
70-
l1_small_size = 16384
70+
l1_small_size = 65536
7171
dispatch_core_config = get_dispatch_core_config()
7272

7373
if request.config.getoption("--data_parallel"):

tests/models/glpn_kitti/test_glpn_kitti.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _load_inputs(self):
2727

2828
@pytest.mark.parametrize(
2929
"mode",
30-
[pytest.param("eval", marks=pytest.mark.xfail(reason="OOM with program cache enabled"))],
30+
["eval"],
3131
)
3232
def test_glpn_kitti(record_property, mode):
3333
model_name = "GLPN-KITTI"

tests/models/hardnet/test_hardnet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def _load_inputs(self):
4040
@pytest.mark.parametrize(
4141
"mode",
4242
[
43-
pytest.param("train", marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
44-
pytest.param("eval", marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
43+
"train",
44+
pytest.param("eval", marks=pytest.mark.converted_end_to_end),
4545
],
4646
)
4747
def test_hardnet(record_property, mode):

tests/models/timm/test_timm_image_classification.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,28 @@ def _load_inputs(self):
4242
["tf_efficientnet_lite1.in1k", "train"],
4343
["tf_efficientnet_lite2.in1k", "train"],
4444
["tf_efficientnet_lite3.in1k", "train"],
45-
pytest.param(
46-
["tf_efficientnet_lite4.in1k", "train"], marks=pytest.mark.xfail(reason="OOM with program cache enabled")
47-
),
45+
["tf_efficientnet_lite4.in1k", "train"],
4846
["ghostnet_100.in1k", "train"],
4947
["ghostnetv2_100.in1k", "train"],
50-
pytest.param(["inception_v4.tf_in1k", "train"], marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
48+
["inception_v4.tf_in1k", "train"],
5149
["mixer_b16_224.goog_in21k", "train"],
5250
["mobilenetv1_100.ra4_e3600_r224_in1k", "train"],
5351
["ese_vovnet19b_dw.ra_in1k", "train"],
54-
pytest.param(["xception71.tf_in1k", "train"], marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
52+
["xception71.tf_in1k", "train"],
5553
["dla34.in1k", "train"],
5654
["hrnet_w18.ms_aug_in1k", "train"],
5755
pytest.param(["tf_efficientnet_lite0.in1k", "eval"], marks=pytest.mark.converted_end_to_end),
5856
pytest.param(["tf_efficientnet_lite1.in1k", "eval"], marks=pytest.mark.converted_end_to_end),
5957
pytest.param(["tf_efficientnet_lite2.in1k", "eval"], marks=pytest.mark.converted_end_to_end),
6058
["tf_efficientnet_lite3.in1k", "eval"],
61-
pytest.param(
62-
["tf_efficientnet_lite4.in1k", "eval"], marks=pytest.mark.xfail(reason="OOM with program cache enabled")
63-
),
59+
["tf_efficientnet_lite4.in1k", "eval"],
6460
pytest.param(["ghostnet_100.in1k", "eval"], marks=pytest.mark.converted_end_to_end),
6561
["ghostnetv2_100.in1k", "eval"],
66-
pytest.param(["inception_v4.tf_in1k", "eval"], marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
62+
["inception_v4.tf_in1k", "eval"],
6763
["mixer_b16_224.goog_in21k", "eval"],
6864
pytest.param(["mobilenetv1_100.ra4_e3600_r224_in1k", "eval"], marks=pytest.mark.converted_end_to_end),
6965
pytest.param(["ese_vovnet19b_dw.ra_in1k", "eval"], marks=pytest.mark.converted_end_to_end),
70-
pytest.param(["xception71.tf_in1k", "eval"], marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
66+
pytest.param(["xception71.tf_in1k", "eval"], marks=pytest.mark.converted_end_to_end),
7167
pytest.param(["dla34.in1k", "eval"], marks=pytest.mark.converted_end_to_end),
7268
["hrnet_w18.ms_aug_in1k", "eval"],
7369
]

tests/models/torchvision/test_torchvision_object_detection.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ def _load_inputs(self):
4343
@pytest.mark.parametrize(
4444
"model_info",
4545
[
46-
pytest.param(
47-
("ssd300_vgg16", "SSD300_VGG16_Weights"), marks=pytest.mark.xfail(reason="OOM with program cache enabled")
48-
),
46+
("ssd300_vgg16", "SSD300_VGG16_Weights"),
4947
("ssdlite320_mobilenet_v3_large", "SSDLite320_MobileNet_V3_Large_Weights"),
5048
pytest.param(
5149
("retinanet_resnet50_fpn", "RetinaNet_ResNet50_FPN_Weights"),

tests/models/unet/test_unet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def _load_inputs(self):
4949
@pytest.mark.parametrize(
5050
"mode",
5151
[
52-
pytest.param("train", marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
53-
pytest.param("eval", marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
52+
"train",
53+
pytest.param("eval", marks=pytest.mark.converted_end_to_end),
5454
],
5555
)
5656
def test_unet(record_property, mode):

tests/models/unet_brain/test_unet_brain.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def _load_inputs(self):
5151
@pytest.mark.parametrize(
5252
"mode",
5353
[
54-
pytest.param("train", marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
55-
pytest.param("eval", marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
54+
"train",
55+
pytest.param("eval", marks=pytest.mark.converted_end_to_end),
5656
],
5757
)
5858
def test_unet_brain(record_property, mode):

tests/models/unet_carvana/test_unet_carvana.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def _load_inputs(self):
3030
@pytest.mark.parametrize(
3131
"mode",
3232
[
33-
pytest.param("train", marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
34-
pytest.param("eval", marks=pytest.mark.xfail(reason="OOM with program cache enabled")),
33+
"train",
34+
pytest.param("eval", marks=pytest.mark.converted_end_to_end),
3535
],
3636
)
3737
def test_unet_carvana(record_property, mode):

tests/models/yolov3/test_yolov3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _load_inputs(self):
5050

5151
@pytest.mark.parametrize(
5252
"mode",
53-
[pytest.param("eval", marks=pytest.mark.xfail(reason="OOM with program cache enabled"))],
53+
["eval"],
5454
)
5555
def test_yolov3(record_property, mode):
5656
model_name = "YOLOv3"

torch_ttnn/passes/lowering/target_wrappers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,11 @@ def stack(tensors, dim, output_shape):
144144
# Reshape each input tensor to add the new dimension
145145
unsqueezed_tensors = []
146146
for tensor in tensors:
147-
# TODO: remove when reshape supports tiled uint32 inputs
147+
# TODO: remove when concat supports tiled uint32
148+
tensor = ttnn.reshape(tensor, unsqueezed_shape)
148149
if tensor.layout == ttnn.TILE_LAYOUT and tensor.dtype == ttnn.uint32:
149150
tensor = ttnn.to_layout(tensor, ttnn.ROW_MAJOR_LAYOUT)
150-
unsqueezed_tensors.append(ttnn.reshape(tensor, unsqueezed_shape))
151+
unsqueezed_tensors.append(tensor)
151152

152153
# Concatenate all reshaped tensors along the stack dimension
153154
return ttnn.concat(unsqueezed_tensors, dim)

0 commit comments

Comments
 (0)