Open a74nh opened 1 month ago
Tagging subscribers to this area: @dotnet/area-system-numerics See info in area-owners.md if you want to be subscribed.
API proposals need to follow the recommended template: https://github.com/dotnet/runtime/blob/main/docs/project/api-review-process.md#steps
That includes explicitly listing the APIs that are desired to be exposed in a code block, such as:
namespace System.Runtime.Intrinsics.Arm;
public partial class Sve
{
public static Vector<float> CreateWhileLessThanMaskSingle(int left, int right);
public static Vector<float> CreateWhileLessThanMaskSingle(long left, long right);
public static Vector<float> CreateWhileLessThanMaskSingle(uint left, uint right);
public static Vector<float> CreateWhileLessThanMaskSingle(ulong left, ulong right);
// Rest of the APIs to be exposed listed here
}
Noting that we use Single
and Double
(matching System.Single
and System.Double
) not Float
, when exposing floating-point related APIs that need to be disambiguated by name
API proposals need to follow the recommended template: https://github.com/dotnet/runtime/blob/main/docs/project/api-review-process.md#steps
Updated as suggested in the top comment.
Added signed/unsigned versions of CreateWhileLessThanMask as suggested in #108384
nit: The Int8
ones should be SByte
and the UInt8
ones should be Byte
.
In general the rule is that we use the official type names rather than language specific keywords (such as byte
or long
) in API signatures. Byte
and SByte
are two where the official type name matches the C# keyword name and where the official type name doesn't follow the same convention as used for other integer types (i.e it isn't Int8
and UInt8
)
Background and motivation
Consider this function to Multiply two float arrays together and then sum the result.
The three casts to
Vector<float>
exist because there are nofloat
versionsCreateWhileLessThanMaskX()
andTestFirstTrue()
The following code looks much nicer and is easier to logically parse:
The same would then apply for other SVE APIs operating on a mask.
Also consider:
For the
for
loop we need a 16bitwhilelt
mask. The only way to create this is viaCreateWhileLessThanMask16Bit()
, but this returns aVector<ushort>
. It needs to be aVector<short>
so that it can be used in theconditionalSelect()
.The casting to
Vector<short>
is a little confusing.I suggest we add signed versions of
CreateWhileLessThanMask()
API Proposal
Using the same
T
syntax as other SVE proposals. These are all extensions of existing API methodsAPIs to add:
APIs to remove: