-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Minor cleanup of the Vector64/128/256/512 implementations to improve fallbacks #103095
Conversation
Vector256.Divide(left._upper, right._upper) | ||
); | ||
} | ||
public static Vector512<T> Divide<T>(Vector512<T> left, Vector512<T> right) => left / right; |
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.
Cases like this were where size regressions were coming from. This ensures that instead we hit the intrinsic path when we're accelerated and otherwise we get the same overall codegen as before.
@@ -1988,7 +2004,7 @@ public static Vector512<T> Min<T>(Vector512<T> left, Vector512<T> right) | |||
/// <returns>The product of <paramref name="left" /> and <paramref name="right" />.</returns> | |||
/// <exception cref="NotSupportedException">The type of <paramref name="left" /> and <paramref name="right" /> (<typeparamref name="T" />) is not supported.</exception> | |||
[Intrinsic] | |||
public static Vector512<T> Multiply<T>(T left, Vector512<T> right) => left * right; | |||
public static Vector512<T> Multiply<T>(T left, Vector512<T> right) => right * left; |
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.
Cases like this aren't strictly needed, but it avoids needing +1 inlining step when we aren't accelerated and defers to the core algorithm instead.
This overload is just convenience so that scalar * vector
and vector * scalar
both work, since the operation is commutative, so there's no optimization opportunity missing here either.
Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics |
Size regressions in APIs like For There's a few places where the fallbacks involving The meaningful places that will execute when |
CC. @EgorBo |
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.
LGTM
Continuation of #102301, just cleaning up some of the logic to require less inlining and defer to the same size core API for the fallback implementation where trivially possible.