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
Switch on SLP vectorize. #6275
Switch on SLP vectorize. #6275
Conversation
As title.
Seeing what impact this has on testing run times. |
Command: Mainline does this:
This branch does this:
seems like the impact on the test suite run time is potentially small/zero. |
Mainline: In [1]: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:from numba import njit
import numpy as np
@njit
def foo(a1, a2, b1, b2, A):
for x in range(0, len(A), 4):
Z = A[x:x + 4]
Z[0] = a1*(a1 + b1)
Z[1] = a2*(a2 + b2)
Z[2] = a1*(a1 + b1)
Z[3] = a2*(a2 + b2)
foo(1.2, 3.4, 5.6, 7.8, np.empty(4000))::::::::::::
:<EOF>
In [2]: G = np.empty(40000)
In [3]: %timeit foo(1.2, 3.4, 5.6, 7.8, G)
12.9 µs ± 2.75 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) This branch: In [1]: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:from numba import njit
import numpy as np
@njit
def foo(a1, a2, b1, b2, A):
for x in range(0, len(A), 4):
Z = A[x:x + 4]
Z[0] = a1*(a1 + b1)
Z[1] = a2*(a2 + b2)
Z[2] = a1*(a1 + b1)
Z[3] = a2*(a2 + b2)
foo(1.2, 3.4, 5.6, 7.8, np.empty(4000))::::::::::::
:<EOF>
In [2]: G = np.empty(40000)
In [3]: %timeit foo(1.2, 3.4, 5.6, 7.8, G)
10.3 µs ± 22.8 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
|
numba/core/codegen.py
Outdated
@@ -714,7 +714,8 @@ def _pass_manager_builder(self): | |||
missed... | |||
""" | |||
pmb = lp.create_pass_manager_builder( | |||
opt=config.OPT, loop_vectorize=config.LOOP_VECTORIZE) | |||
opt=config.OPT, loop_vectorize=config.LOOP_VECTORIZE, | |||
slp_vectorize=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this also get a config
flag? e.g. config.SLP_VECTORIZE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do, but I really want to move away from specific config flags for each feature in the optimiser, I think it should be in the hands of the user but also it shouldn't be spelled one at a time like this. For 0.52 shall we do a flag so it's easy to debug/turn off but this is the last one like it!?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, make it the last flag.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
As title.