Skip to content
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

[TVMScript][UX] Introduce decorator for deprecation #13941

Conversation

junrushao
Copy link
Member

@junrushao junrushao commented Feb 9, 2023

This PR introduces a decorator tvm.ir.base.deprecated, which emits a
deprecation warning if an outdated API is used, but preserves backward
compatibility by still allowing the API to be used.

For example, currently the preferred way of TIR buffer declaration in
function signature is:

def example(
  A: T.Buffer(...),  # legacy behavior is `T.Buffer[...]`
): ...

With this decorator, if a user writes T.Buffer[...], the parser will
still function properly, but emits a warning that guides the user to
adopt T.Buffer(...) if possible.

While there is no breaking change at all in this PR, we believe this
is useful to help users upgrade before any breaking change eventually
takes place.

@tvm-bot
Copy link
Collaborator

tvm-bot commented Feb 9, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@junrushao junrushao force-pushed the feature/2023-02-08/deprecate-tir-legacy-behavior branch from 4011018 to 9b1846d Compare February 9, 2023 19:05
@junrushao junrushao changed the title [TVMScript] Introduce decorator for deprecation [TVMScript][UX] Introduce decorator for deprecation Feb 9, 2023
@junrushao
Copy link
Member Author

CC: @cyx-6 @wrongtest-intellif @Hzfengsy

@junrushao junrushao force-pushed the feature/2023-02-08/deprecate-tir-legacy-behavior branch 4 times, most recently from a129272 to 6e41cc5 Compare February 10, 2023 01:26
@junrushao junrushao marked this pull request as ready for review February 10, 2023 01:27
This PR introduces a decorator `tvm.ir.base.deprecated`, which emits a
deprecation warning if an outdated API is used, but preserves backward
compatibility by still allowing the API to be used.

For example, currently the preferred way of TIR buffer declaration in
function signature is:

```python
def example(
  A: T.Buffer(...),  # legacy behavior is `T.Buffer[...]`
): ...
```

With this decorator, if a user writes `T.Buffer[...]`, the parser will
still function properly, but emits a warning that guides the user to
adopt `T.Buffer(...)` if possible.

While there is no breaking change at all in this PR, we believe this
is useful to help users upgrade before any breaking change eventually
takes place.
@junrushao junrushao force-pushed the feature/2023-02-08/deprecate-tir-legacy-behavior branch from 6e41cc5 to 0b6bcb9 Compare February 10, 2023 06:41
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.

4 participants