-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update documentation for adding new ttnn operation #9841
Conversation
0023da1
to
7f41f47
Compare
7f41f47
to
c03faf6
Compare
c03faf6
to
c4f8469
Compare
dtype, | ||
operation::DEFAULT_OUTPUT_MEMORY_CONFIG, | ||
optional_output_tensor, | ||
activations); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want to do this on this PR so that the optional_output_tensor is properly handled?
// TODO: add support for optional_output_tensors
// auto optional_output_tensors = extract_args_to_vector(std::forward<args_t>(args)...,
// std::optional<ttnn::Tensor>);
```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do in next PR
|
||
A ttnn operation is a function that takes in one or more input tensors and produces one or more output tensors. It is implemented in C++ and can be called from Python. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function but not really :D
|
||
`ttnn/cpp/ttnn/operations/<category>/<operation_name>/device/<operation_name>_device_operation.hpp` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little concerned about category part. People often mess up with categorizaton, specially when it is not 100% clear.. I am ok to keep it like that, just want to raise a Q for discussion.
|
||
`ttnn/cpp/ttnn/operations/<category>/<operation_name>/device/<operation_name>_device_operation.hpp` | ||
`ttnn/cpp/ttnn/operations/<category>/<operation_name>/device/<operation_name>_device_operation.cpp` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_device_operation is what we called <operation_name>_op.hpp/.cpp
before?
|
||
from tests.ttnn.utils_for_testing import assert_with_pcc | ||
In order to add a new operation, add the following file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add a brief description of this file.
It basically provides a structure and registers the operation.
The cool thing about the structure is that it allows to provide multiple overloads.
The cool thing about registering that it allows to instrument calls to an operation with goodies like "...list...".
|
||
.. code-block:: python | ||
A concrete example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe lets add some notes about consistency? not sure if here or in general.
we want ops to be consistent.
e.g.
kw_only memory_config = None
kw_only queue_id in python and overload in c++
kw_only optional output tensor/s
kw_only dtype
Specific names, specific defaults EXCEPT when not possible and something else is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do in the next PR
@@ -385,7 +385,13 @@ inline std::string op_meta_data_serialized_json( | |||
|
|||
j["optional_input_tensors"] = std::vector<json>{}; | |||
|
|||
auto perfModel = operation_t::create_op_performance_model(operation_attributes, tensor_args, tensor_return_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to write some more info on "how to perf model?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add some more info on:
- Tests
- Placing in Experimental
- Error checking
c4f8469
to
45889a5
Compare
Ticket
Link to Github Issue
Problem description
Documentation for adding a new ttnn operation is out of data
What's changed
Add an example of how to add a new operation and update the documentation using the example
Checklist