-
Notifications
You must be signed in to change notification settings - Fork 24
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
Numba 0.54 NumbaIRAssumptionWarning #178
Labels
numba compatibility
Affects compatibility with Numba
Comments
Pinned Numba to <0.54 in c14f2ca. |
As of this date with In [1]: import galois
In [2]: galois.__version__
Out[2]: '0.0.22'
In [3]: import numba
In [4]: numba.__version__
Out[4]: '0.54.0'
In [5]: GF = galois.GF(2**8, compile="jit-calculate")
In [6]: x = GF.Random(10); x
Out[6]: GF([ 65, 146, 183, 209, 229, 126, 21, 182, 85, 43], order=2^8)
In [7]: y = GF.Random(10); y
Out[7]: GF([193, 201, 2, 2, 123, 188, 14, 203, 128, 90], order=2^8)
In [8]: x * y
/home/matt/.local/lib/python3.8/site-packages/numba/core/ssa.py:272: NumbaIRAssumptionWarning: variable 'a.1.1' is not in scope.
This warning came from an internal pedantic check. Please report the warning
message and traceback, along with a minimal reproducer at:
https://github.com/numba/numba/issues/new?template=bug_report.md
warnings.warn(errors.NumbaIRAssumptionWarning(wmsg,
/home/matt/.local/lib/python3.8/site-packages/numba/core/ssa.py:272: NumbaIRAssumptionWarning: variable 'b.1.1' is not in scope.
This warning came from an internal pedantic check. Please report the warning
message and traceback, along with a minimal reproducer at:
https://github.com/numba/numba/issues/new?template=bug_report.md
warnings.warn(errors.NumbaIRAssumptionWarning(wmsg,
Out[8]: GF([203, 227, 115, 191, 177, 11, 214, 137, 213, 139], order=2^8) |
Replacing the inputs @staticmethod
@numba.extending.register_jitable(inline="always")
def _multiply_calculate(aa, bb, CHARACTERISTIC, DEGREE, IRREDUCIBLE_POLY):
"""
a in GF(2^m), can be represented as a degree m-1 polynomial a(x) in GF(2)[x]
b in GF(2^m), can be represented as a degree m-1 polynomial b(x) in GF(2)[x]
p(x) in GF(2)[x] with degree m is the irreducible polynomial of GF(2^m)
a * b = c
= (a(x) * b(x)) % p(x) in GF(2)
= c(x)
= c
"""
ORDER = CHARACTERISTIC**DEGREE
# Re-order operands such that a > b so the while loop has less loops
if bb > aa:
aa, bb = bb, aa
c = 0
while bb > 0:
if bb & 0b1:
c ^= aa # Add aa(x) to c(x)
bb >>= 1 # Divide bb(x) by x
aa <<= 1 # Multiply aa(x) by x
if aa >= ORDER:
aa ^= IRREDUCIBLE_POLY # Compute aa(x) % p(x)
return c In [1]: import galois
In [2]: galois.__version__
Out[2]: '0.0.22'
In [3]: import numba
In [4]: numba.__version__
Out[4]: '0.54.1'
In [5]: GF = galois.GF(2**8, compile="jit-calculate")
In [6]: x = GF.Random(10); x
Out[6]: GF([116, 50, 199, 161, 194, 123, 31, 58, 165, 93], order=2^8)
In [7]: y = GF.Random(10); y
Out[7]: GF([139, 204, 7, 0, 153, 132, 226, 80, 85, 14], order=2^8)
In [8]: x * y
Out[8]: GF([131, 97, 111, 0, 169, 186, 81, 161, 187, 1], order=2^8) |
I filed numba/numba#7623. It appears renaming the lambda arguments resolves the issue as well. For instance if cls._UFUNC_TYPE[name] == "unary":
cls._UFUNC_CACHE_CALCULATE[key] = numba.vectorize(["int64(int64)"], nopython=True)(lambda a: function(a, characteristic, degree, irreducible_poly))
else:
cls._UFUNC_CACHE_CALCULATE[key] = numba.vectorize(["int64(int64, int64)"], nopython=True)(lambda a, b: function(a, b, characteristic, degree, irreducible_poly)) to if cls._UFUNC_TYPE[name] == "unary":
cls._UFUNC_CACHE_CALCULATE[key] = numba.vectorize(["int64(int64)"], nopython=True)(lambda aa: function(aa, characteristic, degree, irreducible_poly))
else:
cls._UFUNC_CACHE_CALCULATE[key] = numba.vectorize(["int64(int64, int64)"], nopython=True)(lambda aa, bb: function(aa, bb, characteristic, degree, irreducible_poly)) |
This was referenced Jan 29, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Numba 0.53.1
Numba 0.54
The text was updated successfully, but these errors were encountered: