Skip to content
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

Include dependently promoted fields in SSA #77238

Merged

Conversation

SingleAccretion
Copy link
Contributor

@SingleAccretion SingleAccretion commented Oct 19, 2022

Allowing for their participation in the SSA-based optimizations.

This changes two significant IR invariants:

  1. It is not longer a correctness issue for morph to not mark a dependently promoted struct DNER / multi-reg - we remove the one hard requirement for this determination from the front-end. The soft requirement of CQ and making ref counting happy stays.
  2. Uses of promoted locals can now implicitly refer to SSA variables. They are not renamed. The canonical example of such promoted locals are those created for multi-reg returns.

This change also makes lvIsMultiRegRet mostly unnecessary, though I plan to scale back its usage in a separate change.

2nd Round Diffs

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Oct 19, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Oct 19, 2022
@ghost
Copy link

ghost commented Oct 19, 2022

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

Allowing for their participation in the SSA-based optimizations.

This changes two significant IR invariant:

  1. It is not longer a correctness issue for morph to not mark a dependently promoted struct DNER / multi-reg - we remove the one hard requirement for this determination from the front-end. The soft requirement of CQ and making ref counting happy stays.
  2. Uses of promoted locals can now implicitly refer to SSA variables. They are not renamed. The canonical example of such promoted locals are those created for multi-reg returns.

This change also makes lvIsMultiRegRet mostly unnecessary, though I plan to scale back its usage in a separate change.

Author: SingleAccretion
Assignees: -
Labels:

area-CodeGen-coreclr, community-contribution

Milestone: -

 1) The definition of SIMPLE_NUM_COUNT was wrong.
 2) SsaNumInfo::Composite, in the compact case, did not clear the old value.
 3) SsaNumInfo::Composite, in the outlined case, did not copy the already
    (compactly) encoded simple names.
The load path needs to use the offset relative to
the store's target location.
@SingleAccretion SingleAccretion marked this pull request as ready for review October 21, 2022 16:38
@SingleAccretion
Copy link
Contributor Author

@dotnet/jit-contrib

This will need to be stressed and fuzzed.

@EgorBo
Copy link
Member

EgorBo commented Oct 21, 2022

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress, Fuzzlyn

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@SingleAccretion
Copy link
Contributor Author

SingleAccretion commented Oct 22, 2022

The CI results are a bit hard to interpret for known-ness right now (e. g. libraries stress has a little under 900 failures), Fuzzlyn looked clean-ish at least.

@BruceForstall
Copy link
Member

Stress should be cleaner now.

@BruceForstall
Copy link
Member

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress, Fuzzlyn

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@SingleAccretion
Copy link
Contributor Author

SingleAccretion commented Oct 26, 2022

Some (aka a lot of) stress (and Fuzzlyn) failures with an assert:

    JIT\Directed\Convert\value_numbering_checked_casts_of_constants\value_numbering_checked_casts_of_constants.cmd [FAIL]
      
      Assert failure(PID 4612 [0x00001204], Thread: 3588 [0x0e04]): Assertion failed 'isCandidateVar(fieldVarDsc) == isMultiReg' in 'ValueNumberingCheckedCastsOfConstants:<TestCastingSingleToInt64>g__ConfirmSingleOneFullDecrementUnderByteMaxValueCastToInt64IsFoldedCorrectly|10_27()' during 'Linear scan register alloc' (IL size 92; hash 0xfaebe139; Tier0-MinOpts)
      
          File: D:\a\_work\1\s\src\coreclr\jit\lsrabuild.cpp Line: 1269
          Image: C:\h\w\BB5E09CF\p\corerun.exe

Edit: this is fallout from #76263. Fix incoming...

@SingleAccretion
Copy link
Contributor Author

Apart from the above, failures looked known.

@AndyAyersMS
Copy link
Member

Hmm, odd that it got closed -- not sure how this happened.

@SingleAccretion
Copy link
Contributor Author

Presumably the same curious GH behavior we've seen once, with this line

should fix stress failures

in #77502 to blame...

@AndyAyersMS
Copy link
Member

Going to bounce this so it runs with ssa checking.

@AndyAyersMS AndyAyersMS closed this Nov 4, 2022
@AndyAyersMS AndyAyersMS reopened this Nov 4, 2022
@AndyAyersMS
Copy link
Member

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress, Fuzzlyn

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@AndyAyersMS
Copy link
Member

libraries jitstress has some known failures; coreclr jitstress was running clean recently.

@SingleAccretion
Copy link
Contributor Author

SingleAccretion commented Nov 4, 2022

Starting to collect failures.

 # ChildEBP RetAddr      
00 02fe9c48 724aa24d     coreclr!FailFastOnAssert+0x21 [D:\a\_work\1\s\src\coreclr\utilcode\debug.cpp @ 60] 
01 02fe9c48 724a9967     coreclr!_DbgBreakCheck+0x329 [D:\a\_work\1\s\src\coreclr\utilcode\debug.cpp @ 247] 
02 02fe9cb8 724a9c91     coreclr!_DbgBreakCheckNoThrow+0x51 [D:\a\_work\1\s\src\coreclr\utilcode\debug.cpp @ 307] 
03 02fe9d54 72147fe8     coreclr!DbgAssertDialog+0x20c [D:\a\_work\1\s\src\coreclr\utilcode\debug.cpp @ 459] 
04 02fe9dd4 725aff92     coreclr!Thread::DetachThread+0xcf [D:\a\_work\1\s\src\coreclr\vm\threads.cpp @ 981] 
05 02fe9e40 725c2396     coreclr!TlsDestructionMonitor::~TlsDestructionMonitor+0x8f [D:\a\_work\1\s\src\coreclr\vm\ceemain.cpp @ 1764] 
06 02fe9e58 7727ea4e     coreclr!__dyn_tls_dtor+0x86 [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\tls\tlsdtor.cpp @ 123] 
WARNING: Stack unwind information not available. Following frames may be wrong.
07 02fe9e78 7724eeb6     ntdll!RtlDecompressBuffer+0xde
08 02fe9ec8 772a3c6a     ntdll!LdrShutdownThread+0x386
09 02fe9f10 77262d7f     ntdll!LdrSetAppCompatDllRedirectionCallback+0x1052a
0a 02fe9fa8 77263886     ntdll!LdrShutdownProcess+0x15f
0b 02fea07c 7689b3e3     ntdll!RtlExitUserProcess+0x96
0c 02fea090 00000000     kernel32!ExitProcess+0x13

@SingleAccretion
Copy link
Contributor Author

The failures have been accounted for above, I believe all are known.

@AndyAyersMS AndyAyersMS merged commit 6bae351 into dotnet:main Nov 6, 2022
@SingleAccretion SingleAccretion deleted the Dependent-Fields-In-SSA-Upstream branch November 6, 2022 17:45
@kunalspathak
Copy link
Member

kunalspathak commented Nov 7, 2022

Some (aka a lot of) stress (and Fuzzlyn) failures with an assert:

    JIT\Directed\Convert\value_numbering_checked_casts_of_constants\value_numbering_checked_casts_of_constants.cmd [FAIL]
      
      Assert failure(PID 4612 [0x00001204], Thread: 3588 [0x0e04]): Assertion failed 'isCandidateVar(fieldVarDsc) == isMultiReg' in 'ValueNumberingCheckedCastsOfConstants:<TestCastingSingleToInt64>g__ConfirmSingleOneFullDecrementUnderByteMaxValueCastToInt64IsFoldedCorrectly|10_27()' during 'Linear scan register alloc' (IL size 92; hash 0xfaebe139; Tier0-MinOpts)
      
          File: D:\a\_work\1\s\src\coreclr\jit\lsrabuild.cpp Line: 1269
          Image: C:\h\w\BB5E09CF\p\corerun.exe

Edit: this is fallout from #76263. Fix incoming...

This was also hit in Antigen in yesterday's run. Was this ever fixed?
Edit: It was on linux/arm

@SingleAccretion
Copy link
Contributor Author

SingleAccretion commented Nov 7, 2022

Was this ever fixed?

Yes, it was fixed in #77502. Evidently not fully...

@EgorBo
Copy link
Member

EgorBo commented Nov 10, 2022

Improvements on arm64-ubuntu: dotnet/perf-autofiling-issues#9679

@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants