Skip to content

Commit 3d33e20

Browse files
authored
Adding a new CI leg for netcoreapp 3.0 (#1700)
* adding new ci leg * removing . * Fixing and disabling tests for netcoreapp3.0 * skipping some more tests and name change * added comments and conditional fact * name changed to NotNetCore30 * name changed and reding cli version from the file * name changed to DotnetCLIVersion.netcoreapp.latest.txt * contracts assert cprrected for avx=intrinscis fixing new tests broken by other commits Fixing Tests
1 parent 4d1223d commit 3d33e20

File tree

20 files changed

+84
-102
lines changed

20 files changed

+84
-102
lines changed

.vsts-dotnet-ci.yml

+14
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ phases:
2323
queue:
2424
name: Hosted VS2017
2525

26+
- template: /build/ci/phase-template.yml
27+
parameters:
28+
name: core30
29+
buildScript: build.cmd
30+
customMatrixes:
31+
Build_Debug_Intrinsics:
32+
_configuration: Debug-Intrinsics
33+
_config_short: DI
34+
Build_Release_Intrinsics:
35+
_configuration: Release-Intrinsics
36+
_config_short: RI
37+
queue:
38+
name: Hosted VS2017
39+
2640
- template: /build/ci/phase-template.yml
2741
parameters:
2842
name: Windows_x86
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0.100-alpha1-009622

build/ci/phase-template.yml

+10-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ parameters:
33
architecture: x64
44
buildScript: ''
55
queue: {}
6+
customMatrixes: ''
67

78
phases:
89
- phase: ${{ parameters.name }}
@@ -14,12 +15,15 @@ phases:
1415
timeoutInMinutes: 45
1516
parallel: 99
1617
matrix:
17-
Build_Debug:
18-
_configuration: Debug
19-
_config_short: D
20-
Build_Release:
21-
_configuration: Release
22-
_config_short: R
18+
${{ if eq(parameters.customMatrixes, '') }}:
19+
Build_Debug:
20+
_configuration: Debug
21+
_config_short: D
22+
Build_Release:
23+
_configuration: Release
24+
_config_short: R
25+
${{ if ne(parameters.customMatrixes, '') }}:
26+
${{ insert }}: ${{ parameters.customMatrixes }}
2327
${{ insert }}: ${{ parameters.queue }}
2428
steps:
2529
- script: $(_buildScript) -$(_configuration) -buildArch=$(_arch)

config.json

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Configuration": {
44
"description": "Sets the optimization level for the Build Configuration you want to build.",
55
"valueType": "property",
6-
"values": [ "Debug", "Release" ],
6+
"values": [ "Debug", "Release", "Debug-Intrinsics", "Release-Intrinsics" ],
77
"defaultValue": "Debug"
88
},
99
"TargetArchitecture": {
@@ -94,6 +94,18 @@
9494
"Configuration": "Release"
9595
}
9696
},
97+
"debug-intrinsics": {
98+
"description": "Sets optimization level to debug for managed build configuration and builds against netcoreapp3.0. (/p:Configuration=Debug-Intrinsics)",
99+
"settings": {
100+
"Configuration": "Debug-Intrinsics"
101+
}
102+
},
103+
"release-intrinsics": {
104+
"description": "Sets optimization level to release for managed build configuration and builds against netcoreapp3.0. (/p:Configuration=Release-Intrinsics)",
105+
"settings": {
106+
"Configuration": "Release-Intrinsics"
107+
}
108+
},
97109
"buildArch": {
98110
"description": "Sets the architecture for the native build. (/p:TargetArchitecture=[value])",
99111
"settings": {

init-tools.cmd

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ if exist "%DotNetBuildToolsDir%" (
4646
echo Running %0 > "%INIT_TOOLS_LOG%"
4747

4848
set /p DOTNET_VERSION=< "%~dp0DotnetCLIVersion.txt"
49-
if exist "%DOTNET_CMD%" goto :afterdotnetrestore
5049

5150
:Arg_Loop
5251
if [%1] == [] goto :ArchSet
53-
if /i [%1] == [x86] ( set ARCH=x86&&goto ArchSet)
52+
if /i [%1] == [x86] ( set ARCH=x86)
53+
if /i [%1] == [-Debug-Intrinsics] ( set /p DOTNET_VERSION=< "%~dp0DotnetCLIVersion.netcoreapp.latest.txt")
54+
if /i [%1] == [-Release-Intrinsics] ( set /p DOTNET_VERSION=< "%~dp0DotnetCLIVersion.netcoreapp.latest.txt")
5455
shift
5556
goto :Arg_Loop
5657

5758
:ArchSet
59+
if exist "%DOTNET_CMD%" goto :afterdotnetrestore
5860

5961
echo Installing dotnet cli...
6062
if NOT exist "%DOTNET_PATH%" mkdir "%DOTNET_PATH%"

src/Microsoft.ML.CpuMath/AvxIntrinsics.cs

+1-27
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// * P suffix means sparse (unaligned) partial vector - the vector is only part of a larger sparse vector.
1010
// * Tran means the matrix is transposed.
1111

12+
using Microsoft.ML.Runtime.Internal.CpuMath.Core;
1213
using System;
1314
using System.Runtime.CompilerServices;
1415
using System.Runtime.InteropServices;
@@ -158,9 +159,6 @@ public static unsafe void MatMul(AlignedArray mat, AlignedArray src, AlignedArra
158159

159160
public static unsafe void MatMul(ReadOnlySpan<float> mat, ReadOnlySpan<float> src, Span<float> dst, int crow, int ccol)
160161
{
161-
Contracts.Assert(crow % 4 == 0);
162-
Contracts.Assert(ccol % 4 == 0);
163-
164162
fixed (float* psrc = &MemoryMarshal.GetReference(src))
165163
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
166164
fixed (float* pmat = &MemoryMarshal.GetReference(mat))
@@ -313,9 +311,6 @@ public static unsafe void MatMulP(AlignedArray mat, ReadOnlySpan<int> rgposSrc,
313311
public static unsafe void MatMulP(ReadOnlySpan<float> mat, ReadOnlySpan<int> rgposSrc, ReadOnlySpan<float> src,
314312
int posMin, int iposMin, int iposEnd, Span<float> dst, int crow, int ccol)
315313
{
316-
Contracts.Assert(crow % 8 == 0);
317-
Contracts.Assert(ccol % 8 == 0);
318-
319314
// REVIEW: For extremely sparse inputs, interchanging the loops would
320315
// likely be more efficient.
321316
fixed (float* psrc = &MemoryMarshal.GetReference(src))
@@ -473,9 +468,6 @@ public static unsafe void MatMulTran(AlignedArray mat, AlignedArray src, Aligned
473468

474469
public static unsafe void MatMulTran(ReadOnlySpan<float> mat, ReadOnlySpan<float> src, Span<float> dst, int crow, int ccol)
475470
{
476-
Contracts.Assert(crow % 4 == 0);
477-
Contracts.Assert(ccol % 4 == 0);
478-
479471
fixed (float* psrc = &MemoryMarshal.GetReference(src))
480472
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
481473
fixed (float* pmat = &MemoryMarshal.GetReference(mat))
@@ -951,8 +943,6 @@ public static unsafe void Scale(float scale, Span<float> dst)
951943

952944
public static unsafe void ScaleSrcU(float scale, ReadOnlySpan<float> src, Span<float> dst, int count)
953945
{
954-
Contracts.Assert(src.Length == dst.Length);
955-
956946
fixed (float* psrc = &MemoryMarshal.GetReference(src))
957947
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
958948
{
@@ -1046,8 +1036,6 @@ public static unsafe void ScaleAddU(float a, float b, Span<float> dst)
10461036

10471037
public static unsafe void AddScaleU(float scale, ReadOnlySpan<float> src, Span<float> dst, int count)
10481038
{
1049-
Contracts.Assert(src.Length == dst.Length);
1050-
10511039
fixed (float* psrc = &MemoryMarshal.GetReference(src))
10521040
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
10531041
{
@@ -1100,8 +1088,6 @@ public static unsafe void AddScaleU(float scale, ReadOnlySpan<float> src, Span<f
11001088

11011089
public static unsafe void AddScaleCopyU(float scale, ReadOnlySpan<float> src, ReadOnlySpan<float> dst, Span<float> result, int count)
11021090
{
1103-
Contracts.Assert(src.Length == dst.Length);
1104-
11051091
fixed (float* psrc = &MemoryMarshal.GetReference(src))
11061092
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
11071093
fixed (float* pres = &MemoryMarshal.GetReference(result))
@@ -1156,8 +1142,6 @@ public static unsafe void AddScaleCopyU(float scale, ReadOnlySpan<float> src, Re
11561142

11571143
public static unsafe void AddScaleSU(float scale, ReadOnlySpan<float> src, ReadOnlySpan<int> idx, Span<float> dst, int count)
11581144
{
1159-
Contracts.Assert(src.Length == dst.Length);
1160-
11611145
fixed (float* psrc = &MemoryMarshal.GetReference(src))
11621146
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
11631147
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
@@ -1206,8 +1190,6 @@ public static unsafe void AddScaleSU(float scale, ReadOnlySpan<float> src, ReadO
12061190

12071191
public static unsafe void AddU(ReadOnlySpan<float> src, Span<float> dst, int count)
12081192
{
1209-
Contracts.Assert(src.Length == dst.Length);
1210-
12111193
fixed (float* psrc = &MemoryMarshal.GetReference(src))
12121194
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
12131195
{
@@ -1255,8 +1237,6 @@ public static unsafe void AddU(ReadOnlySpan<float> src, Span<float> dst, int cou
12551237

12561238
public static unsafe void AddSU(ReadOnlySpan<float> src, ReadOnlySpan<int> idx, Span<float> dst, int count)
12571239
{
1258-
Contracts.Assert(src.Length == dst.Length);
1259-
12601240
fixed (float* psrc = &MemoryMarshal.GetReference(src))
12611241
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
12621242
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
@@ -1738,8 +1718,6 @@ public static unsafe float MaxAbsDiffU(float mean, ReadOnlySpan<float> src)
17381718

17391719
public static unsafe float DotU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, int count)
17401720
{
1741-
Contracts.Assert(src.Length == dst.Length);
1742-
17431721
fixed (float* psrc = &MemoryMarshal.GetReference(src))
17441722
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
17451723
{
@@ -1792,8 +1770,6 @@ public static unsafe float DotU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst
17921770

17931771
public static unsafe float DotSU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, ReadOnlySpan<int> idx, int count)
17941772
{
1795-
Contracts.Assert(src.Length == dst.Length);
1796-
17971773
fixed (float* psrc = &MemoryMarshal.GetReference(src))
17981774
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
17991775
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
@@ -1848,8 +1824,6 @@ public static unsafe float DotSU(ReadOnlySpan<float> src, ReadOnlySpan<float> ds
18481824

18491825
public static unsafe float Dist2(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, int count)
18501826
{
1851-
Contracts.Assert(src.Length == dst.Length);
1852-
18531827
fixed (float* psrc = &MemoryMarshal.GetReference(src))
18541828
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
18551829
{

src/Microsoft.ML.CpuMath/SseIntrinsics.cs

-30
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ public static unsafe void MatMul(AlignedArray mat, AlignedArray src, AlignedArra
122122

123123
public static unsafe void MatMul(ReadOnlySpan<float> mat, ReadOnlySpan<float> src, Span<float> dst, int crow, int ccol)
124124
{
125-
Contracts.Assert(crow % 4 == 0);
126-
Contracts.Assert(ccol % 4 == 0);
127-
128125
fixed (float* psrc = &MemoryMarshal.GetReference(src))
129126
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
130127
fixed (float* pmat = &MemoryMarshal.GetReference(mat))
@@ -285,9 +282,6 @@ public static unsafe void MatMulP(AlignedArray mat, ReadOnlySpan<int> rgposSrc,
285282
public static unsafe void MatMulP(ReadOnlySpan<float> mat, ReadOnlySpan<int> rgposSrc, ReadOnlySpan<float> src,
286283
int posMin, int iposMin, int iposEnd, Span<float> dst, int crow, int ccol)
287284
{
288-
Contracts.Assert(crow % 4 == 0);
289-
Contracts.Assert(ccol % 4 == 0);
290-
291285
// REVIEW: For extremely sparse inputs, interchanging the loops would
292286
// likely be more efficient.
293287
fixed (float* psrc = &MemoryMarshal.GetReference(src))
@@ -448,9 +442,6 @@ public static unsafe void MatMulTran(AlignedArray mat, AlignedArray src, Aligned
448442

449443
public static unsafe void MatMulTran(ReadOnlySpan<float> mat, ReadOnlySpan<float> src, Span<float> dst, int crow, int ccol)
450444
{
451-
Contracts.Assert(crow % 4 == 0);
452-
Contracts.Assert(ccol % 4 == 0);
453-
454445
fixed (float* psrc = &MemoryMarshal.GetReference(src))
455446
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
456447
fixed (float* pmat = &MemoryMarshal.GetReference(mat))
@@ -893,8 +884,6 @@ public static unsafe void Scale(float scale, Span<float> dst)
893884

894885
public static unsafe void ScaleSrcU(float scale, ReadOnlySpan<float> src, Span<float> dst, int count)
895886
{
896-
Contracts.Assert(src.Length == dst.Length);
897-
898887
fixed (float* psrc = &MemoryMarshal.GetReference(src))
899888
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
900889
{
@@ -963,8 +952,6 @@ public static unsafe void ScaleAddU(float a, float b, Span<float> dst)
963952

964953
public static unsafe void AddScaleU(float scale, ReadOnlySpan<float> src, Span<float> dst, int count)
965954
{
966-
Contracts.Assert(src.Length == dst.Length);
967-
968955
fixed (float* psrc = &MemoryMarshal.GetReference(src))
969956
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
970957
{
@@ -1004,8 +991,6 @@ public static unsafe void AddScaleU(float scale, ReadOnlySpan<float> src, Span<f
1004991

1005992
public static unsafe void AddScaleCopyU(float scale, ReadOnlySpan<float> src, ReadOnlySpan<float> dst, Span<float> result, int count)
1006993
{
1007-
Contracts.Assert(src.Length == dst.Length);
1008-
1009994
fixed (float* psrc = &MemoryMarshal.GetReference(src))
1010995
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
1011996
fixed (float* pres = &MemoryMarshal.GetReference(result))
@@ -1047,8 +1032,6 @@ public static unsafe void AddScaleCopyU(float scale, ReadOnlySpan<float> src, Re
10471032

10481033
public static unsafe void AddScaleSU(float scale, ReadOnlySpan<float> src, ReadOnlySpan<int> idx, Span<float> dst, int count)
10491034
{
1050-
Contracts.Assert(src.Length == dst.Length);
1051-
10521035
fixed (float* psrc = &MemoryMarshal.GetReference(src))
10531036
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
10541037
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
@@ -1085,8 +1068,6 @@ public static unsafe void AddScaleSU(float scale, ReadOnlySpan<float> src, ReadO
10851068

10861069
public static unsafe void AddU(ReadOnlySpan<float> src, Span<float> dst, int count)
10871070
{
1088-
Contracts.Assert(src.Length == dst.Length);
1089-
10901071
fixed (float* psrc = &MemoryMarshal.GetReference(src))
10911072
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
10921073
{
@@ -1122,8 +1103,6 @@ public static unsafe void AddU(ReadOnlySpan<float> src, Span<float> dst, int cou
11221103

11231104
public static unsafe void AddSU(ReadOnlySpan<float> src, ReadOnlySpan<int> idx, Span<float> dst, int count)
11241105
{
1125-
Contracts.Assert(src.Length == dst.Length);
1126-
11271106
fixed (float* psrc = &MemoryMarshal.GetReference(src))
11281107
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
11291108
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
@@ -1157,9 +1136,6 @@ public static unsafe void AddSU(ReadOnlySpan<float> src, ReadOnlySpan<int> idx,
11571136

11581137
public static unsafe void MulElementWiseU(ReadOnlySpan<float> src1, ReadOnlySpan<float> src2, Span<float> dst, int count)
11591138
{
1160-
Contracts.Assert(src1.Length == dst.Length);
1161-
Contracts.Assert(src2.Length == dst.Length);
1162-
11631139
fixed (float* psrc1 = &MemoryMarshal.GetReference(src1))
11641140
fixed (float* psrc2 = &MemoryMarshal.GetReference(src2))
11651141
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
@@ -1494,8 +1470,6 @@ public static unsafe float MaxAbsDiffU(float mean, ReadOnlySpan<float> src)
14941470

14951471
public static unsafe float DotU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, int count)
14961472
{
1497-
Contracts.Assert(src.Length == dst.Length);
1498-
14991473
fixed (float* psrc = &MemoryMarshal.GetReference(src))
15001474
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
15011475
{
@@ -1535,8 +1509,6 @@ public static unsafe float DotU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst
15351509

15361510
public static unsafe float DotSU(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, ReadOnlySpan<int> idx, int count)
15371511
{
1538-
Contracts.Assert(src.Length == dst.Length);
1539-
15401512
fixed (float* psrc = &MemoryMarshal.GetReference(src))
15411513
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
15421514
fixed (int* pidx = &MemoryMarshal.GetReference(idx))
@@ -1578,8 +1550,6 @@ public static unsafe float DotSU(ReadOnlySpan<float> src, ReadOnlySpan<float> ds
15781550

15791551
public static unsafe float Dist2(ReadOnlySpan<float> src, ReadOnlySpan<float> dst, int count)
15801552
{
1581-
Contracts.Assert(src.Length == dst.Length);
1582-
15831553
fixed (float* psrc = &MemoryMarshal.GetReference(src))
15841554
fixed (float* pdst = &MemoryMarshal.GetReference(dst))
15851555
{

test/Microsoft.ML.Core.Tests/UnitTests/TestCSharpApi.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public void TestCrossValidationBinaryMacro()
255255
}
256256
}
257257

258-
[Fact]
258+
[ConditionalFact(typeof(BaseTestBaseline), nameof(BaseTestBaseline.LessThanNetCore30OrNotNetCore))] // netcore3.0 output differs from Baseline
259259
public void TestCrossValidationMacro()
260260
{
261261
var dataPath = GetDataPath(TestDatasets.generatedRegressionDatasetmacro.trainFilename);

0 commit comments

Comments
 (0)