We propose to breakdown the work into smaller pieces:
Replace usage of tt_eager based matmul ops in C++ with ttnn analogs (example)
Replace usage in python Models, Demos, Examples, tests (example)
Remove tt_lib bindings and entries from docs (bindings, docs)
Restructure tt_eager/tt_dnn/op_library/bmm_op and ttnn/cpp/ttnn/operations/matmul.hpp (see new structure)
Replacing usage in C++
Each usage of matmul should be replaced with a ttnn analog. For example tt::operations::primary::matmul --> ttnn::matmul.
Missing operations should be added to ttnn.
lots of usage in composite_ops.cpp, complex_ops.cpp, backward_ops.cpp
Consolidate matmuls in ttnn
Plan
We propose to breakdown the work into smaller pieces:
tt_eager/tt_dnn/op_library/bmm_op
andttnn/cpp/ttnn/operations/matmul.hpp
(see new structure)Replacing usage in C++
Each usage of matmul should be replaced with a ttnn analog. For example
tt::operations::primary::matmul
-->ttnn::matmul
. Missing operations should be added to ttnn.Replacing usage in Python
For every unary op, look for next entries in Tests/Sweeps, Demos, Models, Examples:
ttl.tensor.matmul
tt_lib.tensor.matmul
ttnn.primary.tensor.abs
and replace them withttnn.matmul
. ExampleBackground
We got a lot of duplication.
We register unary ops in C++ in both tt_lib and ttnn:
ttnn/cpp/ttnn/operations/matmul.hpp
provides scaffold for unary ops and registers them inttnn
tt_eager/tt_dnn/op_library/bmm/bmm_op.hpp
registers unary ops in tt_eagerWe bind these ops in both:
ttnn/cpp/pybind11/operations/matmul.hpp
tt_eager/tt_lib/csrc/tt_lib_bindings_tensor_custom_bmm_ops.cpp
We have tt_eager sweep tests, but they are not run on CI.
Duplication should go away. TTNN C++ and binding should remain and everything should get switched.
Testing
For the best coverage, I recommend to run these workflows. If some of them fails, check if it is the same fail as on main: