tenstorrent / tt-metal

:metal: TT-NN operator library, and TT-Metalium low level kernel programming model.
Apache License 2.0
372 stars 44 forks source link

MobilenetV2 bringup in TTNN #7351

Open saichandax opened 4 months ago

saichandax commented 4 months ago

MobilenetV2 model running on device implemented in TTNN

keerthana-r-mcw commented 4 months ago

mobilenetv2_pytorch_ref.gv.pdf Mobilenetv2_ref

keerthana-r-mcw commented 4 months ago

Since TTNN doesn't support conv with groups>1, I am facing error in mobilenetv2 ttnn implementation. AssertionError: Only convs with groups == 1 supported

keerthana-r-mcw commented 4 months ago

I tried the workaround done in 6580, but it won't work here due to the following reasons:

dvartaniansTT commented 4 months ago

@keerthana-r-mcw can we try to fall back the convs with group>1 to host for now? and then create a github issue with unit tests and share the issue link with me. cc: @mbahnasTT and @saichandax

keerthana-r-mcw commented 4 months ago

Hi, Resolved the device-related error in mobilenetv2 in the fallback conv, but got the following error in ttnn.conv when I set ttnn_module_args.c6["use_1d_systolic_array"] = False

RuntimeError: TT_FATAL @ tt_eager/tt_dnn/op_library/bmm/multi_core_reuse_mcast_2d_optimized/bmm_op_multi_core_reuse_mcast_2d_optimized.cpp:995: num_blocks_total <= num_cores_x * num_cores_y
E       info:
E       Num total blocks must be smaller than num blocks y and num blocks x: 22 <= 11 * 1

and if I set ttnn_module_args.c6["use_1d_systolic_array"] = True I am getting

RuntimeError: TT_FATAL @ tt_eager/tt_dnn/op_library/work_split.hpp:129: target_num_cores <= total_available_cores
E       info:
E       Target number of cores {} is greater than total number of available cores {}
E       64
E       36 

I am attaching the link for the unit test of the conv case throwing the error. Add Unit tests for MobilenetV2 ops

To run the case with issue use the following command pytest tests/ttnn/unit_tests/operations/test_conv2d.py::test_mobilenetv2_conv_ttnn_issue_case

keerthana-r-mcw commented 4 months ago

WIP PR: 7485