Uh oh!
There was an error while loading. Please reload this page.
Do not value number locals on the LHS - #65902
Conversation
ghost
commented
Feb 25, 2022
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsThe last of the copy propagation changes - do not number locals on the LHS and update copy propagation to account for that. Two commits: first is the refactoring itself, second is the removal of the quirk for structs, that is also where some positive diffs for this change will come from. Contributes to #10873.
|
For reference, here are the code size/PerfScore diffs I get for Summary of CodeSizediffs:
(Lower is better)
Total bytes of base: 13403026 (overridden on cmd)
Total bytes of diff: 13400341 (overridden on cmd)
Total bytes of delta: -2685 (-0.02% of base)
diff is an improvement.
relative diff is an improvement.
Top file regressions (bytes):214:11803.dasm (2.15% of base)
164:13559.dasm (2.92% of base)
164:13553.dasm (2.92% of base)
73:41551.dasm (3.31% of base)
55:13624.dasm (0.77% of base)
39:7888.dasm (0.36% of base)
34:44300.dasm (2.27% of base)
33:18513.dasm (0.94% of base)
25:2040.dasm (1.14% of base)
10:7258.dasm (0.62% of base)
10:17181.dasm (1.52% of base)
10:41521.dasm (0.62% of base)
9:14120.dasm (0.24% of base)
8:14612.dasm (3.10% of base)
8:19834.dasm (0.43% of base)
8:3228.dasm (2.61% of base)
8:14621.dasm (3.19% of base)
8:2227.dasm (5.10% of base)
8:10062.dasm (1.70% of base)
8:6206.dasm (2.16% of base)
Top file improvements (bytes):-238:7426.dasm (-2.12% of base)
-230:22721.dasm (-6.87% of base)
-230:7245.dasm (-6.91% of base)
-128:1887.dasm (-1.71% of base)
-127:7232.dasm (-9.79% of base)
-108:11615.dasm (-7.54% of base)
-104:21891.dasm (-5.84% of base)
-72:17442.dasm (-2.57% of base)
-65:7437.dasm (-1.63% of base)
-64:1613.dasm (-0.58% of base)
-55:19804.dasm (-15.80% of base)
-55:39877.dasm (-3.62% of base)
-55:11970.dasm (-2.50% of base)
-52:23169.dasm (-3.81% of base)
-51:8045.dasm (-18.48% of base)
-49:3545.dasm (-1.03% of base)
-49:23951.dasm (-1.04% of base)
-48:2331.dasm (-0.78% of base)
-48:4224.dasm (-2.98% of base)
-44:20306.dasm (-3.92% of base)
305 total files withCodeSize differences (219 improved, 86 regressed), 81 unchanged.
Top method regressions (bytes):214 ( 2.15% of base) :11803.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
164 ( 2.92% of base) :13559.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
164 ( 2.92% of base) :13553.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
73 ( 3.31% of base) :41551.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
55 ( 0.77% of base) :13624.dasm -Jil.Deserialize.Methods:_ReadISO8601DateWithOffset(System.IO.TextReader,System.Char[]):System.DateTimeOffset39 ( 0.36% of base) :7888.dasm -Jil.Deserialize.Methods:_ReadISO8601DateWithOffsetThunkReader(byref,System.Char[]):System.DateTimeOffset34 ( 2.27% of base) :44300.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
33 ( 0.94% of base) :18513.dasm -Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser:ParseNamespaceBody(byref,byref,byref,ushort):this25 ( 1.14% of base) :2040.dasm -System.Globalization.TimeSpanFormat:TryFormatStandard(System.TimeSpan,int,System.String,System.Span`1[Char],byref):bool
10 ( 0.62% of base) :7258.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
10 ( 0.62% of base) :41521.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
10 ( 1.52% of base) :17181.dasm -System.Buffers.ReadOnlySequence`1[Byte][System.Byte]:Slice(long,System.SequencePosition):System.Buffers.ReadOnlySequence`1[Byte]:this9 ( 0.24% of base) :14120.dasm - <WriteToFileAsync>d__88:MoveNext():this8 ( 3.10% of base) :14612.dasm -<>c:<BeginReadInternal>b__38_0(System.Object):int:this8 ( 3.19% of base) :14621.dasm -<>c:<BeginWriteInternal>b__48_0(System.Object):int:this8 ( 0.43% of base) :19834.dasm -Microsoft.CodeAnalysis.CSharp.Binder:CheckValue(Microsoft.CodeAnalysis.CSharp.BoundExpression,ushort,Microsoft.CodeAnalysis.DiagnosticBag):Microsoft.CodeAnalysis.CSharp.BoundExpression:this8 ( 1.70% of base) :10062.dasm -Newtonsoft.Json.Utilities.ConvertUtils:Int32TryParse(System.Char[],int,int,byref):int
8 ( 2.61% of base) :3228.dasm -System.IO.MemoryStream:Read(System.Byte[],int,int):int:this8 ( 2.16% of base) :6206.dasm -System.Net.Http.QPack.QPackEncoder:EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int,System.String):System.Byte[]
8 ( 5.10% of base) :2227.dasm -System.Reflection.Emit.MethodBuilder:GetMethodSignature():System.Reflection.Emit.SignatureHelper:thisTop method improvements (bytes):-238 (-2.12% of base) :7426.dasm -MessagePack.Internal.ObjectSerializationInfo:CreateOrNull(System.Type,bool,bool,bool):MessagePack.Internal.ObjectSerializationInfo-230 (-6.91% of base) :7245.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
-230 (-6.87% of base) :22721.dasm -DynamicClass:Regex3_Go(System.Text.RegularExpressions.RegexRunner)
-128 (-1.71% of base) :1887.dasm -System.DateTimeFormat:FormatCustomized(System.DateTime,System.ReadOnlySpan`1[Char],System.Globalization.DateTimeFormatInfo,System.TimeSpan,System.Text.StringBuilder):System.Text.StringBuilder-127 (-9.79% of base) :7232.dasm -System.Text.Encoding:GetCharsWithFallback(System.ReadOnlySpan`1[Byte],int,System.Span`1[Char],int,System.Text.DecoderNLS):int:this-108 (-7.54% of base) :11615.dasm -System.Numerics.BigIntegerCalculator:Gcd(System.Span`1[UInt32],System.Span`1[UInt32])
-104 (-5.84% of base) :21891.dasm -System.Numerics.BigInteger:Multiply(System.ReadOnlySpan`1[UInt32],int,System.ReadOnlySpan`1[UInt32],int):System.Numerics.BigInteger-72 (-2.57% of base) :17442.dasm -System.Diagnostics.Tracing.EventPipeMetadataGenerator:GenerateMetadata(int,System.String,long,int,int,int,System.Diagnostics.Tracing.EventParameterInfo[]):System.Byte[]:this-65 (-1.63% of base) :7437.dasm -MessagePack.Internal.DynamicObjectTypeBuilder:BuildSerialize(System.Type,MessagePack.Internal.ObjectSerializationInfo,System.Reflection.Emit.ILGenerator,System.Action,System.Func`3[[System.Int32, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[MessagePack.Internal.ObjectSerializationInfo+EmittableMember, MessagePack, Version=1.9.0.0, Culture=neutral, PublicKeyToken=b4a0369545f0a1be],[System.Action, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]],int)
-64 (-0.58% of base) :1613.dasm -System.DefaultBinder:BindToMethod(int,System.Reflection.MethodBase[],byref,System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,System.String[],byref):System.Reflection.MethodBase:this-55 (-3.62% of base) :39877.dasm -Algorithms.VectorFloatRenderer:RenderSingleThreadedWithADT(float,float,float,float,float):this-55 (-15.80% of base) :19804.dasm -Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker:DefaultVisit(Microsoft.CodeAnalysis.SyntaxNode):this-55 (-2.50% of base) :11970.dasm -System.Xml.XmlDocument:.ctor(System.Xml.XmlImplementation):this-52 (-3.81% of base) :23169.dasm -System.Text.Encoding:GetBytesWithFallback(System.ReadOnlySpan`1[Char],int,System.Span`1[Byte],int,System.Text.EncoderNLS):int:this-51 (-18.48% of base) :8045.dasm -System.Linq.Expressions.Compiler.LambdaCompiler:GetParameterTypes(System.Linq.Expressions.LambdaExpression,System.Type):System.Type[]
-49 (-1.04% of base) :23951.dasm -System.Memory.Slice`1[Byte][System.Byte]:MemoryStartLengthSpan():System.Memory`1[Byte]:this-49 (-1.03% of base) :3545.dasm -System.Memory.Slice`1[Byte][System.Byte]:ReadOnlyMemoryStartLengthSpan():System.ReadOnlyMemory`1[Byte]:this-48 (-0.78% of base) :2331.dasm -Utf8Json.Resolvers.Internal.DynamicObjectTypeBuilder:BuildSerialize(System.Type,Utf8Json.Internal.Emit.MetaType,System.Reflection.Emit.ILGenerator,System.Action,System.Func`3[[System.Int32, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Utf8Json.Internal.Emit.MetaMember, Utf8Json, Version=1.3.7.0, Culture=neutral, PublicKeyToken=8a73d3ba7e392e27],[System.Boolean, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]],bool,bool,int)
-48 (-2.98% of base) :4224.dasm -WorkerThread:WorkerThreadStart()
-44 (-3.92% of base) :20306.dasm -Microsoft.CodeAnalysis.SyntaxNavigator:GetFirstToken(Microsoft.CodeAnalysis.SyntaxNode,System.Func`2[SyntaxToken,Boolean],System.Func`2[SyntaxTrivia,Boolean]):Microsoft.CodeAnalysis.SyntaxToken:thisTop method regressions (percentages):8 ( 5.10% of base) :2227.dasm -System.Reflection.Emit.MethodBuilder:GetMethodSignature():System.Reflection.Emit.SignatureHelper:this7 ( 3.66% of base) :44169.dasm -Enumerator[Int32,Int32][System.Int32,System.Int32]:PushLeft(Node[Int32,Int32]):this3 ( 3.45% of base) :21570.dasm -System.Text.Tests.Perf_StringBuilder:ctor_string(int):System.Text.StringBuilder:this73 ( 3.31% of base) :41551.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
8 ( 3.19% of base) :14621.dasm -<>c:<BeginWriteInternal>b__48_0(System.Object):int:this8 ( 3.10% of base) :14612.dasm -<>c:<BeginReadInternal>b__38_0(System.Object):int:this164 ( 2.92% of base) :13559.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
164 ( 2.92% of base) :13553.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
8 ( 2.61% of base) :3228.dasm -System.IO.MemoryStream:Read(System.Byte[],int,int):int:this34 ( 2.27% of base) :44300.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
8 ( 2.16% of base) :6206.dasm -System.Net.Http.QPack.QPackEncoder:EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int,System.String):System.Byte[]
214 ( 2.15% of base) :11803.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
3 ( 2.05% of base) :11718.dasm -Enumerator[__Canon,__Canon][System.__Canon,System.__Canon]:PushLeft(Node[__Canon,__Canon]):this3 ( 2.05% of base) :5437.dasm -Enumerator[HashBucket][System.Collections.Immutable.ImmutableHashSet`1+HashBucket[System.__Canon]]:PushLeft(System.Collections.Immutable.SortedInt32KeyNode`1[HashBucket]):this3 ( 1.89% of base) :13980.dasm -Enumerator[__Canon][System.__Canon]:PushNext(Node[__Canon]):this2 ( 1.83% of base) :21866.dasm -V8.Crypto.BigInteger:copyTo(V8.Crypto.BigInteger):this3 ( 1.81% of base) :9360.dasm -Enumerator[__Canon][System.__Canon]:PushNext(Node[__Canon]):this7 ( 1.79% of base) :2478.dasm -Utf8Json.JsonReader:ReadInt64():long:this8 ( 1.70% of base) :10062.dasm -Newtonsoft.Json.Utilities.ConvertUtils:Int32TryParse(System.Char[],int,int,byref):int
3 ( 1.69% of base) :41898.dasm -Enumerator[HashBucket][System.Collections.Immutable.ImmutableDictionary`2+HashBucket[System.Int32,System.Int32]]:PushLeft(System.Collections.Immutable.SortedInt32KeyNode`1[HashBucket]):thisTop method improvements (percentages):-51 (-18.48% of base) :8045.dasm -System.Linq.Expressions.Compiler.LambdaCompiler:GetParameterTypes(System.Linq.Expressions.LambdaExpression,System.Type):System.Type[]
-55 (-15.80% of base) :19804.dasm -Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker:DefaultVisit(Microsoft.CodeAnalysis.SyntaxNode):this-29 (-10.32% of base) :4688.dasm -System.Text.Encodings.Web.AllowedBmpCodePointsBitmap:ForbidUndefinedCharacters():this-127 (-9.79% of base) :7232.dasm -System.Text.Encoding:GetCharsWithFallback(System.ReadOnlySpan`1[Byte],int,System.Span`1[Char],int,System.Text.DecoderNLS):int:this-18 (-8.26% of base) :9989.dasm -FractalPerf.Mandelbrot:Render():double:this-108 (-7.54% of base) :11615.dasm -System.Numerics.BigIntegerCalculator:Gcd(System.Span`1[UInt32],System.Span`1[UInt32])
-39 (-7.00% of base) :5675.dasm -System.IO.Compression.BrotliStream:WriteCore(System.ReadOnlySpan`1[Byte],bool):this-230 (-6.91% of base) :7245.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
-230 (-6.87% of base) :22721.dasm -DynamicClass:Regex3_Go(System.Text.RegularExpressions.RegexRunner)
-11 (-6.55% of base) :9879.dasm -System.Text.RegularExpressions.Symbolic.SymbolicRegexNode`1[UInt64][System.UInt64]:FirstCounterInfo():System.ValueTuple`2[[System.Text.RegularExpressions.Symbolic.SymbolicRegexNode`1[[System.UInt64, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Text.RegularExpressions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a],[System.Text.RegularExpressions.Symbolic.SymbolicRegexNode`1[[System.UInt64, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Text.RegularExpressions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]]:this-30 (-6.38% of base) :12911.dasm -System.Runtime.Serialization.BitFlagsGenerator:.ctor(int,System.Runtime.Serialization.CodeGenerator,System.String):this-10 (-6.37% of base) :7828.dasm -SelectListIterator`2[__Canon,__Canon][System.__Canon,System.__Canon]:ToArray():System.__Canon[]:this-18 (-6.32% of base) :19436.dasm -Microsoft.CodeAnalysis.CSharp.Symbols.TypeSymbol:GetInterfaceInfo():InterfaceInfo:this-33 (-6.25% of base) :20248.dasm -Microsoft.CodeAnalysis.CSharp.Emit.PEModuleBuilder:Translate(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol,Microsoft.CodeAnalysis.SyntaxNode,Microsoft.CodeAnalysis.DiagnosticBag,Microsoft.CodeAnalysis.CSharp.BoundArgListOperator,bool):Microsoft.Cci.IMethodReference:this-14 (-6.25% of base) :1346.dasm -System.Reflection.AssemblyName:Clone():System.Object:this-104 (-5.84% of base) :21891.dasm -System.Numerics.BigInteger:Multiply(System.ReadOnlySpan`1[UInt32],int,System.ReadOnlySpan`1[UInt32],int):System.Numerics.BigInteger-8 (-4.42% of base) :9682.dasm -System.Collections.Generic.List`1[KeyValuePair`2][System.Collections.Generic.KeyValuePair`2[System.__Canon,System.__Canon]]:ConvertAll(System.Converter`2[KeyValuePair`2,__Canon]):System.Collections.Generic.List`1[__Canon]:this-28 (-4.20% of base) :15213.dasm -System.IO.Compression.Brotli:Compress_WithState():System.Span`1[Byte]:this-15 (-4.19% of base) :5130.dasm -ThreadCounts:InterlockedSetNumThreadsGoal(short):ThreadCounts:this-37 (-4.13% of base) :19265.dasm -System.Reflection.Metadata.MetadataReader:InitializeNestedTypesMap():this305 total methods withCodeSize differences (219 improved, 86 regressed), 81 unchanged.
Summary of PerfScorediffs:
(Lower is better)
TotalPerfScoreUnits of base: 4343726501.63TotalPerfScoreUnits of diff: 4159143780.580001TotalPerfScoreUnits of delta: -184582721.05 (-4.25% of base)
Total relative delta: -1.99
diff is an improvement.
relative diff is an improvement.
Top file regressions (PerfScoreUnits):744.30:40712.dasm (6.19% of base)
744.20:39877.dasm (4.87% of base)
95.65:11803.dasm (0.26% of base)
65.80:9989.dasm (2.39% of base)
61.85:43959.dasm (0.52% of base)
58.40:13553.dasm (1.15% of base)
58.40:13559.dasm (1.15% of base)
48.60:2444.dasm (0.01% of base)
38.80:41551.dasm (1.01% of base)
19.00:15398.dasm (0.60% of base)
18.90:44300.dasm (1.99% of base)
13.60:43038.dasm (0.43% of base)
13.60:13587.dasm (0.43% of base)
13.60:15396.dasm (0.43% of base)
12.80:17302.dasm (0.40% of base)
12.23:2040.dasm (2.26% of base)
12.05:15397.dasm (0.35% of base)
10.70:13599.dasm (0.33% of base)
10.50:13590.dasm (0.31% of base)
10.30:10000.dasm (0.31% of base)
Top file improvements (PerfScoreUnits):-184551466.05:2331.dasm (-4.38% of base)
-31106.90:7426.dasm (-1.06% of base)
-512.60:18756.dasm (-0.00% of base)
-172.80:4224.dasm (-1.98% of base)
-145.70:4055.dasm (-1.41% of base)
-138.50:22721.dasm (-4.06% of base)
-138.50:7245.dasm (-4.07% of base)
-65.30:59.dasm (-0.11% of base)
-63.65:17442.dasm (-3.11% of base)
-49.25:7232.dasm (-6.88% of base)
-46.30:1887.dasm (-0.96% of base)
-39.20:11615.dasm (-1.17% of base)
-37.70:18937.dasm (-0.15% of base)
-29.10:8045.dasm (-15.93% of base)
-24.95:7437.dasm (-1.80% of base)
-22.95:23169.dasm (-3.63% of base)
-22.50:41540.dasm (-1.93% of base)
-22.30:9695.dasm (-0.16% of base)
-20.80:19804.dasm (-7.66% of base)
-20.80:3120.dasm (-4.69% of base)
312 total files withPerfScore differences (214 improved, 98 regressed), 74 unchanged.
Top method regressions (PerfScoreUnits):744.30 ( 6.19% of base) :40712.dasm -Algorithms.VectorDoubleRenderer:RenderSingleThreadedWithADT(float,float,float,float,float):this744.20 ( 4.87% of base) :39877.dasm -Algorithms.VectorFloatRenderer:RenderSingleThreadedWithADT(float,float,float,float,float):this95.65 ( 0.26% of base) :11803.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
65.80 ( 2.39% of base) :9989.dasm -FractalPerf.Mandelbrot:Render():double:this61.85 ( 0.52% of base) :43959.dasm -System.IO.Enumeration.FileSystemName:MatchPattern(System.ReadOnlySpan`1[Char],System.ReadOnlySpan`1[Char],bool,bool):bool
58.40 ( 1.15% of base) :13553.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
58.40 ( 1.15% of base) :13559.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
48.60 ( 0.01% of base) :2444.dasm -System.Reflection.Emit.TypeBuilder:CreateTypeNoLock():System.Reflection.TypeInfo:this38.80 ( 1.01% of base) :41551.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
19.00 ( 0.60% of base) :15398.dasm -MessagePack.Formatters.MicroBenchmarks_Serializers_MyEventsListerItemTaskFormatter3:Deserialize(System.Byte[],int,MessagePack.IFormatterResolver,byref):MicroBenchmarks.Serializers.MyEventsListerItemTask:this18.90 ( 1.99% of base) :44300.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
13.60 ( 0.43% of base) :13587.dasm -MessagePack.Formatters.MicroBenchmarks_Serializers_IndexViewModelFormatter1:Deserialize(System.Byte[],int,MessagePack.IFormatterResolver,byref):MicroBenchmarks.Serializers.IndexViewModel:this13.60 ( 0.43% of base) :43038.dasm -MessagePack.Formatters.MicroBenchmarks_Serializers_LoginViewModelFormatter1:Deserialize(System.Byte[],int,MessagePack.IFormatterResolver,byref):MicroBenchmarks.Serializers.LoginViewModel:this13.60 ( 0.43% of base) :15396.dasm -MessagePack.Formatters.MicroBenchmarks_Serializers_MyEventsListerViewModelFormatter1:Deserialize(System.Byte[],int,MessagePack.IFormatterResolver,byref):MicroBenchmarks.Serializers.MyEventsListerViewModel:this12.80 ( 0.40% of base) :17302.dasm -MessagePack.Formatters.MicroBenchmarks_Serializers_CollectionsOfPrimitivesFormatter1:Deserialize(System.Byte[],int,MessagePack.IFormatterResolver,byref):MicroBenchmarks.Serializers.CollectionsOfPrimitives:this12.23 ( 2.26% of base) :2040.dasm -System.Globalization.TimeSpanFormat:TryFormatStandard(System.TimeSpan,int,System.String,System.Span`1[Char],byref):bool
12.05 ( 0.35% of base) :15397.dasm -MessagePack.Formatters.MicroBenchmarks_Serializers_MyEventsListerItemFormatter2:Deserialize(System.Byte[],int,MessagePack.IFormatterResolver,byref):MicroBenchmarks.Serializers.MyEventsListerItem:this10.70 ( 0.33% of base) :13599.dasm -MessagePack.Formatters.MicroBenchmarks_Serializers_CampaignSummaryViewModelFormatter3:Deserialize(System.Byte[],int,MessagePack.IFormatterResolver,byref):MicroBenchmarks.Serializers.CampaignSummaryViewModel:this10.50 ( 0.31% of base) :13590.dasm -MessagePack.Formatters.MicroBenchmarks_Serializers_ActiveOrUpcomingEventFormatter2:Deserialize(System.Byte[],int,MessagePack.IFormatterResolver,byref):MicroBenchmarks.Serializers.ActiveOrUpcomingEvent:this10.30 ( 0.31% of base) :10000.dasm -MessagePack.Formatters.MicroBenchmarks_Serializers_LocationFormatter1:Deserialize(System.Byte[],int,MessagePack.IFormatterResolver,byref):MicroBenchmarks.Serializers.Location:thisTop method improvements (PerfScoreUnits):-184551466.05 (-4.38% of base) :2331.dasm -Utf8Json.Resolvers.Internal.DynamicObjectTypeBuilder:BuildSerialize(System.Type,Utf8Json.Internal.Emit.MetaType,System.Reflection.Emit.ILGenerator,System.Action,System.Func`3[[System.Int32, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Utf8Json.Internal.Emit.MetaMember, Utf8Json, Version=1.3.7.0, Culture=neutral, PublicKeyToken=8a73d3ba7e392e27],[System.Boolean, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]],bool,bool,int)
-31106.90 (-1.06% of base) :7426.dasm -MessagePack.Internal.ObjectSerializationInfo:CreateOrNull(System.Type,bool,bool,bool):MessagePack.Internal.ObjectSerializationInfo-512.60 (-0.00% of base) :18756.dasm -SelectManySingleSelectorIterator`2[__Canon,ReferenceDirective][System.__Canon,Microsoft.CodeAnalysis.ReferenceDirective]:ToArray():Microsoft.CodeAnalysis.ReferenceDirective[]:this-172.80 (-1.98% of base) :4224.dasm -WorkerThread:WorkerThreadStart()
-145.70 (-1.41% of base) :4055.dasm -GateThread:GateThreadStart()
-138.50 (-4.07% of base) :7245.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
-138.50 (-4.06% of base) :22721.dasm -DynamicClass:Regex3_Go(System.Text.RegularExpressions.RegexRunner)
-65.30 (-0.11% of base) :59.dasm -System.Text.Unicode.Utf8Utility:TranscodeToUtf8(long,int,long,int,byref,byref):int
-63.65 (-3.11% of base) :17442.dasm -System.Diagnostics.Tracing.EventPipeMetadataGenerator:GenerateMetadata(int,System.String,long,int,int,int,System.Diagnostics.Tracing.EventParameterInfo[]):System.Byte[]:this-49.25 (-6.88% of base) :7232.dasm -System.Text.Encoding:GetCharsWithFallback(System.ReadOnlySpan`1[Byte],int,System.Span`1[Char],int,System.Text.DecoderNLS):int:this-46.30 (-0.96% of base) :1887.dasm -System.DateTimeFormat:FormatCustomized(System.DateTime,System.ReadOnlySpan`1[Char],System.Globalization.DateTimeFormatInfo,System.TimeSpan,System.Text.StringBuilder):System.Text.StringBuilder-39.20 (-1.17% of base) :11615.dasm -System.Numerics.BigIntegerCalculator:Gcd(System.Span`1[UInt32],System.Span`1[UInt32])
-37.70 (-0.15% of base) :18937.dasm -Microsoft.CodeAnalysis.CommonReferenceManager`2[__Canon,__Canon][System.__Canon,System.__Canon]:ReuseAssemblySymbols(Microsoft.CodeAnalysis.CommonReferenceManager`2+BoundInputAssembly[System.__Canon,System.__Canon][],System.__Canon[],System.Collections.Immutable.ImmutableArray`1[__Canon],int):this-29.10 (-15.93% of base) :8045.dasm -System.Linq.Expressions.Compiler.LambdaCompiler:GetParameterTypes(System.Linq.Expressions.LambdaExpression,System.Type):System.Type[]
-24.95 (-1.80% of base) :7437.dasm -MessagePack.Internal.DynamicObjectTypeBuilder:BuildSerialize(System.Type,MessagePack.Internal.ObjectSerializationInfo,System.Reflection.Emit.ILGenerator,System.Action,System.Func`3[[System.Int32, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[MessagePack.Internal.ObjectSerializationInfo+EmittableMember, MessagePack, Version=1.9.0.0, Culture=neutral, PublicKeyToken=b4a0369545f0a1be],[System.Action, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]],int)
-22.95 (-3.63% of base) :23169.dasm -System.Text.Encoding:GetBytesWithFallback(System.ReadOnlySpan`1[Char],int,System.Span`1[Byte],int,System.Text.EncoderNLS):int:this-22.50 (-1.93% of base) :41540.dasm -DynamicClass:Regex9_Go(System.Text.RegularExpressions.RegexRunner)
-22.30 (-0.16% of base) :9695.dasm -DynamicClass:Regex4_Go(System.Text.RegularExpressions.RegexRunner)
-20.80 (-7.66% of base) :19804.dasm -Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker:DefaultVisit(Microsoft.CodeAnalysis.SyntaxNode):this-20.80 (-4.69% of base) :3120.dasm -System.Uri:Compress(System.Span`1[Char],System.UriParser):int
Top method regressions (percentages):744.30 ( 6.19% of base) :40712.dasm -Algorithms.VectorDoubleRenderer:RenderSingleThreadedWithADT(float,float,float,float,float):this744.20 ( 4.87% of base) :39877.dasm -Algorithms.VectorFloatRenderer:RenderSingleThreadedWithADT(float,float,float,float,float):this2.80 ( 3.91% of base) :14621.dasm -<>c:<BeginWriteInternal>b__48_0(System.Object):int:this2.80 ( 3.78% of base) :14612.dasm -<>c:<BeginReadInternal>b__38_0(System.Object):int:this65.80 ( 2.39% of base) :9989.dasm -FractalPerf.Mandelbrot:Render():double:this12.23 ( 2.26% of base) :2040.dasm -System.Globalization.TimeSpanFormat:TryFormatStandard(System.TimeSpan,int,System.String,System.Span`1[Char],byref):bool
1.30 ( 2.23% of base) :2227.dasm -System.Reflection.Emit.MethodBuilder:GetMethodSignature():System.Reflection.Emit.SignatureHelper:this18.90 ( 1.99% of base) :44300.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
2.30 ( 1.98% of base) :3228.dasm -System.IO.MemoryStream:Read(System.Byte[],int,int):int:this0.43 ( 1.69% of base) :21570.dasm -System.Text.Tests.Perf_StringBuilder:ctor_string(int):System.Text.StringBuilder:this2.00 ( 1.44% of base) :17181.dasm -System.Buffers.ReadOnlySequence`1[Byte][System.Byte]:Slice(long,System.SequencePosition):System.Buffers.ReadOnlySequence`1[Byte]:this8.40 ( 1.18% of base) :19659.dasm -Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol:CheckSequentialOnPartialType(Microsoft.CodeAnalysis.DiagnosticBag):this58.40 ( 1.15% of base) :13553.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
58.40 ( 1.15% of base) :13559.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
1.20 ( 1.14% of base) :21866.dasm -V8.Crypto.BigInteger:copyTo(V8.Crypto.BigInteger):this0.35 ( 1.12% of base) :22571.dasm -System.Collections.IndexerSetReverse`1[Int32][System.Int32]:Span():int:this1.10 ( 1.11% of base) :15147.dasm -System.Collections.CreateAddAndClear`1[__Canon][System.__Canon]:Array():System.__Canon[]:this38.80 ( 1.01% of base) :41551.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
1.10 ( 0.97% of base) :593.dasm -System.Linq.OrderedEnumerable`1[__Canon][System.__Canon]:ToArray():System.__Canon[]:this0.80 ( 0.88% of base) :6206.dasm -System.Net.Http.QPack.QPackEncoder:EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int,System.String):System.Byte[]
Top method improvements (percentages):-29.10 (-15.93% of base) :8045.dasm -System.Linq.Expressions.Compiler.LambdaCompiler:GetParameterTypes(System.Linq.Expressions.LambdaExpression,System.Type):System.Type[]
-20.80 (-7.66% of base) :19804.dasm -Microsoft.CodeAnalysis.CSharp.CSharpSyntaxWalker:DefaultVisit(Microsoft.CodeAnalysis.SyntaxNode):this-49.25 (-6.88% of base) :7232.dasm -System.Text.Encoding:GetCharsWithFallback(System.ReadOnlySpan`1[Byte],int,System.Span`1[Char],int,System.Text.DecoderNLS):int:this-20.30 (-6.65% of base) :20248.dasm -Microsoft.CodeAnalysis.CSharp.Emit.PEModuleBuilder:Translate(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol,Microsoft.CodeAnalysis.SyntaxNode,Microsoft.CodeAnalysis.DiagnosticBag,Microsoft.CodeAnalysis.CSharp.BoundArgListOperator,bool):Microsoft.Cci.IMethodReference:this-16.90 (-6.59% of base) :5675.dasm -System.IO.Compression.BrotliStream:WriteCore(System.ReadOnlySpan`1[Byte],bool):this-10.80 (-5.91% of base) :4688.dasm -System.Text.Encodings.Web.AllowedBmpCodePointsBitmap:ForbidUndefinedCharacters():this-18.80 (-5.39% of base) :11582.dasm -System.Net.MultiMemory:CopyFrom(System.ReadOnlySpan`1[Byte]):this-17.40 (-5.37% of base) :10890.dasm -System.Text.StringBuilder:ReplaceInPlaceAtChunk(byref,byref,byref,int):this-3.40 (-4.80% of base) :1346.dasm -System.Reflection.AssemblyName:Clone():System.Object:this-15.00 (-4.72% of base) :12911.dasm -System.Runtime.Serialization.BitFlagsGenerator:.ctor(int,System.Runtime.Serialization.CodeGenerator,System.String):this-20.80 (-4.69% of base) :3120.dasm -System.Uri:Compress(System.Span`1[Char],System.UriParser):int
-184551466.05 (-4.38% of base) :2331.dasm -Utf8Json.Resolvers.Internal.DynamicObjectTypeBuilder:BuildSerialize(System.Type,Utf8Json.Internal.Emit.MetaType,System.Reflection.Emit.ILGenerator,System.Action,System.Func`3[[System.Int32, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Utf8Json.Internal.Emit.MetaMember, Utf8Json, Version=1.3.7.0, Culture=neutral, PublicKeyToken=8a73d3ba7e392e27],[System.Boolean, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]],bool,bool,int)
-138.50 (-4.07% of base) :7245.dasm -DynamicClass:Regex1_Go(System.Text.RegularExpressions.RegexRunner)
-138.50 (-4.06% of base) :22721.dasm -DynamicClass:Regex3_Go(System.Text.RegularExpressions.RegexRunner)
-19.45 (-4.04% of base) :20306.dasm -Microsoft.CodeAnalysis.SyntaxNavigator:GetFirstToken(Microsoft.CodeAnalysis.SyntaxNode,System.Func`2[SyntaxToken,Boolean],System.Func`2[SyntaxTrivia,Boolean]):Microsoft.CodeAnalysis.SyntaxToken:this-22.95 (-3.63% of base) :23169.dasm -System.Text.Encoding:GetBytesWithFallback(System.ReadOnlySpan`1[Char],int,System.Span`1[Byte],int,System.Text.EncoderNLS):int:this-2.55 (-3.63% of base) :6051.dasm -System.Net.Security.SslClientAuthenticationOptionsExtensions:ShallowClone(System.Net.Security.SslClientAuthenticationOptions):System.Net.Security.SslClientAuthenticationOptions-13.53 (-3.56% of base) :21891.dasm -System.Numerics.BigInteger:Multiply(System.ReadOnlySpan`1[UInt32],int,System.ReadOnlySpan`1[UInt32],int):System.Numerics.BigInteger-3.10 (-3.53% of base) :22486.dasm -System.Threading.Tests.Perf_Timer:SynchronousContention():this-3.10 (-3.47% of base) :23043.dasm -System.Threading.Tests.Perf_Timer:AsynchronousContention():this312 total methods withPerfScore differences (214 improved, 98 regressed), 74 unchanged.All regressions are, as one would expect, from RA not being too happy. We may decide those are ok enough diffs to take even with the regressions. |
And account for this in copy propagation. No diffs.
Removing the PHI quirk is more problematic due to regressions.
e1a3a52 to
f27680eCompareSingleAccretion
commented
Feb 25, 2022
Windows ARM64 build failures are #65818, SPMI failed for it too (no MCHs). @dotnet/jit-contrib - rounding out the copy propagation story. |
kunalspathak
commented
Feb 25, 2022
I am inclined to see the diffs before deciding if we want to take this with the regressions. I won't get it until Monday though. I am assigning @jakobbotsch as well in case he gets chance to check the diffs. |
Let's assess the diffs.
Let's do that then. I've pushed a commit removing the quirk for an SPMI run. |
There are some regressions in some functions that worry me a bit, e.g. regressions in:
For some reason I cannot find the .dasm file in the artifacts for Linux x64, the Extensions view says (under libraries.pmi.Linux.x64.checked.mch): 28 (15.05% of base) :159341.dasm -Microsoft.FSharp.Primitives.Basics.List:filter(Microsoft.FSharp.Core.FSharpFunc`2[Byte,Boolean],Microsoft.FSharp.Collections.FSharpList`1[Byte]):Microsoft.FSharp.Collections.FSharpList`1[Byte]but this file does not seem to be present in the downloaded artifacts. Maybe I'm looking at the wrong place? Any idea @kunalspathak / @BruceForstall? Have you looked at these @SingleAccretion? Is it just some extra spilling? Inside or outside a loop? |
SingleAccretion
commented
Feb 28, 2022
Worse allocation, yes.
Here we have a case where substitution keep one more local used: -;* V09 tmp5 [V09,T10] ( 0, 0 ) byref -> zero-ref+; V09 tmp5 [V09,T07] ( 3, 1.50) byref -> rdx+ mov rdx, rcx+ ; byrRegs +[rdx]+ xor r9d, r9d
jmp SHORT G_M11382_IG07
- ;; bbWeight=0.50 PerfScore 3.25+ ;; bbWeight=0.50 PerfScore 3.38
G_M11382_IG06: ; gcrefRegs=00000001 {rax}, byrefRegs=00000002 {rcx}, byref
- mov edx, dword ptr [rax+8]- ;; bbWeight=0.50 PerfScore 1.00-G_M11382_IG07: ; gcrefRegs=00000000 {}, byrefRegs=00000002 {rcx}, byref, isz+ ; byrRegs -[rdx]+ mov rdx, rcx+ ; byrRegs +[rdx]+ mov r9d, dword ptr [rax+8]What happens is that we had a use of VN based copy assertion for [000050] V00 $80 by [000208] V09 $80.
N002 ( 1, 1) [000050] ------------*LCL_VAR byref V00this u:1 (last use) $80
copy propagated to:
N002 ( 1, 1) [000050] ------------*LCL_VAR byref V09 tmp5 u:2 (last use) $80VN based copy assertion for [000047] V09 $80 by [000005] V00 $80.
N001 ( 3, 2) [000047] ------------*LCL_VAR byref V09 tmp5 u:2 (last use) $80
copy propagated to:
N001 ( 3, 2) [000047] ------------*LCL_VAR byref V00this u:1 (last use) $80
While we do eliminate a few locals with the new substitutions, we incur quite a few new spills for the substitute itself (looks like to me like its now crossing a call, but not sure).
Here we reserve an additional callee-saved register, for what looks to me like a new overlap in lifetimes, in a method with multiple epilogs.
There are some loop cases if we look at PerfScore: G_M46727_IG07: ; gcrefRegs=000000C8 {rbx rsi rdi}, byrefRegs=00000000 {}, loop=IG07, byref, isz
- vmulps ymm11, ymm4, ymm4- vmulps ymm14, ymm5, ymm5- vsubps ymm15, ymm11, ymm14- vmulps ymm4, ymm4, ymm5- vaddps ymm5, ymm4, ymm4- vaddps ymm4, ymm15, ymm2- vaddps ymm5, ymm5, ymm3- vpaddd ymm6, ymm6, ymm9- vmulps ymm11, ymm4, ymm4- vmulps ymm14, ymm5, ymm5- vaddps ymm11, ymm11, ymm14- vcmpps ymm11, ymm11, ymm10, 2+ vmulps ymm5, ymm2, ymm2+ vmulps ymm9, ymm3, ymm3+ vsubps ymm5, ymm5, ymm9+ vmulps ymm2, ymm2, ymm3+ vaddps ymm3, ymm2, ymm2+ vmovupd ymmword ptr[rsp+20H], ymm1+ vaddps ymm2, ymm5, ymm1+ vaddps ymm3, ymm3, ymm13+ vpaddd ymm6, ymm6, ymm4+ vmulps ymm5, ymm2, ymm2+ vmulps ymm11, ymm3, ymm3+ vaddps ymm5, ymm5, ymm11+ vcmpps ymm5, ymm5, ymm10, 2
vpcmpgtd ymm14, ymm7, ymm6
vpcmpeqd ymm15, ymm6, ymm7
- vpor ymm14, ymm14, ymm15- vpand ymm11, ymm11, ymm14- vpand ymm9, ymm9, ymm11- vptest ymm9, ymm9+ vpor ymm9, ymm14, ymm15+ vpand ymm5, ymm5, ymm9+ vpand ymm4, ymm4, ymm5+ vptest ymm4, ymm4+ vmovupd ymm1, ymmword ptr[rsp+20H]
jne SHORT G_M46727_IG07PerfScore for some collections
Personally, it seems to me that the regressions here are too numerous to ignore, and there is no easy fix, so we may yet be better off with the quirk. |
BruceForstall
commented
Feb 28, 2022
dotnet/jitutils#347 added the logic to save files. Looks like we save the "top files" diffs, but not the files corresponding to the "top methods", which would also be useful (maybe more useful?). If the DisplayMethodMetric function could be augmented to appropriately set |
kunalspathak
commented
Mar 1, 2022
Haven't seen deeply, but I see more resolution movs being added for critical edges. Also, here is another type of regression for linux/arm64/crossgen2: @@ -1,3 +1,4 @@- adrp x28, [HIGH RELOC #0xd1ffab1e] // function address- add x28, x28, [LOW RELOC #0xd1ffab1e]- ;; bbWeight=1 PerfScore 33.50
\ No newline at end of file
+ adrp x0, [HIGH RELOC #0xd1ffab1e] // function address+ add x0, x0, [LOW RELOC #0xd1ffab1e]+ mov x28, x0+ ;; bbWeight=1 PerfScore 34.00
\ No newline at end of file
I agree. |
This reverts commit b22d20e.
jakobbotsch
left a comment
There was a problem hiding this comment.
LGTM, overall improvement and the regressions look minor now. @kunalspathak want to give the diffs another quick lookover now?
kunalspathak
left a comment
There was a problem hiding this comment.
LGTM. I have suggested to remove the reference of "previous behavior" in a follow up PR.
Uh oh!
There was an error while loading. Please reload this page.
The last of the copy propagation changes - do not number locals on the LHS and update copy propagation to account for that.
Two commits: first is the refactoring itself, second is the removal of the quirk for structs, that is also where some positive diffs for this change will come from.
Contributes to #10873.