Description
Recently, @NimaSarajpoor added the cache._recompile()
function in PR #1048. After reading:
- https://numba.discourse.group/t/jit-recompile-with-new-arguments/1137
- https://numba.discourse.group/t/switching-between-parallel-serial-mode/1125
Specifically, this response caught my attention:
RE: .recompile() etc. The Numba dispatcher object (the thing returned by @jit) is configured directly from the @jit decorator options, the
configuration is not intended to be changed once the dispatcher object is constructed. The recompile() method exists to handle cases such as a global variable that a @jit function refers to changing (recall that Numba considers global variables as compile time constants, so if they change, need to recompile).
I am starting to question whether we should be calling func.recompile()
? Instead, I don't mind the monkey-patching solution. The key difference is that we are NOT monkey-patching an EXTERNAL module function and, instead, we are patching an INTERNAL module function, which is fine/safe!
Additionally, it seems much more maintainable.
This might resolve/simplify the unit tests that failed when NUMBA_JIT_DISABLE=1
.