-
Notifications
You must be signed in to change notification settings - Fork 61
Rebase on numba 0.46 #224
Rebase on numba 0.46 #224
Conversation
hpat/decorators.py
Outdated
@@ -47,6 +47,8 @@ def jit(signature_or_function=None, **options): | |||
return numba.jit(signature_or_function, **options) | |||
|
|||
_locals = options.pop('locals', {}) | |||
# print("\nlocals: " + str(_locals)) |
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.
remove
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.
Removed
hpat/decorators.py
Outdated
@@ -93,4 +95,5 @@ def jit(signature_or_function=None, **options): | |||
# this is for previous version of pipeline manipulation (numba hpat_req <0.38) | |||
# from .compiler import add_hpat_stages | |||
# return numba.jit(signature_or_function, user_pipeline_funcs=[add_hpat_stages], **options) | |||
# return numba.jit(signature_or_function, pipeline_class=hpat.compiler.HPATPipeline, **options) |
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.
remove
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.
Removed
hpat/distributed_analysis.py
Outdated
@@ -68,6 +68,9 @@ def _init_run(self): | |||
self.second_pass = False | |||
self.in_parallel_parfor = -1 | |||
|
|||
def run_pass(self, state): |
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.
remove and call run
directly
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 think run_pass(self, state) is interface function. It is better to inline run() here.
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.
renamed
hpat/tests/test_groupby.py
Outdated
@@ -394,6 +396,25 @@ def test_impl(df): | |||
hpat_func = hpat.jit(test_impl) | |||
pd.testing.assert_frame_equal(hpat_func(df), test_impl(df)) | |||
|
|||
def test_df_nonliteral(self): |
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.
skip this test for now?
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.
Removed
hpat/tests/test_series.py
Outdated
@@ -67,9 +68,19 @@ class TestSeries(unittest.TestCase): | |||
|
|||
def test_create1(self): | |||
def test_impl(): | |||
# a = 2 |
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.
remove
I assume we need to update numba version in our public ci as well |
Also, disable tests broken by parfor issue as were disscussed |
hpat/tests/test_series.py
Outdated
@@ -67,9 +68,19 @@ class TestSeries(unittest.TestCase): | |||
|
|||
def test_create1(self): | |||
def test_impl(): | |||
# a = 2 |
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.
# a = 2 |
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.
@Hardcode84
There is code suggestion tool in GitHub (ctrl+g)
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.
Removed
hpat/tests/test_series.py
Outdated
@@ -4,6 +4,7 @@ | |||
import numpy as np | |||
import pyarrow.parquet as pq | |||
import hpat | |||
import numba |
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.
import numba | |
import numba | |
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 is the difference?
hpat/tests/test_groupby.py
Outdated
@@ -8,6 +8,8 @@ | |||
count_parfor_OneDs, count_array_OneDs, dist_IR_contains, | |||
get_start_end) | |||
|
|||
from numba.special import literally |
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.
Is it used somewhere?
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.
no. Removed
hpat/compiler.py
Outdated
for idx, (x, _) in enumerate(pm.passes): | ||
if x == location: | ||
return idx | ||
else: |
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.
else:
is excess and could be removed because we don't have break
in the loop. Let's leave only raise
.
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.
fixed
def __init__(self): | ||
pass |
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.
Looks like it should work the same way without the stub.
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.
__init__
is marked as an abstract method in the base class
def __init__(self): | ||
pass |
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.
Looks like it should work the same way without the constructor, constructor of the parent class will be invoked anyway.
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.
__init__
is marked as an abstract method in the base class
state = namedtuple('State', | ||
['typingctx', 'targetctx', 'args', 'func_ir', 'typemap', 'return_type', | ||
'calltypes', 'metadata']) |
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.
Just in case there is another way to define named tuple:
from typing import NamedTuple
class State(NamedTuple):
typingctx: <type>
targetctx: <type>
args: <type>
func_ir: <type>
typemap: <type>
return_type: <type>
calltypes: <type>
metadata: <type>
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.
If you don't have strong opinion it should be modified, I'd prefer to left as is
hpat/tests/test_basic.py
Outdated
@@ -297,6 +297,7 @@ def test_array_reduce(self): | |||
self.assertEqual(count_array_OneDs(), 0) | |||
self.assertEqual(count_parfor_OneDs(), 1) | |||
|
|||
@unittest.skipIf(numba.__version__.startswith('0.46.'), "Broken in numba 0.46.x") |
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.
add url to issue numba/numba#4690
And IMO better to check exact version, e.g. if it will be still broken on 0.46.1 we will see that
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.
Also, maybe create some helper function to check numba version to avoid copypaste
def run(self): | ||
blocks = self.func_ir.blocks | ||
def __init__(self, state): | ||
self.state = state |
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.
self.func_ir, self.typemap, self.typingctx = self
?
no need to keep new variable in this case
hpat/distributed.py
Outdated
|
||
.. only:: developer | ||
|
||
The content for **Developer's Guide** should go here |
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.
It would be great to have any documentation
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.
It looks like this PR should be separated to, at least, two PRs. First PR is preparation work. For example, to rename variables self.typemap
to self.state.typemap
. It will not depend on Numba version
4bfb01c
to
945efb5
Compare
Split PR into 5 commits:
Most of commits would not work on numba 0.45 and doesn't work separately from each other, so all commits must be squashed before merge |
945efb5
to
9cda957
Compare
@@ -531,3 +532,7 @@ def dump_node_list(node_list): | |||
|
|||
def debug_prints(): | |||
return numba.config.DEBUG_ARRAY_OPT == 1 | |||
|
|||
def update_globals(func, glbls): |
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.
it looks like this function used nowhere. please delete
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.
It is used in distributed, dataframe, high frame typad & untyped passes. It updates globals in generated functions. It was introduced in order to restore functionality of inline_closure_call
which doesn't update globals anymore.
You can see details in related commit: 4b828c9
@@ -18,6 +18,7 @@ | |||
from hpat.str_ext import string_type, list_string_array_type | |||
from hpat.str_arr_ext import string_array_type, num_total_chars, pre_alloc_string_array | |||
from enum import Enum | |||
import types as pytypes |
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.
is it used in this module?
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.
It is used in update_globals
function
@@ -53,3 +53,6 @@ def get_start_end(n): | |||
start = hpat.distributed_api.get_start(n, n_pes, rank) | |||
end = hpat.distributed_api.get_end(n, n_pes, rank) | |||
return start, end | |||
|
|||
def check_numba_version(version): | |||
return numba.__version__ == version |
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.
numba.__version__
is shorter than check_numba_version
may be it is better to use this variable from Numba directly inplace?
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 don't know. For me both versions are fine, though version with function is a little bit better, since it doesn't looks so ugly and encapsulates details
ea2a9b0
to
2c0548e
Compare
Rebased & squashed |
No description provided.