Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

ARM64: Enable Struct Promotion for most Mutireg structs #4632

Merged
merged 2 commits into from
Apr 28, 2016

Conversation

briansull
Copy link

@briansull briansull commented Apr 27, 2016

Enable struct promotion for Multireg Struct on Arm64 (16-byte structs)
For the current level of support the struct must have exactly two fields and they must be on the natural alignment of 0 and 8.
If the struct is use as a parameter and it contains a floating point field then we force the promoted struct to be stack allocated in order to avoid LSRA limitations in this area.
If a promoted multireg struct is passed in the out going arg area we convert it to the GT_LIST form.
The optimizer phases can perform copy and constant prop into the promoted struct fields.
Support for the promotion of incoming multireg arguments is still disabled as additional work in required to enable this.

A lot of method showed very large improvemenst is the AsmDiffs.

Overall using we are seeing a 0.34% total size improvement with a lot of method showing 50% size reductions:

mscorlib.dasm 6852660 6831248 21412 0.31 38763
573 functions improved (19428 total bytes improvement)
Improvement # 1 goes from 3428 to 2216, diff of 1212 (35.36%) :: System.Runtime.Remoting.Activation.RemotingXmlConfigFileParser:ParseDefaultConfiguration():ref
Improvement # 2 goes from 996 to 584, diff of 412 (41.37%) :: System.BCLDebug:.cctor()
Improvement # 3 goes from 184 to 60, diff of 124 (67.39%) :: System.Internal:NullableHelper():long
Improvement # 4 goes from 540 to 332, diff of 208 (38.52%) :: System.Decimal:.cctor()
Improvement # 5 goes from 292 to 144, diff of 148 (50.68%) :: System.Internal:NullableHelper():ref
Improvement # 6 goes from 104 to 28, diff of 76 (73.08%) :: System.ConfigNode:ReplaceAttribute(int,ref,ref):this
Improvement # 7 goes from 144 to 60, diff of 84 (58.33%) :: System.Collections.Generic.Dictionary`2[EventCacheKey,EventCacheEntry][System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal+NativeOrStaticEventRegistrationImpl+EventCacheKey,System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal+NativeOrStaticEventRegistrationImpl+EventCacheEntry]:System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add(struct):this
Improvement # 8 goes from 184 to 92, diff of 92 (50.00%) :: System.Threading.CancellationTokenRegistration:Equals(struct):bool:this
Improvement # 9 goes from 148 to 72, diff of 76 (51.35%) :: System.Threading.Tasks.ParallelLoopStateFlags64:get_NullableLowestBreakIteration():struct:this
Improvement #10 goes from 96 to 36, diff of 60 (62.50%) :: System.Runtime.CompilerServices.ConfiguredTaskAwaitable:.ctor(ref,bool):this

Enable Struct promotion for 16-byte structs on Arm64
@briansull
Copy link
Author

@dotnet-bot test Windows_NT arm64 Checked

@briansull
Copy link
Author

@kyulee1 @CarolEidt PTAL
/cc @dotnet/jit-contrib

@briansull
Copy link
Author

@dotnet-bot test Windows_NT arm64 Checked

if (varDsc->lvIsMultiregStruct() && // Is this a variable holding a value that is passed in multiple registers?
(structPromotionInfo.fieldCnt != 2) && // An argument with two exactly two fields
false) // TODO-PERF - Disabled as this needs additional implementation:
// it hits assert(lvFieldCnt==1) in lclvar.cpp line 4417
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to say that this hits noway_assert(varDsc->lvFieldCnt == 1) in lvaAssignVirtualFrameOffsetToArg1() rather than mentioning a line number.

@CarolEidt
Copy link

Nice - looks like you also addressed my one comment while I was making it! LGTM

@briansull briansull merged commit e9bc870 into dotnet:master Apr 28, 2016
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…-promote

ARM64: Enable Struct Promotion for most Mutireg structs

Commit migrated from dotnet/coreclr@e9bc870
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants