Repository navigation
Add support for arrayanalysis of tuple args. #7398
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
Changes from 7 commits
36a9da7
85e5548
c3406ce
435d434
6be6198
96981f2
1f922eb
98a6923
68047d3
cdd7a26
8c06789
29c1440
ed34eb5
99dec34
391893a
e39f6c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,7 +24,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
| import subprocess as subp | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| import numba.parfors.parfor | ||||||||||||||||||||||||||||||||||||||||||||||||||
| from numba import njit, prange, set_num_threads, get_num_threads, typeof | ||||||||||||||||||||||||||||||||||||||||||||||||||
| from numba import njit, prange, set_num_threads, get_num_threads, typeof, literally | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
stuartarchibald marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| from numba.core import (types, utils, typing, errors, ir, rewrites, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| typed_passes, inline_closurecall, config, compiler, cpu) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| from numba.extending import (overload_method, register_model, | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1850,6 +1850,37 @@ def test_impl(x): | |||||||||||||||||||||||||||||||||||||||||||||||||
| x = np.ones((2, 2, 2, 2, 2, 15)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.check(test_impl, x) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_tuple_arg(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_impl(x, sz): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for i in numba.pndindex(sz): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| x[i] = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return x | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sz = (10,10) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.check(test_impl, np.empty(sz), sz) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_tuple_arg_literal(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_impl(x, sz): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for i in numba.pndindex(sz): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| x[i] = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return x | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sz = (10,numba.literally(10)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
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. I'm not sure that this has the desired effect. Lines 64 to 87 in 4a3d575
it might be necessary to close over or locally define a const to get a literal if that's the intent?
Contributor
Author
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. I've added some tests and tried to generate the right tuples using what I think you were suggesting above with one literal arg but there is some lowering error I don't understand. Can you take a look at it? |
||||||||||||||||||||||||||||||||||||||||||||||||||
| self.check(test_impl, np.empty(sz), sz) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_tuple_arg_1d(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_impl(x, sz): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for i in numba.pndindex(sz): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| x[i] = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return x | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sz = (10,) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.check(test_impl, np.empty(sz), sz) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_tuple_arg_1d_literal(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_impl(x, sz): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| for i in numba.pndindex(sz): | ||||||||||||||||||||||||||||||||||||||||||||||||||
| x[i] = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return x | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sz = (numba.literally(10),) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| self.check(test_impl, np.empty(sz), sz) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| @skip_parfors_unsupported | ||||||||||||||||||||||||||||||||||||||||||||||||||
| class TestParforsLeaks(MemoryLeakMixin, TestParforsBase): | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.