From 24df6db130451b88d5e06c9803a7a7169863206a Mon Sep 17 00:00:00 2001 From: helloguo Date: Tue, 9 Oct 2018 11:38:27 -0700 Subject: [PATCH 1/2] use avx2 gather inst --- DotnetCLIVersion.txt | 2 +- src/Microsoft.ML.CpuMath/AvxIntrinsics.cs | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/DotnetCLIVersion.txt b/DotnetCLIVersion.txt index 6f1c03c6a3..23f4ef9a4c 100644 --- a/DotnetCLIVersion.txt +++ b/DotnetCLIVersion.txt @@ -1 +1 @@ -2.1.401 \ No newline at end of file +3.0.100-alpha1-009622 \ No newline at end of file diff --git a/src/Microsoft.ML.CpuMath/AvxIntrinsics.cs b/src/Microsoft.ML.CpuMath/AvxIntrinsics.cs index b31a427139..37868586aa 100644 --- a/src/Microsoft.ML.CpuMath/AvxIntrinsics.cs +++ b/src/Microsoft.ML.CpuMath/AvxIntrinsics.cs @@ -45,7 +45,17 @@ private static Vector128 GetHigh(in Vector256 x) [MethodImplAttribute(MethodImplOptions.AggressiveInlining)] private static unsafe Vector256 Load8(float* src, int* idx) - => Avx.SetVector256(src[idx[7]], src[idx[6]], src[idx[5]], src[idx[4]], src[idx[3]], src[idx[2]], src[idx[1]], src[idx[0]]); + { + if (Avx2.IsSupported) + { + Vector256 idx256 = Avx.LoadVector256(idx); + return Avx2.GatherVector256(src, idx256, 4); + } + else + { + return Avx.SetVector256(src[idx[7]], src[idx[6]], src[idx[5]], src[idx[4]], src[idx[3]], src[idx[2]], src[idx[1]], src[idx[0]]); + } + } [MethodImplAttribute(MethodImplOptions.AggressiveInlining)] private static unsafe void Store8(in Vector256 x, float* dst, int* idx) From d089511146a81701c6a7a3d681406f946207380d Mon Sep 17 00:00:00 2001 From: helloguo Date: Tue, 9 Oct 2018 12:18:04 -0700 Subject: [PATCH 2/2] revert cli version back --- DotnetCLIVersion.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DotnetCLIVersion.txt b/DotnetCLIVersion.txt index 23f4ef9a4c..6f1c03c6a3 100644 --- a/DotnetCLIVersion.txt +++ b/DotnetCLIVersion.txt @@ -1 +1 @@ -3.0.100-alpha1-009622 \ No newline at end of file +2.1.401 \ No newline at end of file