[WIP] better control of compilation of jitclass members #9565
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.
I'm attempting allowing users to control how the methods on their jitclasses are compiled. Currently everything is passed through
njit
and there's an opportunity to do something different.Proposed behaviours
There are two ideas for the behaviour that I had that I've listed below. At this stage I prefer option 1 because it's less complex and introduces fewer changes to the public API. But I can't deny that the second option would be more convenient for the use-case that prompted me to open the PR, since I'd just like to pass
cache=True
to all my member functions.Currently the code in the PR implements option 1.
Option 1: Options from jitclass or jitted method (but not both)
The first option is that you can "pre-jit" your method using
njit
and anynjit
options you give tojitclass
are irrelevant for that method.Option 2: Options from jitclass and jitted method are combined
The second option is that you can take the union of the two sets of arguments (with the method's keyword arguments taking priority) and compile the members that way. The easiest way I can think of to do this is to introduce a new
jitmethod
decorator that takes the same keyword arguments asnjit
.Notes
WIP
cache=True
parallel=True
nogil=True
StructRefProxy.__new__
to accept kwargs to control thenjit
of the constructor, and search for othernjit
uses inStructRef
andStructRefProxy
.