-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Arm64/Sve: Fix overzealous assert for embedded mask intrinsics with RMW semantics #105541
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
Changes from all commits
547b8e5
20477eb
7ffd332
025f7e5
3c60b9d
2567404
101f666
8fe1e9c
07e0133
6830b8a
a296e40
574242c
239940c
a79a2fd
fb1d411
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<!-- Needed for CLRTestEnvironmentVariable --> | ||
<RequiresProcessIsolation>true</RequiresProcessIsolation> | ||
<DebugType>None</DebugType> | ||
<Optimize>True</Optimize> | ||
<NoWarn>$(NoWarn);SYSLIB5003</NoWarn> | ||
</PropertyGroup> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could, but there are lot of tests in this folder that do not have this. So would rather skip it and do it together for all the tests. |
||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
<CLRTestEnvironmentVariable Include="DOTNET_TieredCompilation" Value="0" /> | ||
<CLRTestEnvironmentVariable Include="DOTNET_JITMinOpts" Value="0" /> | ||
</ItemGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.Intrinsics; | ||
using System.Runtime.Intrinsics.Arm; | ||
using System.Runtime.Intrinsics.X86; | ||
using Xunit; | ||
|
||
#nullable disable | ||
|
||
public class Runtime_105479_A | ||
{ | ||
private void Method0() | ||
{ | ||
Vector128<ulong> vr0 = Vector128.CreateScalar(1698800584428641629UL); | ||
AdvSimd.ShiftLeftLogicalSaturate(vr0, 229); | ||
} | ||
|
||
private void Method1() | ||
{ | ||
Vector128<float> vr1 = default; | ||
Avx.Compare(vr1, vr1, (FloatComparisonMode)255); | ||
} | ||
|
||
[Fact] | ||
public static void TestEntryPointArm() | ||
{ | ||
if (AdvSimd.IsSupported) | ||
{ | ||
Assert.Throws<ArgumentOutOfRangeException>(() => new Runtime_105479_A().Method0()); | ||
} | ||
} | ||
|
||
[Fact] | ||
public static void TestEntryPoint() | ||
{ | ||
if (Avx.IsSupported) | ||
{ | ||
Assert.Throws<ArgumentOutOfRangeException>(() => new Runtime_105479_A().Method1()); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this testing what we want?
s_3
is a static field, so I'd expect this is relying extra on CSE and other opts to get the "right shape"Sve.FusedMultiplyAdd
should also be capable of emitting eitherFMAD
(Zdn = Za + Zdn * Zm
) orFMLA
(Zda = Zda + Zn * Zm
), which is to say between these two instructions any operand can be the RMW one, so it might be good to ensure we're covering the range here with some comments or even assertions (explicit validation using the disassembly checking functionality) of what codegen is expectedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hit an assert with this scenario so added it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tannergooding how would we go about explicitly validating the codegen for this? On my machine, the decision to use fmad or fmla for a test changes depending on if we're optimizing or not (though I'm not hitting asserts either way with this change).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By utilizing https://github.com/dotnet/runtime/blob/main/docs/workflow/testing/coreclr/disasm-checks.md
We should be able to add tests that validate each of the operands given
Sve.FusedMultiplyAdd(a, b, c)
end up as the target. We should then be able to further expand those base tests overConditionalSelect
to ensure the right behavior still occurs.It might be a release and TieredCompilation=0 only test, but it should be possible to get setup and validated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tannergooding thanks for pointing that out -- I've updated the tests to check for expected codegen.