Skip to content

Commit c516f90

Browse files
have whileRWMaskTests use templates instead
1 parent 1bb92c6 commit c516f90

8 files changed

Lines changed: 1994 additions & 68 deletions

File tree

.github/skills/ci-pipeline-monitor/logs/test-report-2026-04-23-193554.md

Lines changed: 1830 additions & 0 deletions
Large diffs are not rendered by default.
1.18 MB
Binary file not shown.

src/tests/Common/GenerateHWIntrinsicTests/Arm/Sve2Tests.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,18 @@ static class Sve2Tests
317317
(Templates.ScalarBinOpRetVecTest,new Dictionary<string, string> {["TestName"] = "Sve2_CreateWhileGreaterThanOrEqualMaskUInt64_UInt32", ["Method"] = "CreateWhileGreaterThanOrEqualMaskUInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt32", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt32()", ["ValidateIterResult"] = "(UInt64)Helpers.WhileGreaterThanOrEqualMask(left + (UInt32)i, right) != result[i]",}),
318318
(Templates.ScalarBinOpRetVecTest,new Dictionary<string, string> {["TestName"] = "Sve2_CreateWhileGreaterThanOrEqualMaskUInt64_UInt64", ["Method"] = "CreateWhileGreaterThanOrEqualMaskUInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64", ["Op2BaseType"] = "UInt64", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt64()", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt64()", ["ValidateIterResult"] = "(UInt64)Helpers.WhileGreaterThanOrEqualMask(left + (UInt64)i, right) != result[i]",}),
319319

320-
(Templates.SveVecImmTernOpFirstArgTest, new Dictionary<string, string> { ["TestName"] = "Sve2_DotProductRotateComplex_int_sbyte_0", ["Method"] = "DotProductRotateComplex", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "SByte", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "SByte", ["Op4BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp3"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "0", ["InvalidImm"] = "4", ["ConvertFunc"] = "", ["ValidateIterResult"] = "Helpers.DotProductRotateComplex(first[i], second, 4 * i, third, Imm) != result[i]", ["GetIterResult"] = "Helpers.DotProductRotateComplex(first[i], second, 4 * i, third, Imm)"}),
320+
(Templates.SveCreateWhileRWMaskTest, new Dictionary<string, string> { ["TestName"] = "Sve2_CreateWhileReadAfterWriteMaskByte", ["Method"] = "CreateWhileReadAfterWriteMaskByte", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Byte", ["Op1BaseType"] = "Byte" }),
321+
(Templates.SveCreateWhileRWMaskTest, new Dictionary<string, string> { ["TestName"] = "Sve2_CreateWhileReadAfterWriteMaskSByte", ["Method"] = "CreateWhileReadAfterWriteMaskSByte", ["RetVectorType"] = "Vector", ["RetBaseType"] = "SByte", ["Op1BaseType"] = "SByte" }),
322+
(Templates.SveCreateWhileRWMaskTest, new Dictionary<string, string> { ["TestName"] = "Sve2_CreateWhileReadAfterWriteMaskInt16", ["Method"] = "CreateWhileReadAfterWriteMaskInt16", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int16", ["Op1BaseType"] = "Int16" }),
323+
(Templates.SveCreateWhileRWMaskTest, new Dictionary<string, string> { ["TestName"] = "Sve2_CreateWhileReadAfterWriteMaskInt32", ["Method"] = "CreateWhileReadAfterWriteMaskInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1BaseType"] = "Int32" }),
324+
(Templates.SveCreateWhileRWMaskTest, new Dictionary<string, string> { ["TestName"] = "Sve2_CreateWhileReadAfterWriteMaskInt64", ["Method"] = "CreateWhileReadAfterWriteMaskInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1BaseType"] = "Int64" }),
325+
(Templates.SveCreateWhileRWMaskTest, new Dictionary<string, string> { ["TestName"] = "Sve2_CreateWhileReadAfterWriteMaskUInt16", ["Method"] = "CreateWhileReadAfterWriteMaskUInt16", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt16", ["Op1BaseType"] = "UInt16" }),
326+
(Templates.SveCreateWhileRWMaskTest, new Dictionary<string, string> { ["TestName"] = "Sve2_CreateWhileReadAfterWriteMaskUInt32", ["Method"] = "CreateWhileReadAfterWriteMaskUInt32", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1BaseType"] = "UInt32" }),
327+
(Templates.SveCreateWhileRWMaskTest, new Dictionary<string, string> { ["TestName"] = "Sve2_CreateWhileReadAfterWriteMaskUInt64", ["Method"] = "CreateWhileReadAfterWriteMaskUInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1BaseType"] = "UInt64" }),
328+
(Templates.SveCreateWhileRWMaskTest, new Dictionary<string, string> { ["TestName"] = "Sve2_CreateWhileReadAfterWriteMaskSingle", ["Method"] = "CreateWhileReadAfterWriteMaskSingle", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1BaseType"] = "Single" }),
329+
(Templates.SveCreateWhileRWMaskTest, new Dictionary<string, string> { ["TestName"] = "Sve2_CreateWhileReadAfterWriteMaskDouble", ["Method"] = "CreateWhileReadAfterWriteMaskDouble", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Double", ["Op1BaseType"] = "Double" }),
330+
331+
(Templates.SveVecImmTernOpFirstArgTest,new Dictionary<string, string> { ["TestName"] = "Sve2_DotProductRotateComplex_int_sbyte_0", ["Method"] = "DotProductRotateComplex", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "SByte", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "SByte", ["Op4BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp3"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "0", ["InvalidImm"] = "4", ["ConvertFunc"] = "", ["ValidateIterResult"] = "Helpers.DotProductRotateComplex(first[i], second, 4 * i, third, Imm) != result[i]", ["GetIterResult"] = "Helpers.DotProductRotateComplex(first[i], second, 4 * i, third, Imm)"}),
321332
(Templates.SveVecImmTernOpFirstArgTest, new Dictionary<string, string> { ["TestName"] = "Sve2_DotProductRotateComplex_int_sbyte_1", ["Method"] = "DotProductRotateComplex", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "SByte", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "SByte", ["Op4BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp3"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "1", ["InvalidImm"] = "4", ["ConvertFunc"] = "", ["ValidateIterResult"] = "Helpers.DotProductRotateComplex(first[i], second, 4 * i, third, Imm) != result[i]", ["GetIterResult"] = "Helpers.DotProductRotateComplex(first[i], second, 4 * i, third, Imm)"}),
322333
(Templates.SveVecImmTernOpFirstArgTest, new Dictionary<string, string> { ["TestName"] = "Sve2_DotProductRotateComplex_int_sbyte_2", ["Method"] = "DotProductRotateComplex", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "SByte", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "SByte", ["Op4BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp3"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "2", ["InvalidImm"] = "4", ["ConvertFunc"] = "", ["ValidateIterResult"] = "Helpers.DotProductRotateComplex(first[i], second, 4 * i, third, Imm) != result[i]", ["GetIterResult"] = "Helpers.DotProductRotateComplex(first[i], second, 4 * i, third, Imm)"}),
323334
(Templates.SveVecImmTernOpFirstArgTest, new Dictionary<string, string> { ["TestName"] = "Sve2_DotProductRotateComplex_int_sbyte_3", ["Method"] = "DotProductRotateComplex", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int32", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "SByte", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "SByte", ["Op4BaseType"] = "Byte", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetInt32()", ["NextValueOp2"] = "TestLibrary.Generator.GetSByte()", ["NextValueOp3"] = "TestLibrary.Generator.GetSByte()", ["Imm"] = "3", ["InvalidImm"] = "4", ["ConvertFunc"] = "", ["ValidateIterResult"] = "Helpers.DotProductRotateComplex(first[i], second, 4 * i, third, Imm) != result[i]", ["GetIterResult"] = "Helpers.DotProductRotateComplex(first[i], second, 4 * i, third, Imm)"}),

src/tests/Common/GenerateHWIntrinsicTests/Arm/Templates.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,4 +412,5 @@ static class Templates
412412
public static TemplateConfig VectorLookup_2Test = new TemplateConfig("VectorLookup_2Test.template");
413413
public static TemplateConfig VectorLookup_3Test = new TemplateConfig("VectorLookup_3Test.template");
414414
public static TemplateConfig VectorLookup_4Test = new TemplateConfig("VectorLookup_4Test.template");
415+
public static TemplateConfig SveCreateWhileRWMaskTest = new TemplateConfig("SveCreateWhileRWMaskTest.template");
415416
}
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
/******************************************************************************
5+
* This file is auto-generated from a template file by the GenerateTests.csx *
6+
* script in tests\src\JIT\HardwareIntrinsics\Arm\Shared. In order to make *
7+
* changes, please update the corresponding template and run according to the *
8+
* directions listed in the file. *
9+
******************************************************************************/
10+
11+
using System;
12+
using System.Numerics;
13+
using System.Reflection;
14+
using System.Runtime.CompilerServices;
15+
using System.Runtime.InteropServices;
16+
using System.Runtime.Intrinsics;
17+
using System.Runtime.Intrinsics.Arm;
18+
using Xunit;
19+
20+
namespace {Namespace}
21+
{
22+
public static partial class Program
23+
{
24+
[Fact]
25+
public static void {TestName}()
26+
{
27+
var test = new CreateWhileRWMaskTest__{TestName}();
28+
29+
if (test.IsSupported)
30+
{
31+
// Validates that same-address produces an all-true mask
32+
test.RunSameAddressScenario();
33+
34+
// Validates calling via reflection works
35+
test.RunReflectionScenario();
36+
37+
// Validates that an offset of one element produces a single-true mask
38+
test.RunOffsetByOneScenario();
39+
}
40+
else
41+
{
42+
// Validates we throw on unsupported hardware
43+
test.RunUnsupportedScenario();
44+
}
45+
46+
if (!test.Succeeded)
47+
{
48+
throw new Exception("One or more scenarios did not complete as expected.");
49+
}
50+
}
51+
}
52+
53+
public sealed unsafe class CreateWhileRWMaskTest__{TestName}
54+
{
55+
public bool IsSupported => {Isa}.IsSupported;
56+
57+
public bool Succeeded { get; set; } = true;
58+
59+
public void RunSameAddressScenario()
60+
{
61+
TestLibrary.TestFramework.BeginScenario(nameof(RunSameAddressScenario));
62+
63+
{Op1BaseType}* ptr = stackalloc {Op1BaseType}[{RetVectorType}<{RetBaseType}>.Count];
64+
{RetVectorType}<{RetBaseType}> mask = {Isa}.{Method}(ptr, ptr);
65+
66+
for (int i = 0; i < {RetVectorType}<{RetBaseType}>.Count; i++)
67+
{
68+
if (mask.GetElement(i) == 0)
69+
{
70+
TestLibrary.TestFramework.LogInformation(
71+
$"{nameof({Isa})}.{nameof({Isa}.{Method})}(ptr, ptr): Expected all elements true, but element {i} was false.");
72+
Succeeded = false;
73+
return;
74+
}
75+
}
76+
}
77+
78+
public void RunReflectionScenario()
79+
{
80+
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
81+
82+
{Op1BaseType}* ptr = stackalloc {Op1BaseType}[{RetVectorType}<{RetBaseType}>.Count];
83+
var result = typeof({Isa}).GetMethod(nameof({Isa}.{Method}), new Type[] { typeof({Op1BaseType}*), typeof({Op1BaseType}*) })
84+
.Invoke(null, new object[] {
85+
Pointer.Box(ptr, typeof({Op1BaseType}*)),
86+
Pointer.Box(ptr, typeof({Op1BaseType}*))
87+
});
88+
89+
{RetVectorType}<{RetBaseType}> mask = ({RetVectorType}<{RetBaseType}>)result;
90+
91+
for (int i = 0; i < {RetVectorType}<{RetBaseType}>.Count; i++)
92+
{
93+
if (mask.GetElement(i) == 0)
94+
{
95+
TestLibrary.TestFramework.LogInformation(
96+
$"{nameof({Isa})}.{nameof({Isa}.{Method})}(ptr, ptr) via reflection: Expected all elements true, but element {i} was false.");
97+
Succeeded = false;
98+
return;
99+
}
100+
}
101+
}
102+
103+
public void RunOffsetByOneScenario()
104+
{
105+
TestLibrary.TestFramework.BeginScenario(nameof(RunOffsetByOneScenario));
106+
107+
{Op1BaseType}* ptr = stackalloc {Op1BaseType}[{RetVectorType}<{RetBaseType}>.Count + 1];
108+
{RetVectorType}<{RetBaseType}> mask = {Isa}.{Method}(ptr, ptr + 1);
109+
110+
if (mask.GetElement(0) == 0)
111+
{
112+
TestLibrary.TestFramework.LogInformation(
113+
$"{nameof({Isa})}.{nameof({Isa}.{Method})}(ptr, ptr+1): Expected element 0 to be true, but was false.");
114+
Succeeded = false;
115+
return;
116+
}
117+
118+
for (int i = 1; i < {RetVectorType}<{RetBaseType}>.Count; i++)
119+
{
120+
if (mask.GetElement(i) != 0)
121+
{
122+
TestLibrary.TestFramework.LogInformation(
123+
$"{nameof({Isa})}.{nameof({Isa}.{Method})}(ptr, ptr+1): Expected element {i} to be false, but was true.");
124+
Succeeded = false;
125+
return;
126+
}
127+
}
128+
}
129+
130+
public void RunUnsupportedScenario()
131+
{
132+
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
133+
134+
bool succeeded = false;
135+
136+
try
137+
{
138+
RunSameAddressScenario();
139+
}
140+
catch (PlatformNotSupportedException)
141+
{
142+
succeeded = true;
143+
}
144+
145+
if (!succeeded)
146+
{
147+
Succeeded = false;
148+
}
149+
}
150+
}
151+
}

src/tests/JIT/HardwareIntrinsics/Arm/Sve2/CreateWhileRWMask.cs

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/tests/JIT/HardwareIntrinsics/Arm/Sve2/Sve2_r.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
</PropertyGroup>
99
<ItemGroup>
1010
<Compile Include="Program.Sve2.cs" />
11-
<Compile Include="CreateWhileRWMask.cs" />
1211
<Compile Include="..\Shared\Helpers.cs" />
1312
<Compile Include="..\Shared\Program.cs" />
1413
<Compile Include="$(RepoRoot)src/libraries/Common/tests/TestUtilities/System/Buffers/BoundedMemory.cs" />

src/tests/JIT/HardwareIntrinsics/Arm/Sve2/Sve2_ro.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
</PropertyGroup>
99
<ItemGroup>
1010
<Compile Include="Program.Sve2.cs" />
11-
<Compile Include="CreateWhileRWMask.cs" />
1211
<Compile Include="..\Shared\Helpers.cs" />
1312
<Compile Include="..\Shared\Program.cs" />
1413
<Compile Include="$(RepoRoot)src/libraries/Common/tests/TestUtilities/System/Buffers/BoundedMemory.cs" />

0 commit comments

Comments
 (0)