-
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] "ti.chain_compare" now can return python-scope constants #1356
Merged
archibate
merged 5 commits into
taichi-dev:master
from
archibate:ti-chain-compare-support-python-scope
Jul 3, 2020
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8f3d85b
Revert "[skip ci] revert ti.chain_compare"
archibate 5fbcf16
add func eval twice test according to @yuanming-hu
archibate c7284d8
[skip ci] Merge branch 'master' into ti-chain-compare-support-python-…
archibate 65ad3c5
fix https://github.com/taichi-dev/taichi/pull/1355#discussion_r448752644
archibate 1e233e9
[skip ci] enforce code format
taichi-gardener File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,6 +97,27 @@ def func(): | |
assert a[2] # ti.append returns 0 | ||
|
||
|
||
@ti.all_archs | ||
def test_no_duplicate_eval_func(): | ||
a = ti.var(ti.i32, ()) | ||
b = ti.var(ti.i32, ()) | ||
|
||
@ti.func | ||
def why_this_foo_fail(n): | ||
return ti.atomic_add(b[None], n) | ||
|
||
def foo(n): | ||
return ti.atomic_add(ti.subscript(b, None), n) | ||
|
||
@ti.kernel | ||
def func(): | ||
a[None] = 0 <= foo(2) < 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done here @yuanming-hu. |
||
|
||
func() | ||
assert a[None] == 1 | ||
assert b[None] == 2 | ||
|
||
|
||
@ti.require(ti.extension.sparse) | ||
@ti.all_archs | ||
def test_chain_compare(): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Fix in #1380.