Skip to content

Reverting dead unallignedCode paths #1845

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

Merged
merged 3 commits into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
684 changes: 160 additions & 524 deletions src/Microsoft.ML.CpuMath/AvxIntrinsics.cs

Large diffs are not rendered by default.

411 changes: 383 additions & 28 deletions src/Microsoft.ML.CpuMath/CpuMathUtils.netstandard.cs

Large diffs are not rendered by default.

427 changes: 0 additions & 427 deletions src/Microsoft.ML.CpuMath/Sse.cs

This file was deleted.

649 changes: 129 additions & 520 deletions src/Microsoft.ML.CpuMath/SseIntrinsics.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Numerics;
using Microsoft.ML.Runtime;
using Microsoft.ML.Runtime.Data;
Expand Down Expand Up @@ -290,8 +288,8 @@ public AdaptiveSingularSpectrumSequenceModeler(IHostEnvironment env, int trainSi

_alpha = new Single[windowSize - 1];
_state = new Single[windowSize - 1];
_x = new CpuAlignedVector(windowSize, SseUtils.CbAlign);
_xSmooth = new CpuAlignedVector(windowSize, SseUtils.CbAlign);
_x = new CpuAlignedVector(windowSize, CpuMathUtils.GetVectorAlignment());
_xSmooth = new CpuAlignedVector(windowSize, CpuMathUtils.GetVectorAlignment());
ShouldComputeForecastIntervals = shouldComputeForecastIntervals;

_observationNoiseVariance = 0;
Expand Down Expand Up @@ -345,13 +343,13 @@ private AdaptiveSingularSpectrumSequenceModeler(AdaptiveSingularSpectrumSequence
_state = new Single[_windowSize - 1];
Array.Copy(model._state, _state, _windowSize - 1);

_x = new CpuAlignedVector(_windowSize, SseUtils.CbAlign);
_xSmooth = new CpuAlignedVector(_windowSize, SseUtils.CbAlign);
_x = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment());
_xSmooth = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment());

if (model._wTrans != null)
{
_y = new CpuAlignedVector(_rank, SseUtils.CbAlign);
_wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, SseUtils.CbAlign);
_y = new CpuAlignedVector(_rank, CpuMathUtils.GetVectorAlignment());
_wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, CpuMathUtils.GetVectorAlignment());
_wTrans.CopyFrom(model._wTrans);
}
}
Expand Down Expand Up @@ -452,18 +450,18 @@ public AdaptiveSingularSpectrumSequenceModeler(IHostEnvironment env, ModelLoadCo
{
var tempArray = ctx.Reader.ReadFloatArray();
_host.CheckDecode(Utils.Size(tempArray) == _rank * _windowSize);
_wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, SseUtils.CbAlign);
_wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, CpuMathUtils.GetVectorAlignment());
int i = 0;
_wTrans.CopyFrom(tempArray, ref i);
tempArray = ctx.Reader.ReadFloatArray();
i = 0;
_y = new CpuAlignedVector(_rank, SseUtils.CbAlign);
_y = new CpuAlignedVector(_rank, CpuMathUtils.GetVectorAlignment());
_y.CopyFrom(tempArray, ref i);
}

_buffer = TimeSeriesUtils.DeserializeFixedSizeQueueSingle(ctx.Reader, _host);
_x = new CpuAlignedVector(_windowSize, SseUtils.CbAlign);
_xSmooth = new CpuAlignedVector(_windowSize, SseUtils.CbAlign);
_x = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment());
_xSmooth = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment());
}

public override void Save(ModelSaveContext ctx)
Expand Down Expand Up @@ -1130,8 +1128,8 @@ internal override void Consume(ref Single input, bool updateModel = false)

if (_wTrans == null)
{
_y = new CpuAlignedVector(_rank, SseUtils.CbAlign);
_wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, SseUtils.CbAlign);
_y = new CpuAlignedVector(_rank, CpuMathUtils.GetVectorAlignment());
_wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, CpuMathUtils.GetVectorAlignment());
Single[] vecs = new Single[_rank * _windowSize];

for (i = 0; i < _rank; ++i)
Expand Down Expand Up @@ -1311,8 +1309,8 @@ private void TrainCore(Single[] dataArray, int originalSeriesLength)
_maxRank = _windowSize / 2;
_alpha = new Single[_windowSize - 1];
_state = new Single[_windowSize - 1];
_x = new CpuAlignedVector(_windowSize, SseUtils.CbAlign);
_xSmooth = new CpuAlignedVector(_windowSize, SseUtils.CbAlign);
_x = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment());
_xSmooth = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment());

TrainCore(dataArray, originalSeriesLength);
return;
Expand Down Expand Up @@ -1349,10 +1347,10 @@ private void TrainCore(Single[] dataArray, int originalSeriesLength)
}

// Setting the the y vector
_y = new CpuAlignedVector(_rank, SseUtils.CbAlign);
_y = new CpuAlignedVector(_rank, CpuMathUtils.GetVectorAlignment());

// Setting the weight matrix
_wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, SseUtils.CbAlign);
_wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, CpuMathUtils.GetVectorAlignment());
i = 0;
_wTrans.CopyFrom(leftSingularVecs, ref i);

Expand Down
Loading