Skip to content

Commit fe1388c

Browse files
jwood803eerhardt
authored andcommitted
Update private and constant variable names (#943)
* Update private field name * Change variable names according to style guides * Update another constant variable name to match standards
1 parent b88d346 commit fe1388c

File tree

5 files changed

+117
-121
lines changed

5 files changed

+117
-121
lines changed

test/Microsoft.ML.CpuMath.PerformanceTests/AvxPerformanceTests.cs

+23-23
Original file line numberDiff line numberDiff line change
@@ -13,91 +13,91 @@ public class AvxPerformanceTests : PerformanceTests
1313
{
1414
[Benchmark]
1515
public void AddScalarU()
16-
=> AvxIntrinsics.AddScalarU(DEFAULT_SCALE, new Span<float>(dst, 0, LEN));
16+
=> AvxIntrinsics.AddScalarU(DefaultScale, new Span<float>(dst, 0, Length));
1717

1818
[Benchmark]
1919
public void ScaleU()
20-
=> AvxIntrinsics.ScaleU(DEFAULT_SCALE, new Span<float>(dst, 0, LEN));
20+
=> AvxIntrinsics.ScaleU(DefaultScale, new Span<float>(dst, 0, Length));
2121

2222
[Benchmark]
2323
public void ScaleSrcU()
24-
=> AvxIntrinsics.ScaleSrcU(DEFAULT_SCALE, new Span<float>(src, 0, LEN), new Span<float>(dst, 0, LEN));
24+
=> AvxIntrinsics.ScaleSrcU(DefaultScale, new Span<float>(src, 0, Length), new Span<float>(dst, 0, Length));
2525

2626
[Benchmark]
2727
public void ScaleAddU()
28-
=> AvxIntrinsics.ScaleAddU(DEFAULT_SCALE, DEFAULT_SCALE, new Span<float>(dst, 0, LEN));
28+
=> AvxIntrinsics.ScaleAddU(DefaultScale, DefaultScale, new Span<float>(dst, 0, Length));
2929

3030
[Benchmark]
3131
public void AddScaleU()
32-
=> AvxIntrinsics.AddScaleU(DEFAULT_SCALE, new Span<float>(src, 0, LEN), new Span<float>(dst, 0, LEN));
32+
=> AvxIntrinsics.AddScaleU(DefaultScale, new Span<float>(src, 0, Length), new Span<float>(dst, 0, Length));
3333

3434
[Benchmark]
3535
public void AddScaleSU()
36-
=> AvxIntrinsics.AddScaleSU(DEFAULT_SCALE, new Span<float>(src), new Span<int>(idx, 0, IDXLEN), new Span<float>(dst));
36+
=> AvxIntrinsics.AddScaleSU(DefaultScale, new Span<float>(src), new Span<int>(idx, 0, IndexLength), new Span<float>(dst));
3737

3838
[Benchmark]
3939
public void AddScaleCopyU()
40-
=> AvxIntrinsics.AddScaleCopyU(DEFAULT_SCALE, new Span<float>(src, 0, LEN), new Span<float>(dst, 0, LEN), new Span<float>(result, 0, LEN));
40+
=> AvxIntrinsics.AddScaleCopyU(DefaultScale, new Span<float>(src, 0, Length), new Span<float>(dst, 0, Length), new Span<float>(result, 0, Length));
4141

4242
[Benchmark]
4343
public void AddU()
44-
=> AvxIntrinsics.AddU(new Span<float>(src, 0, LEN), new Span<float>(dst, 0, LEN));
44+
=> AvxIntrinsics.AddU(new Span<float>(src, 0, Length), new Span<float>(dst, 0, Length));
4545

4646
[Benchmark]
4747
public void AddSU()
48-
=> AvxIntrinsics.AddSU(new Span<float>(src), new Span<int>(idx, 0, IDXLEN), new Span<float>(dst));
48+
=> AvxIntrinsics.AddSU(new Span<float>(src), new Span<int>(idx, 0, IndexLength), new Span<float>(dst));
4949

5050
[Benchmark]
5151
public void MulElementWiseU()
52-
=> AvxIntrinsics.MulElementWiseU(new Span<float>(src1, 0, LEN), new Span<float>(src2, 0, LEN),
53-
new Span<float>(dst, 0, LEN));
52+
=> AvxIntrinsics.MulElementWiseU(new Span<float>(src1, 0, Length), new Span<float>(src2, 0, Length),
53+
new Span<float>(dst, 0, Length));
5454

5555
[Benchmark]
5656
public float SumU()
57-
=> AvxIntrinsics.SumU(new Span<float>(src, 0, LEN));
57+
=> AvxIntrinsics.SumU(new Span<float>(src, 0, Length));
5858

5959
[Benchmark]
6060
public float SumSqU()
61-
=> AvxIntrinsics.SumSqU(new Span<float>(src, 0, LEN));
61+
=> AvxIntrinsics.SumSqU(new Span<float>(src, 0, Length));
6262

6363
[Benchmark]
6464
public float SumSqDiffU()
65-
=> AvxIntrinsics.SumSqDiffU(DEFAULT_SCALE, new Span<float>(src, 0, LEN));
65+
=> AvxIntrinsics.SumSqDiffU(DefaultScale, new Span<float>(src, 0, Length));
6666

6767
[Benchmark]
6868
public float SumAbsU()
69-
=> AvxIntrinsics.SumAbsU(new Span<float>(src, 0, LEN));
69+
=> AvxIntrinsics.SumAbsU(new Span<float>(src, 0, Length));
7070

7171
[Benchmark]
7272
public float SumAbsDiffU()
73-
=> AvxIntrinsics.SumAbsDiffU(DEFAULT_SCALE, new Span<float>(src, 0, LEN));
73+
=> AvxIntrinsics.SumAbsDiffU(DefaultScale, new Span<float>(src, 0, Length));
7474

7575
[Benchmark]
7676
public float MaxAbsU()
77-
=> AvxIntrinsics.MaxAbsU(new Span<float>(src, 0, LEN));
77+
=> AvxIntrinsics.MaxAbsU(new Span<float>(src, 0, Length));
7878

7979
[Benchmark]
8080
public float MaxAbsDiffU()
81-
=> AvxIntrinsics.MaxAbsDiffU(DEFAULT_SCALE, new Span<float>(src, 0, LEN));
81+
=> AvxIntrinsics.MaxAbsDiffU(DefaultScale, new Span<float>(src, 0, Length));
8282

8383
[Benchmark]
8484
public float DotU()
85-
=> AvxIntrinsics.DotU(new Span<float>(src, 0, LEN), new Span<float>(dst, 0, LEN));
85+
=> AvxIntrinsics.DotU(new Span<float>(src, 0, Length), new Span<float>(dst, 0, Length));
8686

8787
[Benchmark]
8888
public float DotSU()
89-
=> AvxIntrinsics.DotSU(new Span<float>(src), new Span<float>(dst), new Span<int>(idx, 0, IDXLEN));
89+
=> AvxIntrinsics.DotSU(new Span<float>(src), new Span<float>(dst), new Span<int>(idx, 0, IndexLength));
9090

9191
[Benchmark]
9292
public float Dist2()
93-
=> AvxIntrinsics.Dist2(new Span<float>(src, 0, LEN), new Span<float>(dst, 0, LEN));
93+
=> AvxIntrinsics.Dist2(new Span<float>(src, 0, Length), new Span<float>(dst, 0, Length));
9494

9595
[Benchmark]
9696
public void SdcaL1UpdateU()
97-
=> AvxIntrinsics.SdcaL1UpdateU(DEFAULT_SCALE, new Span<float>(src, 0, LEN), DEFAULT_SCALE, new Span<float>(dst, 0, LEN), new Span<float>(result, 0, LEN));
97+
=> AvxIntrinsics.SdcaL1UpdateU(DefaultScale, new Span<float>(src, 0, Length), DefaultScale, new Span<float>(dst, 0, Length), new Span<float>(result, 0, Length));
9898

9999
[Benchmark]
100100
public void SdcaL1UpdateSU()
101-
=> AvxIntrinsics.SdcaL1UpdateSU(DEFAULT_SCALE, new Span<float>(src, 0, IDXLEN), new Span<int>(idx, 0, IDXLEN), DEFAULT_SCALE, new Span<float>(dst), new Span<float>(result));
101+
=> AvxIntrinsics.SdcaL1UpdateSU(DefaultScale, new Span<float>(src, 0, IndexLength), new Span<int>(idx, 0, IndexLength), DefaultScale, new Span<float>(dst), new Span<float>(result));
102102
}
103103
}

test/Microsoft.ML.CpuMath.PerformanceTests/NativePerformanceTests.cs

+22-22
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public unsafe void AddScalarU()
1616
{
1717
fixed (float* pdst = dst)
1818
{
19-
CpuMathNativeUtils.AddScalarU(DEFAULT_SCALE, pdst, LEN);
19+
CpuMathNativeUtils.AddScalarU(DefaultScale, pdst, Length);
2020
}
2121
}
2222

@@ -25,7 +25,7 @@ public unsafe void ScaleU()
2525
{
2626
fixed (float* pdst = dst)
2727
{
28-
CpuMathNativeUtils.ScaleU(DEFAULT_SCALE, pdst, LEN);
28+
CpuMathNativeUtils.ScaleU(DefaultScale, pdst, Length);
2929
}
3030
}
3131

@@ -35,7 +35,7 @@ public unsafe void ScaleSrcU()
3535
fixed (float* psrc = src)
3636
fixed (float* pdst = dst)
3737
{
38-
CpuMathNativeUtils.ScaleSrcU(DEFAULT_SCALE, psrc, pdst, LEN);
38+
CpuMathNativeUtils.ScaleSrcU(DefaultScale, psrc, pdst, Length);
3939
}
4040
}
4141

@@ -44,7 +44,7 @@ public unsafe void ScaleAddU()
4444
{
4545
fixed (float* pdst = dst)
4646
{
47-
CpuMathNativeUtils.ScaleAddU(DEFAULT_SCALE, DEFAULT_SCALE, pdst, LEN);
47+
CpuMathNativeUtils.ScaleAddU(DefaultScale, DefaultScale, pdst, Length);
4848
}
4949
}
5050

@@ -54,7 +54,7 @@ public unsafe void AddScaleU()
5454
fixed (float* psrc = src)
5555
fixed (float* pdst = dst)
5656
{
57-
CpuMathNativeUtils.AddScaleU(DEFAULT_SCALE, psrc, pdst, LEN);
57+
CpuMathNativeUtils.AddScaleU(DefaultScale, psrc, pdst, Length);
5858
}
5959
}
6060

@@ -65,7 +65,7 @@ public unsafe void AddScaleSU()
6565
fixed (float* pdst = dst)
6666
fixed (int* pidx = idx)
6767
{
68-
CpuMathNativeUtils.AddScaleSU(DEFAULT_SCALE, psrc, pidx, pdst, IDXLEN);
68+
CpuMathNativeUtils.AddScaleSU(DefaultScale, psrc, pidx, pdst, IndexLength);
6969
}
7070
}
7171

@@ -76,7 +76,7 @@ public unsafe void AddScaleCopyU()
7676
fixed (float* pdst = dst)
7777
fixed (float* pres = result)
7878
{
79-
CpuMathNativeUtils.AddScaleCopyU(DEFAULT_SCALE, psrc, pdst, pres, LEN);
79+
CpuMathNativeUtils.AddScaleCopyU(DefaultScale, psrc, pdst, pres, Length);
8080
}
8181
}
8282

@@ -86,7 +86,7 @@ public unsafe void AddU()
8686
fixed (float* psrc = src)
8787
fixed (float* pdst = dst)
8888
{
89-
CpuMathNativeUtils.AddU(psrc, pdst, LEN);
89+
CpuMathNativeUtils.AddU(psrc, pdst, Length);
9090
}
9191
}
9292

@@ -97,7 +97,7 @@ public unsafe void AddSU()
9797
fixed (float* pdst = dst)
9898
fixed (int* pidx = idx)
9999
{
100-
CpuMathNativeUtils.AddSU(psrc, pidx, pdst, IDXLEN);
100+
CpuMathNativeUtils.AddSU(psrc, pidx, pdst, IndexLength);
101101
}
102102
}
103103

@@ -108,7 +108,7 @@ public unsafe void MulElementWiseU()
108108
fixed (float* psrc2 = src2)
109109
fixed (float* pdst = dst)
110110
{
111-
CpuMathNativeUtils.MulElementWiseU(psrc1, psrc2, pdst, LEN);
111+
CpuMathNativeUtils.MulElementWiseU(psrc1, psrc2, pdst, Length);
112112
}
113113
}
114114

@@ -117,7 +117,7 @@ public unsafe float SumU()
117117
{
118118
fixed (float* psrc = src)
119119
{
120-
return CpuMathNativeUtils.SumU(psrc, LEN);
120+
return CpuMathNativeUtils.SumU(psrc, Length);
121121
}
122122
}
123123

@@ -126,7 +126,7 @@ public unsafe float SumSqU()
126126
{
127127
fixed (float* psrc = src)
128128
{
129-
return CpuMathNativeUtils.SumSqU(psrc, LEN);
129+
return CpuMathNativeUtils.SumSqU(psrc, Length);
130130
}
131131
}
132132

@@ -135,7 +135,7 @@ public unsafe float SumSqDiffU()
135135
{
136136
fixed (float* psrc = src)
137137
{
138-
return CpuMathNativeUtils.SumSqDiffU(DEFAULT_SCALE, psrc, LEN);
138+
return CpuMathNativeUtils.SumSqDiffU(DefaultScale, psrc, Length);
139139
}
140140
}
141141

@@ -144,7 +144,7 @@ public unsafe float SumAbsU()
144144
{
145145
fixed (float* psrc = src)
146146
{
147-
return CpuMathNativeUtils.SumAbsU(psrc, LEN);
147+
return CpuMathNativeUtils.SumAbsU(psrc, Length);
148148
}
149149
}
150150

@@ -153,7 +153,7 @@ public unsafe float SumAbsDiffU()
153153
{
154154
fixed (float* psrc = src)
155155
{
156-
return CpuMathNativeUtils.SumAbsDiffU(DEFAULT_SCALE, psrc, LEN);
156+
return CpuMathNativeUtils.SumAbsDiffU(DefaultScale, psrc, Length);
157157
}
158158
}
159159

@@ -162,7 +162,7 @@ public unsafe float MaxAbsU()
162162
{
163163
fixed (float* psrc = src)
164164
{
165-
return CpuMathNativeUtils.MaxAbsU(psrc, LEN);
165+
return CpuMathNativeUtils.MaxAbsU(psrc, Length);
166166
}
167167
}
168168

@@ -171,7 +171,7 @@ public unsafe float MaxAbsDiffU()
171171
{
172172
fixed (float* psrc = src)
173173
{
174-
return CpuMathNativeUtils.MaxAbsDiffU(DEFAULT_SCALE, psrc, LEN);
174+
return CpuMathNativeUtils.MaxAbsDiffU(DefaultScale, psrc, Length);
175175
}
176176
}
177177

@@ -181,7 +181,7 @@ public unsafe float DotU()
181181
fixed (float* psrc = src)
182182
fixed (float* pdst = dst)
183183
{
184-
return CpuMathNativeUtils.DotU(psrc, pdst, LEN);
184+
return CpuMathNativeUtils.DotU(psrc, pdst, Length);
185185
}
186186
}
187187

@@ -192,7 +192,7 @@ public unsafe float DotSU()
192192
fixed (float* pdst = dst)
193193
fixed (int* pidx = idx)
194194
{
195-
return CpuMathNativeUtils.DotSU(psrc, pdst, pidx, IDXLEN);
195+
return CpuMathNativeUtils.DotSU(psrc, pdst, pidx, IndexLength);
196196
}
197197
}
198198

@@ -202,7 +202,7 @@ public unsafe float Dist2()
202202
fixed (float* psrc = src)
203203
fixed (float* pdst = dst)
204204
{
205-
return CpuMathNativeUtils.Dist2(psrc, pdst, LEN);
205+
return CpuMathNativeUtils.Dist2(psrc, pdst, Length);
206206
}
207207
}
208208

@@ -213,7 +213,7 @@ public unsafe void SdcaL1UpdateU()
213213
fixed (float* pdst = dst)
214214
fixed (float* pres = result)
215215
{
216-
CpuMathNativeUtils.SdcaL1UpdateU(DEFAULT_SCALE, psrc, DEFAULT_SCALE, pdst, pres, LEN);
216+
CpuMathNativeUtils.SdcaL1UpdateU(DefaultScale, psrc, DefaultScale, pdst, pres, Length);
217217
}
218218
}
219219

@@ -225,7 +225,7 @@ public unsafe void SdcaL1UpdateSU()
225225
fixed (float* pres = result)
226226
fixed (int* pidx = idx)
227227
{
228-
CpuMathNativeUtils.SdcaL1UpdateSU(DEFAULT_SCALE, psrc, pidx, DEFAULT_SCALE, pdst, pres, IDXLEN);
228+
CpuMathNativeUtils.SdcaL1UpdateSU(DefaultScale, psrc, pidx, DefaultScale, pdst, pres, IndexLength);
229229
}
230230
}
231231
}

0 commit comments

Comments
 (0)