翼度科技»论坛 编程开发 .net 查看内容

发布 VectorTraits v2.0(支持 x86的Sse系列指令集等)

3

主题

3

帖子

9

积分

新手上路

Rank: 1

积分
9
目录

VectorTraits已更新至 v2.0版。支持 x86的Sse系列指令集; 为 Vector128/Vector256 补充全部的向量方法; 还提供了 浮点数判断(YIsNaN, YIsinfinity)、符号判断(YCopySign, YSign) 等原创的向量方法。
变更日志如下。

  • Major: Support for the X86 Sse family instruction set; supplement all vector methods for Vector128/Vector256; also provides innovative vector methods such as check floating number (YIsNaN, YIsInfinity), sign (YCopySign, YSign) (支持 x86的Sse系列指令集; 为 Vector128/Vector256 补充全部的向量方法; 还提供了 浮点数判断(YIsNaN, YIsinfinity)、符号判断(YCopySign, YSign) 等原创的向量方法).
  • Provides the CPU model info (提供CPU型号信息). VectorEnvironment adds members: CpuModelName, CpuFlags, CpuDetectionCommand, CpuDetectionException, CpuDetectionResult .
  • Provides information about the supported instruction set (提供所支持的指令集信息). e.g. VectorEnvironment.SupportedInstructionSets, IBaseTraits.UsedInstructionSets
  • Supplement all vector methods for Vector128/Vector256 (为 Vector128/Vector256 补充全部的向量方法): Dot, Equals, EqualsAll, EqualsAny, GreaterThanAll, GreaterThanAny, GreaterThanOrEqual, GreaterThanOrEqualAll, GreaterThanOrEqualAny, LessThanAll, LessThanAny, LessThanOrEqual, LessThanOrEqualAll, LessThanOrEqualAny, Sqrt .
  • Provides the vector methods of bitwise operations (提供位运算的向量方法): YBitToByte, YBitToInt16, YBitToInt32, YBitToInt64, YOrNot .
  • Provides the vector methods of check floating number (提供浮点数判断的向量方法): YIsEvenInteger, YIsFinite, YIsInfinity, YIsInfinityOrNaN, YIsInteger, YIsNaN, YIsNegative, YIsNegativeZero, YIsNegativeInfinity, YIsNormal, YIsNotNaN, YIsOddInteger, YIsPositive, YIsPositiveInfinity, YIsSubnormal, YIsZero, YIsZeroOrSubnormal.
  • Provides the vector methods of check sign (提供符号判断的向量方法): YCopySign, YSign, YSignFloat .
  • Provides the vector methods of clamp (提供限制的向量方法): YMaxNumber, YMinNumber .
  • Provides the vector methods of compare (提供比较的向量方法): YIsAllTrue, YIsAnyTrue, YIsNotEquals.
  • VectorTraits.dll: Add TargetFrameworks net8.0 and netstandard2.1 (增加目标框架 net8.0 与 netstandard2.1 ).
  • Provides arrays of fixed length (提供固定长度的数组). e.g. FixedArray2, FixedArray4 ...
  • BitMath changed from static to abstract class. Add namespace Zyl.VectorTraits.Numerics, add some math functions (BitMath从静态类改为抽象类. 新增名称空间 Zyl.VectorTraits.Numerics, 增加一些的数学函数).
  • Benchmark programs add command line parameter (基准测试程序增加命令行参数): -accelerated0 -allowFakeBenchmark -cpuDetection0 -fixedVector0 -test0
  • Add tool program (增加工具程序): UpdateBenchmarkResults.
  • Optimized hardware acceleration of ExtractMostSignificantBits methods in the Arm architecture (优化ExtractMostSignificantBits方法在Arm架构的硬件加速). For 8~64 bit types.
完整列表: ChangeLog
支持 x86的Sse系列指令集

本库已经支持了x86架构的Sse系列指令集。既:Sse, Sse2, Sse3, Ssse3, Sse41, Sse42。
在X86架构上使用128位向量(Vector128、128位时的Vector)时,现在能充分获得硬件加速。
为 Vector128/Vector256 补充全部的向量方法

相关日志:

  • Supplement all vector methods for Vector128/Vector256 (为 Vector128/Vector256 补充全部的向量方法): Dot, Equals, EqualsAll, EqualsAny, GreaterThanAll, GreaterThanAny, GreaterThanOrEqual, GreaterThanOrEqualAll, GreaterThanOrEqualAny, LessThanAll, LessThanAny, LessThanOrEqual, LessThanOrEqualAll, LessThanOrEqualAny, Sqrt .
对于固定长度的向量类型(Vector128/Vector256),在v1.0版时只是提供了常用的向量方法。
而现在v2.0版,已经补充全部的向量方法。已经覆盖了 .NET 7.0中所有运算类的向量方法。例如 Dot, Equals, EqualsAll, EqualsAny 等.
这些向量方法的清单如下。

  • Dot①: Computes the dot product of two vectors (计算两个向量的点积).
    Mnemonic: rt := left[0]*right[0] + left[1]*right[1] + left[2]*right[2] + ... + left[Count-1]*right[Count-1] .
  • Equals: Compares two vectors to determine if they are equal on a per-element basis (比较两个向量,确定它们每个元素是否相等).
    Mnemonic: rt := to_mask(left == right).
  • EqualsAll: Compares two vectors to determine if all elements are equal (比较两个向量以判定所有元素是否相等).
    Mnemonic: rt := (left[0] == right[0]) && (left[1] == right[1]) && ... && (left[Count-1] == right[Count-1]).
  • EqualsAny: Compares two vectors to determine if any elements are equal (比较两个向量以判定任一元素是否相等).
    Mnemonic: rt := (left[0] == right[0]) || (left[1] == right[1]) || ... || (left[Count-1] == right[Count-1]).
  • GreaterThanAll: Compares two vectors to determine if all elements are greater (比较两个向量以判定所有元素是否大于).
    Mnemonic: rt := (left[0] > right[0]) && (left[1] > right[1]) && ... && (left[Count-1] > right[Count-1]).
  • GreaterThanAny: Compares two vectors to determine if any elements are greater (比较两个向量以判定任一元素是否大于).
    Mnemonic: rt := (left[0] > right[0]) || (left[1] > right[1]) || ... || (left[Count-1] > right[Count-1]).
  • GreaterThanOrEqual: Compares two vectors to determine which is greater or equal on a per-element basis (比较两个向量,在每个元素的基础上确定哪个更大或等于).
    Mnemonic: rt := to_mask(left >= right).
  • GreaterThanOrEqualAll: Compares two vectors to determine if all elements are greater or equal (比较两个向量以判定所有元素是否大于或等于).
    Mnemonic: rt := (left[0] >= right[0]) && (left[1] >= right[1]) && ... && (left[Count-1] >= right[Count-1]).
  • GreaterThanOrEqualAny: Compares two vectors to determine if any elements are greater or equal (比较两个向量以判定任一元素是否大于或等于).
    Mnemonic: rt := (left[0] >= right[0]) || (left[1] >= right[1]) || ... || (left[Count-1] >= right[Count-1]).
  • LessThanAll: Compares two vectors to determine if all elements are less (比较两个向量以判定所有元素是否小于).
    Mnemonic: rt := (left[0] < right[0]) && (left[1] < right[1]) && ... && (left[Count-1] < right[Count-1]).
  • LessThanAny: Compares two vectors to determine if any elements are less (比较两个向量以判定任一元素是否小于).
    Mnemonic: rt := (left[0] < right[0]) || (left[1] < right[1]) || ... || (left[Count-1] < right[Count-1]).
  • LessThanOrEqual: Compares two vectors to determine which is less or equal on a per-element basis (比较两个向量,在每个元素的基础上确定哪个更小或等于).
    Mnemonic: rt := to_mask(left >i)&1)) .
注:YBitToByte 等方法,是 ExtractMostSignificantBits 方法的逆运算。
浮点数判断的向量方法

<ul>YIsEvenInteger: Determines if a element represents an even integral number (确定元素是否为偶数整数).
Mnemonic: rt := to_mask(isEvenInteger(value)) .YIsFinite: Determines if a element is finite. It contains zero, subnormal, and normal. It does not contain infinity, NaN (确定元素是否为有限值. 它包含 零、次正规数、正规数. 它不含无穷大、非数).
Mnemonic: rt := to_mask(isFinite(value)) .YIsInfinity: Determines if a element is infinite (确定元素是否为无穷大).
Mnemonic: rt := to_mask(isInfinity(value)) .YIsInfinityOrNaN: Determines if a element is infinite or NaN (确定元素是否为无穷大或非数).
Mnemonic: rt := to_mask(isInfinityOrNaN(value)) .YIsInteger: Determines if a element represents an integral number (确定元素是否为整数).
Mnemonic: rt := to_mask(isInteger(value)) .YIsNaN: Determines if a element is NaN (确定元素是否为非数).
Mnemonic: rt := to_mask(isNaN(value)) .YIsNegative: Determines if a element represents a negative number or negative zero (确定元素是否为负数或负零).
Mnemonic: rt := to_mask(isNegative(value)) = to_mask((value

举报 回复 使用道具