-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Lang] Add ti.static_assert for compile-time assertations #1344
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1344 +/- ##
=========================================
Coverage ? 66.76%
=========================================
Files ? 37
Lines ? 5197
Branches ? 933
=========================================
Hits ? 3470
Misses ? 1566
Partials ? 161 Continue to review full report at Codecov.
|
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.
Great work! 🚀 🎸
def is_odd(x: ti.template()): | ||
ti.static_assert(x.data_type() == ti.i32, "is_odd() is only supported for i32") | ||
return x % 2 == 1 | ||
|
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.
We may give ti.static_assert
a function demonstration here? so that people can realize it receive 2 parameters, the first one is assert expresstion and the second is a statement.
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 thought all Python users who know assert
knows this failure message feature?
Good morning @archibate ! Thanks for your hard work! It's a very nice doc that explains the usage of debugging tools clearly. only + few nits. |
Co-authored-by: Danni <[email protected]> Co-authored-by: Xudong Feng <[email protected]>
Co-authored-by: Yuanming Hu <[email protected]> Co-authored-by: Xudong Feng <[email protected]> Co-authored-by: Danni <[email protected]>
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.
Nothing much for me to add here! 🚀
Co-authored-by: Danni <[email protected]> Co-authored-by: Yuanming Hu <[email protected]>
Co-authored-by: Danni <[email protected]>
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.
Thank you! LGTM except for a few more wording nits.
Co-authored-by: Yuanming Hu <[email protected]>
Great! I'll merge once CI pass, hope our doc&tools could help users to debug their program easier! |
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.
Thanks. I think this PR is ready to merge anytime.
Related issue = #
[Click here for the format server]