Skip to content
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

Add prefer_literal option to overload API #6058

Merged
merged 10 commits into from Aug 4, 2020

Conversation

sklam
Copy link
Member

@sklam sklam commented Jul 31, 2020

Based on #6035

Add prefer_literal option to @overload and @overload_method.
Fixes method dispatch in BoundFunction to follow #6035

- Fix method resolution to consider prefer_literal
@sklam sklam added this to the Numba 0.51 RC milestone Jul 31, 2020
@sklam sklam marked this pull request as ready for review August 3, 2020 20:07
@stuartarchibald
Copy link
Contributor

Failing test:

ERROR: test_function_incompatible_templates (numba.tests.test_types.TestTypes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vsts/work/1/s/numba/tests/test_types.py", line 255, in test_function_incompatible_templates
    template1 = make_overload_template(func_stub, ol, {}, True, 'never')
TypeError: make_overload_template() missing 1 required positional argument: 'prefer_literal'

@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review and removed 3 - Ready for Review labels Aug 4, 2020
@sklam sklam added 4 - Waiting on reviewer Waiting for reviewer to respond to author and removed 4 - Waiting on author Waiting for author to respond to review labels Aug 4, 2020
Copy link
Contributor

@stuartarchibald stuartarchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch, looks good, couple of minor things to look at.

@@ -55,7 +55,8 @@ def generic(self):
_overload_default_jit_options = {'no_cpython_wrapper': True}


def overload(func, jit_options={}, strict=True, inline='never'):
def overload(func, jit_options={}, strict=True, inline='never',
prefer_literal=False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be documented? OR given the likelihood of it becoming a namedtuple or something for the next release, leave it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, i should document it and leave a note that it might change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 89a3840

Comment on lines 396 to 397
unliteral_args = tuple([unliteral(a) for a in args])
unliteral_kws = {k: unliteral(v) for k, v in kws.items()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BaseFunction::get_call_type uses _unlit_non_poison https://github.com/numba/numba/pull/6058/files#diff-758157deb494d50a6d6c93447b370a05R227-R234 want to reuse here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good pt

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in efaa1a7

@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review and removed 4 - Waiting on reviewer Waiting for reviewer to respond to author labels Aug 4, 2020
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
Copy link
Contributor

@stuartarchibald stuartarchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes.

@stuartarchibald stuartarchibald added 4 - Waiting on CI Review etc done, waiting for CI to finish 5 - Ready to merge Review and testing done, is ready to merge and removed 4 - Waiting on author Waiting for author to respond to review 4 - Waiting on CI Review etc done, waiting for CI to finish labels Aug 4, 2020
@sklam sklam merged commit bed4d04 into numba:master Aug 4, 2020
@sklam sklam deleted the fix/overspecialize_option branch August 4, 2020 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to merge Review and testing done, is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants