-
Notifications
You must be signed in to change notification settings - Fork 68
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
Preventing StackOverflowError
automatically with a @safe_turbo
?
#430
Comments
A likely culprit is the assumption that constructors/conversion returns an object of the given type, see JuliaLang/julia#42372 |
Adding a If you want to try:
c = callexpr(op.instruction)
pushfirst!(c.args, ArrayInterface.can_avx) Chain/intersect all of these in the julia> using ArrayInterface, LoopVectorization, SpecialFunctions
julia> ArrayInterface.can_avx(+)
true
julia> ArrayInterface.can_avx(exp)
true
julia> ArrayInterface.can_avx(gamma)
false
julia> ArrayInterface.can_avx(beta)
false |
Some special functions are also written in Julia, so you may be able to get SIMD compatible versions. |
Perhaps we should do this automatically instead, with |
Thanks, adding a kwarg and using |
Made a PR over in #431 |
Hey all,
I am eager to switch from
@inbounds @simd
to@turbo
in the evaluation loops of SymbolicRegression.jl, which is the backend for PySR. You can see my initial pull request here: MilesCranmer/SymbolicRegression.jl#132 which shows the loops I am attempting to speed up.The way my package works is that the user can pass any binary or unary operator (e.g.,
+
,-
,*
,/
,cos
,exp
, or any function they define). These operators will be arranged into expressions by a genetic algorithm until a combination is found that matches a relationship in a dataset. The evaluation of each expression needs to be high-performance, and is performed by a loop over an array with the@inbounds @simd
macros. This loop is behind a function barrier so that the performance is the same as if I had hard-coded each operator the user passed.I tried to switch to
@turbo
; however, I ended up seeingStackOverflowError
when testingSpecialFunctions.gamma
as an operator. From my look through these issues: #233, #232, it seems like certain functions will raise this error if they do not have SIMD implemented.Now, this is an issue for my package, since the user is allowed (and encouraged) to specify any Julia function they wish as the operator - even complex, branching functions (including any of
SpecialFunctions
) - and those operators will be used inside these loops. Now, I understand that each operator would need to be implemented as a SIMD operation for@turbo
to give a speedup, but I would still like to get the speed for other more standard operators, like+
,-
,*
,/
, etc.I am therefore wondering if it is possible to change
@turbo
to be robust againstStackOverflowErrors
, and fall back to a non-SIMD operations? Or, maybe a@safe_turbo
macro implemented that could do this? (This assumes I do not know what code the user would use inside each loop at runtime.)Thanks!
Miles
The text was updated successfully, but these errors were encountered: