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

JIT: Don't use addressing modes for volatile loads for gc types #70794

Merged
merged 6 commits into from
Jul 29, 2023

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Jun 15, 2022

No description provided.

@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 Jun 15, 2022
@ghost ghost assigned EgorBo Jun 15, 2022
@ghost
Copy link

ghost commented Jun 15, 2022

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

Issue Details

null

Author: EgorBo
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@EgorBo
Copy link
Member Author

EgorBo commented Jun 15, 2022

/azp run runtime-coreclr outerloop, runtime-coreclr jitstress, runtime-coreclr jitstressregs, runtime-coreclr gcstress0x3-gcstress0xc

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@EgorBo
Copy link
Member Author

EgorBo commented Jun 17, 2022

/azp run runtime-coreclr outerloop, runtime-coreclr jitstress, runtime-coreclr jitstressregs, runtime-coreclr gcstress0x3-gcstress0xc

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@EgorBo EgorBo closed this Jun 17, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 18, 2022
@EgorBo EgorBo reopened this Jul 28, 2023
…ldar

# Conflicts:
#	src/coreclr/scripts/superpmi_diffs.py
@EgorBo
Copy link
Member Author

EgorBo commented Jul 29, 2023

/azp run runtime-coreclr outerloop, runtime-coreclr jitstress, runtime-coreclr jitstressregs, runtime-coreclr gcstress0x3-gcstress0xc

@EgorBo EgorBo marked this pull request as ready for review July 29, 2023 09:49
@EgorBo
Copy link
Member Author

EgorBo commented Jul 29, 2023

Diff is a size regression as expected: https://dev.azure.com/dnceng-public/public/_build/results?buildId=355867&view=ms.vss-build-web.run-extensions-tab

E.g.

-            mov     w2, #0xD1FFAB1E
-            dmb     ish
-            stp     w2, w1, [x0, #0x34]
+            add     x2, x0, #52
+            mov     w3, #0xD1FFAB1E
+            stlr    w3, [x2]
+            str     w1, [x0, #0x38]
             ldp     fp, lr, [sp], #0x10
             ret     lr
-;Total bytes of code 28
+;Total bytes of code 32

We no longer can merge two stores with stp because on of the is volatile (the other is not) -- it actually smells like a potential bug in Main - should we even merge stores/load together for volatile?

Another kind of size regressions where no longer can use addressing modes becuase ldlr/stlr don't support them. This can be mitigated with #64457

But overall it should be a perf win because memory barriers are heavy.

PTAL @AndyAyersMS

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Did you get a chance to try it out on this case where it should help perf? #87194 (comment)

If not, I can do it.

@EgorBo
Copy link
Member Author

EgorBo commented Jul 29, 2023

Did you get a chance to try it out on this case where it should help perf? #87194 (comment)

If not, I can do it.

Method Job Toolchain Size Mean Error StdDev Median Min Max Ratio Gen0 Gen1 Gen2 Allocated Alloc Ratio
ConcurrentBag Job-QLVLMF /Core_Root/corerun 512 7.115 us 0.1261 us 0.1179 us 7.073 us 6.969 us 7.312 us 0.89 1.9496 0.9607 0.0283 16.16 KB 1.00
ConcurrentBag Job-CQJZMM /Core_Root_base/corerun 512 7.978 us 0.0392 us 0.0327 us 7.983 us 7.891 us 8.024 us 1.00 1.9770 0.9885 0.0319 16.16 KB 1.00

so 11% improvement on Apple M2 Max, but it's a completely different CPU from the one in the regression

@EgorBo EgorBo merged commit 95f3bcc into dotnet:main Jul 29, 2023
238 of 259 checks passed
@EgorBo EgorBo deleted the enable-gctypes-ldar branch July 29, 2023 19:04
@AndyAyersMS
Copy link
Member

We don't have ampere data yet, but you can see this fixed the regression on the surface

image

@DrewScoggins
Copy link
Member

Looks like this was not fixed, at least on Ubuntu Ampere hw.

image image

@EgorBo
Copy link
Member Author

EgorBo commented Aug 28, 2023

Looks like this was not fixed, at least on Ubuntu Ampere hw.

image image

Lots of benchmarks regressed because of this PR, but that is expected - it was a BDN issue: BDN uses volatile to store results of benchmarks in a loop so we optimized the "overhead" part of benchmarks, there was an thread discussing it somewhere..

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants