-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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] Improvements tvm.script.highlight #13438
[TVMScript] Improvements tvm.script.highlight #13438
Conversation
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 |
This PR started from finding that the |
- Automatically use "black" formatter if available. - Allow overrides of pygmentize style based on environment variable `TVM_PYGMENTIZE_STYLE`.
a992917
to
1bde12c
Compare
Using black for formatting is a great idea! On the other hand, sometimes we want to toggle it off for huge IRs, for example, the winograd TIR has two extremely long lines which we dont really need to read much into: https://gist.github.com/zxybazh/0019023b0796a55c9fadb12593852f84. Would love to get some thoughts from you which one is better: formatting by default or not? |
Oof, yeah, looks like that one becomes pretty heavily indented with I think I'd still lean toward having the formatting enabled by default, since I think it improves readability on average, but it would be good to have a way to disable it when debugging cases where the readability is worsened. Maybe having the argument default be set by an environment variable, so that the formatting could be enabled/disabled across all calls as needed. |
Hmm, I'm also wondering on the representation of B[i, j] = T.Select(
i % 4 == 3 and j % 4 == 3,
T.float32(1),
i % 4 == 3 and j % 4 == 2,
T.float32(0),
i % 4 == 3 and j % 4 == 1,
T.float32(0),
i % 4 == 3 and j % 4 == 0,
T.float32(0),
i % 4 == 2 and j % 4 == 3,
T.float32(0),
i % 4 == 2 and j % 4 == 2,
T.float32(1),
i % 4 == 2 and j % 4 == 1,
T.float32(1),
i % 4 == 2 and j % 4 == 0,
T.float32(-1),
i % 4 == 1 and j % 4 == 3,
T.float32(-1),
i % 4 == 1 and j % 4 == 2,
T.float32(1),
i % 4 == 1 and j % 4 == 1,
T.float32(-1),
i % 4 == 1 and j % 4 == 0,
T.float32(0),
i % 4 == 0 and j % 4 == 3,
T.float32(0),
i % 4 == 0 and j % 4 == 2,
T.float32(0),
i % 4 == 0 and j % 4 == 1,
T.float32(0),
i % 4 == 0 and j % 4 == 0,
T.float32(1),
T.float32(0),
) |
Some background: The reason that winograd conv2d has such a long chained On sugaring long chained My two-cents: as long as we have a flag to turn it off, in |
Good point on the |
891a9f4
to
46cd938
Compare
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.
LGTM!
* [TVMScript] Improvements tvm.script.highlight - Automatically use "black" formatter if available. - Allow overrides of pygmentize style based on environment variable `TVM_PYGMENTIZE_STYLE`. - Forwarded `black_format` argument from `show` method to `cprint`
Automatically use "black" formatter if available.
Allow overrides of pygmentize style based on environment variable
TVM_PYGMENTIZE_STYLE
.