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
Object mode or no-jit at all for unknown objects #4159
Comments
Thanks for writing this up, I'm going to raise it at the core developer meeting today. |
Make sure we also note this comment #3907 (comment) |
Yeah, this is a good point. Things we are trying to discourage with this change:
That said, I agree that there is a potential use for Numba in situations where the author doesn't have total control over the types coming in, and would like some kind of best-effort compilation attempt. As you point out, this still needs assistance from the Numba dispatcher, in order to recognize argument type combinations where nopython mode will fail, and immediately dispatch to the interpreter without attempting to compile. One possible solution (not committing to this, but just brainstorming) would be a new option
This would be considered an advanced option that should only be used if the user understands the implications, and has the advantage of avoiding object mode while also allowing dispatch between compiled and interpreted implementations. I'll bring this up at the developer meeting and see what people think. We're very hesitant to add new options to an already option-heavy |
@seibert @stuartarchibald thanks for considering it. If
or even make room for future expansion
|
The conclusion from today's discussion is that we're convinced by the arguments from you and @godaygo, and want to fuse the above proposal with this one: #3907 (comment).
In retrospect, this would have been a much better and more explicit way to handle our object-mode fallback logic, and it also allows library authors more freedom to use Numba for some cases, and do something entirely different when it doesn't work. I'm not sure on the ETA for this, but we'll definitely get it into Numba at least one release before we drop object-mode fallback. Thanks for talking through this. These discussions are very helpful for us. :) |
glad to be of help! |
Hi,
I'm following up on #3907, regarding the deprecation of object mode. I almost never use object mode, but I could imagine a case like this:
That example behaves as expected, all three lines produce a result. However, I think that it works by falling back on object mode. If object-mode fallback is removed, what would happen to a case like that?
I understand that there's an opportunity to simplify the pipeline by removing the fallback, but would it be possible to leave some kind of multiple-dispatch on unknown types that runs object-mode or simply interpreted code?
Unlike the current case, I don't think it needs to look line-by-line inside the function to know whether to fall back. For example, whereas today the following works via object-mode fallback
in the future it would not, because it's not a problem of input parameters but of code failing. So in the future
foo(0.5)
would fail as it fails today withnjit
butdouble(pd.DataFrame(np.ones(3)))
would not fail (as it does with njit) but would fallback to object code or interpreted code.Something to consider. Thanks for your work on Numba.
The text was updated successfully, but these errors were encountered: