-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Should n-arg fastmath addition default to using to 2-arg fastmath addition for all types #54456
Comments
Zentrik@769e583 fixes this by defining the vararg |
KristofferC
pushed a commit
that referenced
this issue
May 29, 2024
Currently using the fastmath vararg +, *, min, max methods only actually sets fastmath if they are specifically overloaded even when the correct 2 argument methods have been defined. As such, `ComplexF32, ComplexF64` do not currently set fastmath when using the vararg methods. This will also fix any other types, such as those in SIMD.jl, which don't overload the vararg methods. E.g. ```julia x = ComplexF64(1) f(x) = @fastmath x + x + x ``` now works correctly. I see no reason why the vararg methods shouldn't default to using the fastmath 2 argument methods instead of the non fastmath ones, which is the current behaviour. I also switched the implementation to use `afoldl` as that's what the non fastmath vararg methods use. Fixes #54456 and eschnett/SIMD.jl#108.
DilumAluthge
pushed a commit
that referenced
this issue
Jun 3, 2024
Currently using the fastmath vararg +, *, min, max methods only actually sets fastmath if they are specifically overloaded even when the correct 2 argument methods have been defined. As such, `ComplexF32, ComplexF64` do not currently set fastmath when using the vararg methods. This will also fix any other types, such as those in SIMD.jl, which don't overload the vararg methods. E.g. ```julia x = ComplexF64(1) f(x) = @fastmath x + x + x ``` now works correctly. I see no reason why the vararg methods shouldn't default to using the fastmath 2 argument methods instead of the non fastmath ones, which is the current behaviour. I also switched the implementation to use `afoldl` as that's what the non fastmath vararg methods use. Fixes #54456 and eschnett/SIMD.jl#108.
lazarusA
pushed a commit
to lazarusA/julia
that referenced
this issue
Jul 12, 2024
Currently using the fastmath vararg +, *, min, max methods only actually sets fastmath if they are specifically overloaded even when the correct 2 argument methods have been defined. As such, `ComplexF32, ComplexF64` do not currently set fastmath when using the vararg methods. This will also fix any other types, such as those in SIMD.jl, which don't overload the vararg methods. E.g. ```julia x = ComplexF64(1) f(x) = @fastmath x + x + x ``` now works correctly. I see no reason why the vararg methods shouldn't default to using the fastmath 2 argument methods instead of the non fastmath ones, which is the current behaviour. I also switched the implementation to use `afoldl` as that's what the non fastmath vararg methods use. Fixes JuliaLang#54456 and eschnett/SIMD.jl#108.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently the n-arg fastmath addition only uses fastmath for
Float16, Float32
andFloat64
,julia/base/fastmath.jl
Lines 171 to 172 in 931f6de
It otherwise falls back to non fastmath addition even when
add_fast(x, y)
is defined, like forComplexF64
and types in SIMD.jl.As the 2-arg fastmath add,
add_fast(x, y)
, is defined for all types, shouldadd_fast(x::T, y::T, zs::T...)
be defined as above for allT
.The comment at the non fastmath n-arg addition definition seems to suggest that this would be expected and also should
add_fast(x::T, y::T, zs::T...)
switch to usingafoldl
?julia/base/operators.jl
Lines 636 to 637 in 931f6de
Presumably, if we change the behaviour for addition, we want to change it for the other operators as well.
The text was updated successfully, but these errors were encountered: