Skip to content
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
8 changes: 3 additions & 5 deletions docs/building/netcoreapp3.0-instructions.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
In order to build ML.NET for .NET Core 3.0, you need to do a few manual steps.

1. Pick a version of the .NET Core 3.0 SDK you want to use. As of this writing, I'm using `3.0.100-alpha1-009622`. You can get the latest available version from the [dotnet/core-sdk README](https://github.com/dotnet/core-sdk#installers-and-binaries) page.
2. Change the [DotnetCLIVersion.txt](https://github.com/dotnet/machinelearning/blob/master/DotnetCLIVersion.txt) file to use that version number.
3. Delete the local `.\Tools\` folder from the root of the repo, to ensure you download the new version.
4. Run `.\build.cmd -- /p:Configuration=Release-Intrinsics` from the root of the repo.
5. If you want to build the NuGet packages, `.\build.cmd -buildPackages` after step 4.
1. Delete the local `.\Tools\` folder from the root of the repo, to ensure you download the new version of the .NET Core SDK.
2. Run `.\build.cmd -- /p:Configuration=Release-Intrinsics` or `.\build.cmd -Release-Intrinsics` from the root of the repo.
3. If you want to build the NuGet packages, `.\build.cmd -buildPackages` after step 2.

If you are using Visual Studio, you will need to do the following:

Expand Down
25 changes: 25 additions & 0 deletions src/Microsoft.ML.CpuMath/AvxIntrinsics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,8 @@ public static unsafe void Scale(float scale, Span<float> dst)

public static unsafe void ScaleSrcU(float scale, ReadOnlySpan<float> src, Span<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
{
Expand Down Expand Up @@ -1036,6 +1038,8 @@ public static unsafe void ScaleAddU(float a, float b, Span<float> dst)

public static unsafe void AddScaleU(float scale, ReadOnlySpan<float> src, Span<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
{
Expand Down Expand Up @@ -1088,6 +1092,9 @@ public static unsafe void AddScaleU(float scale, ReadOnlySpan<float> src, Span<f

public static unsafe void AddScaleCopyU(float scale, ReadOnlySpan<float> src, ReadOnlySpan<float> dst, Span<float> result, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
Contracts.Assert(count <= result.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
fixed (float* pres = &MemoryMarshal.GetReference(result))
Expand Down Expand Up @@ -1142,6 +1149,9 @@ public static unsafe void AddScaleCopyU(float scale, ReadOnlySpan<float> src, Re

public static unsafe void AddScaleSU(float scale, ReadOnlySpan<float> src, ReadOnlySpan<int> idx, Span<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
Contracts.Assert(count <= idx.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
Expand Down Expand Up @@ -1190,6 +1200,8 @@ public static unsafe void AddScaleSU(float scale, ReadOnlySpan<float> src, ReadO

public static unsafe void AddU(ReadOnlySpan<float> src, Span<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
{
Expand Down Expand Up @@ -1237,6 +1249,9 @@ public static unsafe void AddU(ReadOnlySpan<float> src, Span<float> dst, int cou

public static unsafe void AddSU(ReadOnlySpan<float> src, ReadOnlySpan<int> idx, Span<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
Contracts.Assert(count <= idx.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
Expand Down Expand Up @@ -1282,6 +1297,9 @@ public static unsafe void AddSU(ReadOnlySpan<float> src, ReadOnlySpan<int> idx,

public static unsafe void MulElementWiseU(ReadOnlySpan<float> src1, ReadOnlySpan<float> src2, Span<float> dst, int count)
{
Contracts.Assert(count <= src1.Length);
Contracts.Assert(count <= src2.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc1 = &MemoryMarshal.GetReference(src1))
fixed (float* psrc2 = &MemoryMarshal.GetReference(src2))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
Expand Down Expand Up @@ -1718,6 +1736,8 @@ public static unsafe float MaxAbsDiffU(float mean, ReadOnlySpan<float> src)

public static unsafe float DotU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
{
Expand Down Expand Up @@ -1770,6 +1790,9 @@ public static unsafe float DotU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst

public static unsafe float DotSU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, ReadOnlySpan<int> idx, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
Contracts.Assert(count <= idx.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
Expand Down Expand Up @@ -1824,6 +1847,8 @@ public static unsafe float DotSU(ReadOnlySpan<float> src, ReadOnlySpan<float> ds

public static unsafe float Dist2(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
{
Expand Down
26 changes: 26 additions & 0 deletions src/Microsoft.ML.CpuMath/SseIntrinsics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// * D suffix means convolution matrix, with implicit source padding.
// * Tran means the matrix is transposed.

using Microsoft.ML.Runtime.Internal.CpuMath.Core;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -884,6 +885,8 @@ public static unsafe void Scale(float scale, Span<float> dst)

public static unsafe void ScaleSrcU(float scale, ReadOnlySpan<float> src, Span<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
{
Expand Down Expand Up @@ -952,6 +955,8 @@ public static unsafe void ScaleAddU(float a, float b, Span<float> dst)

public static unsafe void AddScaleU(float scale, ReadOnlySpan<float> src, Span<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
{
Expand Down Expand Up @@ -991,6 +996,9 @@ public static unsafe void AddScaleU(float scale, ReadOnlySpan<float> src, Span<f

public static unsafe void AddScaleCopyU(float scale, ReadOnlySpan<float> src, ReadOnlySpan<float> dst, Span<float> result, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
Contracts.Assert(count <= result.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
fixed (float* pres = &MemoryMarshal.GetReference(result))
Expand Down Expand Up @@ -1032,6 +1040,9 @@ public static unsafe void AddScaleCopyU(float scale, ReadOnlySpan<float> src, Re

public static unsafe void AddScaleSU(float scale, ReadOnlySpan<float> src, ReadOnlySpan<int> idx, Span<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
Contracts.Assert(count <= idx.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
Expand Down Expand Up @@ -1068,6 +1079,8 @@ public static unsafe void AddScaleSU(float scale, ReadOnlySpan<float> src, ReadO

public static unsafe void AddU(ReadOnlySpan<float> src, Span<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
{
Expand Down Expand Up @@ -1103,6 +1116,9 @@ public static unsafe void AddU(ReadOnlySpan<float> src, Span<float> dst, int cou

public static unsafe void AddSU(ReadOnlySpan<float> src, ReadOnlySpan<int> idx, Span<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
Contracts.Assert(count <= idx.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
Expand Down Expand Up @@ -1136,6 +1152,9 @@ public static unsafe void AddSU(ReadOnlySpan<float> src, ReadOnlySpan<int> idx,

public static unsafe void MulElementWiseU(ReadOnlySpan<float> src1, ReadOnlySpan<float> src2, Span<float> dst, int count)
{
Contracts.Assert(count <= src1.Length);
Contracts.Assert(count <= src2.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc1 = &MemoryMarshal.GetReference(src1))
fixed (float* psrc2 = &MemoryMarshal.GetReference(src2))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
Expand Down Expand Up @@ -1470,6 +1489,8 @@ public static unsafe float MaxAbsDiffU(float mean, ReadOnlySpan<float> src)

public static unsafe float DotU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
{
Expand Down Expand Up @@ -1509,6 +1530,9 @@ public static unsafe float DotU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst

public static unsafe float DotSU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, ReadOnlySpan<int> idx, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
Contracts.Assert(count <= idx.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
Expand Down Expand Up @@ -1550,6 +1574,8 @@ public static unsafe float DotSU(ReadOnlySpan<float> src, ReadOnlySpan<float> ds

public static unsafe float Dist2(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, int count)
{
Contracts.Assert(count <= src.Length);
Contracts.Assert(count <= dst.Length);
fixed (float* psrc = &MemoryMarshal.GetReference(src))
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
{
Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ public void EntryPointPipelineEnsemble()
getterAnom(ref scoreAnom);
Assert.True(Single.IsNaN(scoreBin) && Single.IsNaN(score) || scoreBin == score);
Assert.True(Single.IsNaN(scoreBinCali) && Single.IsNaN(score) || scoreBinCali == score);
Assert.True(Single.IsNaN(scoreSaved) && Single.IsNaN(score) || CompareNumbersWithTolerance(scoreSaved, score, null, 6));
Assert.True(Single.IsNaN(scoreSaved) && Single.IsNaN(score) || CompareNumbersWithTolerance(scoreSaved, score, null, 5));
Assert.True(Single.IsNaN(scoreAnom) && Single.IsNaN(score) || scoreAnom == score);

Single avg = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.ML.Predictor.Tests/TestPredictors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public void BinaryClassifierLogisticRegressionBinNormTest()
/// <summary>
///A test for binary classifiers
///</summary>
[ConditionalFact(typeof(Environment), nameof(Environment.Is64BitProcess))] // x86 output differs from Baseline
[ConditionalFact(typeof(BaseTestBaseline), nameof(BaseTestBaseline.LessThanNetCore30OrNotNetCoreAnd64BitProcess))] // x86 output differs from Baseline and flaky on netcore 3.0
[TestCategory("Binary")]
public void BinaryClassifierLogisticRegressionGaussianNormTest()
{
Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.ML.TimeSeries.Tests/TimeSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void SavePipePercentileThreshold()
Done();
}

[Fact]
[ConditionalFact(typeof(BaseTestBaseline), nameof(BaseTestBaseline.LessThanNetCore30OrNotNetCore))] // Test is Flaky on netcore 3.0
public void SavePipeMovingAverageUniform()
{
TestCore(null, true,
Expand Down