-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Docs] Update Dev. Doc. on how to add a new relay operator #7893
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
[Docs] Update Dev. Doc. on how to add a new relay operator #7893
Conversation
@masahi PTAL. Also Chris Hoge. |
docs/dev/relay_add_op.rst
Outdated
.set_attr<TOpPattern>("TOpPattern", kOpaque); | ||
|
||
In this case the ``TOpPattern`` is a hint to the compiler on the pattern of computation the operator does, which might be | ||
useful for reordering loops and fusing operators. ``kOpaque`` tells TVM not to not bother trying to fuse this operator. |
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.
Let's drop reordering loops
, TOpPattern
is only used for operater fusion.
A typo: not to not bother
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.
Done
docs/dev/relay_add_op.rst
Outdated
more details on how to do this, we recommend looking up the tutorials | ||
on `tensor expressions`_, `TVM's operator inventory (topi)`_ and looking at the | ||
examples cumulative sum and product found in `python/tvm/topi/scan.py`_ and | ||
`python/tvm/topi/cuda/scan.py`_. In the case of our cumulative sum and product operations |
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.
Multiple references to the same 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.
They actually are different files. One is the generic implementation and one is the cuda/gpu implementation. I've made this clearer in the text
docs/dev/relay_add_op.rst
Outdated
---------------------------------------- | ||
|
||
While we've now defined the interface for the operation but still have not | ||
told TVM how to perform the actual calculations for cumulative sum and product. |
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.
Need to polish this sentence
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.
PTAL
docs/dev/relay_add_op.rst
Outdated
5. Hooking up Compute and Strategy with Relay | ||
--------------------------------------------- | ||
|
||
After you have implemented how your function can be computed we now need to glue it to our |
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.
After you have implemented your compute function
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.
Done
@masahi Thanks for the comments. PTAL |
Thanks @AndrewZhaoLuo |
* first draft of add op * first pass editting doc * make main title visible again * address masa's comments
* first draft of add op * first pass editting doc * make main title visible again * address masa's comments
* first draft of add op * first pass editting doc * make main title visible again * address masa's comments
* first draft of add op * first pass editting doc * make main title visible again * address masa's comments
* first draft of add op * first pass editting doc * make main title visible again * address masa's comments
* first draft of add op * first pass editting doc * make main title visible again * address masa's comments
* first draft of add op * first pass editting doc * make main title visible again * address masa's comments
Updates the tutorial and goes more in depth by using a more substantial operator than simple element-wise addition.
Instead we follow how PR #7334 and PR #7722 added cumulative product and addition operators.
Testing:
Ran
restview docs/dev/relay_add_op.rst
And read the document.