-
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
[bug] [refactor] Fix error when ti.init() not called by deprecating Expr.layout_materialized #1347
[bug] [refactor] Fix error when ti.init() not called by deprecating Expr.layout_materialized #1347
Conversation
…ecating Expr.layout_materialized
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'm not sure why @yuanming-hu use
Expr.layout_materialized
instead of simplyti.get_runtime().materialized
at the first place, maybe it was due toget_runtime()
not done at that moment?
Sorry, it's been too long and I simply don't remember :-)
Your implementation looks good. Do we still support @ti.layout
after this PR?
@@ -114,7 +114,7 @@ def fill(self, val): | |||
from .meta import fill_tensor | |||
fill_tensor(self, val) | |||
|
|||
@deprecated('tensor.parent()', 'tensor.snode().parent()') | |||
#@deprecated('tensor.parent()', 'tensor.snode().parent()') |
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.
So we no longer deprecate this?
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.
Yes, since tensor.parent()
returns a tensor
while tensor.snode().parent()
return a snode, it seems this is irreplaceable and many test is using this..
tests/python/test_000_runtime.py
Outdated
|
||
|
||
# The first test to run, ever: | ||
def test_000_without_init(): |
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.
What does 000
mean here and in the file name?
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.
Seems pytest
will starts from the lowest character order, so I use 000
to make test_000_without_init
starts at the very first time when ti.init()
has never been called in @ti.all_archs
, to test if Taichi is functional even without ti.init()
.
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.
Interesting - maybe we should simply let ti.reset
clear everything, as if no ti.init()
has been called? This will make the system more testable.
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.
ti.reset()
I want to test if non of ti.reset
or ti.init
is called is working.
So, I'm creating a sandbox Taichi by creating a taichi_temp_test.py
for test.
Btw, we may add a ti.reset()
to taichi startup script to make your test method work? Not sure if this can crash doc-bots & make startup slower.
Co-authored-by: Yuanming Hu <[email protected]>
…ub.com/archibate/taichi into fix-expr-layout-materialized-not-found
Codecov Report
@@ Coverage Diff @@
## master #1347 +/- ##
==========================================
+ Coverage 85.58% 85.61% +0.03%
==========================================
Files 19 19
Lines 3371 3365 -6
Branches 624 624
==========================================
- Hits 2885 2881 -4
+ Misses 356 355 -1
+ Partials 130 129 -1
Continue to review full report at Codecov.
|
Co-authored-by: Ye Kuang <[email protected]>
Related issue = close #1335
[Click here for the format server]
I'm not sure why @yuanming-hu use
Expr.layout_materialized
instead of simplyti.get_runtime().materialized
at the first place, maybe it was due toget_runtime()
not done at that moment?