-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[API Proposal]: VectorNNN.Create with broadcasting #92299
Comments
cc @tannergooding @dotnet/avx512-contrib |
Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics Issue DetailsBackground and motivationConstant vectors quite often have the same values in 128-bit lanes, it makes them especially verbose with AVX512, consider these: https://github.com/dotnet/runtime/blob/d29d4d04d20252c283b76fa50f04b6ebf5dc9d91/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Decoder.cs#L665-L681 it'd be nice to have a Create API that can automatically broadcasts lanes to keep code smaller (and data section's size too - but that is irrelevant here) API Proposalnamespace System.Runtime.Intrinsics
{
public static partial class Vector256
{
public static Vector256<T> Create<T>(Vector128<T> valueToBroadcast) where T : struct;
}
public static partial class Vector512
{
public static Vector512<T> Create<T>(Vector128<T> valueToBroadcast) where T : struct;
public static Vector512<T> Create<T>(Vector256<T> valueToBroadcast) where T : struct;
}
} API UsageVector512<sbyte> lutShift = Vector512.Create(
0, 16, 19, 4, -65, -65, -71, -71, 0, 0, 0, 0, 0, 0, 0, 0,
0, 16, 19, 4, -65, -65, -71, -71, 0, 0, 0, 0, 0, 0, 0, 0,
0, 16, 19, 4, -65, -65, -71, -71, 0, 0, 0, 0, 0, 0, 0, 0,
0, 16, 19, 4, -65, -65, -71, -71, 0, 0, 0, 0, 0, 0, 0, 0);
// becomes:
Vector512<sbyte> lutShift = Vector512.Create(
Vector128.Create(0, 16, 19, 4, -65, -65, -71, -71, 0, 0, 0, 0, 0, 0, 0, 0)); Alternative DesignsNo strong opinion on RisksNo response
|
We should include The parameter name should likely just be |
namespace System.Runtime.Intrinsics
{
public static partial class Vector128
{
public static Vector128<T> Create<T>(Vector64<T> value) where T : struct;
}
public static partial class Vector256
{
public static Vector256<T> Create<T>(Vector64<T> value) where T : struct;
public static Vector256<T> Create<T>(Vector128<T> value) where T : struct;
}
public static partial class Vector512
{
public static Vector512<T> Create<T>(Vector64<T> value) where T : struct;
public static Vector512<T> Create<T>(Vector128<T> value) where T : struct;
public static Vector512<T> Create<T>(Vector256<T> value) where T : struct;
}
} |
Background and motivation
Constant vectors quite often have the same values in 128-bit lanes, it makes them especially verbose with AVX512, consider these: https://github.com/dotnet/runtime/blob/d29d4d04d20252c283b76fa50f04b6ebf5dc9d91/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Base64Decoder.cs#L665-L681 it'd be nice to have a Create API that can automatically broadcasts lanes to keep code smaller (and data section's size too - but that is irrelevant here)
API Proposal
API Usage
Alternative Designs
No strong opinion on
Vector64
Risks
No response
The text was updated successfully, but these errors were encountered: