Skip to content

Conversation

AndrewZhaoLuo
Copy link
Contributor

@AndrewZhaoLuo AndrewZhaoLuo commented Apr 20, 2021

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.

@AndrewZhaoLuo
Copy link
Contributor Author

@masahi PTAL. Also Chris Hoge.

@masahi masahi self-assigned this Apr 21, 2021
.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.
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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
Copy link
Member

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

Copy link
Contributor Author

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

----------------------------------------

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.
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

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
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@masahi
Copy link
Member

masahi commented Apr 21, 2021

@hogepodge

@AndrewZhaoLuo
Copy link
Contributor Author

@masahi Thanks for the comments. PTAL

@AndrewZhaoLuo AndrewZhaoLuo changed the title Update Dev. Doc. on how to add a new relay operator [Docs] Update Dev. Doc. on how to add a new relay operator Apr 21, 2021
@masahi masahi merged commit 9514e9e into apache:main Apr 22, 2021
@masahi
Copy link
Member

masahi commented Apr 22, 2021

Thanks @AndrewZhaoLuo

mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Apr 22, 2021
* first draft of add op

* first pass editting doc

* make main title visible again

* address masa's comments
echuraev pushed a commit to echuraev/tvm that referenced this pull request Apr 29, 2021
* first draft of add op

* first pass editting doc

* make main title visible again

* address masa's comments
umangyadav pushed a commit to umangyadav/tvm that referenced this pull request May 5, 2021
* first draft of add op

* first pass editting doc

* make main title visible again

* address masa's comments
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
* first draft of add op

* first pass editting doc

* make main title visible again

* address masa's comments
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
* first draft of add op

* first pass editting doc

* make main title visible again

* address masa's comments
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
* first draft of add op

* first pass editting doc

* make main title visible again

* address masa's comments
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
* first draft of add op

* first pass editting doc

* make main title visible again

* address masa's comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants