Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Don't define HAS_CUSTOM_BLOCKS on mono#106764

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
EgorBo merged 1 commit intodotnet:mainfromEgorBo:mono-fix
Aug 22, 2024
Merged

Conversation

@EgorBo
Copy link
Member

@EgorBoEgorBo commentedAug 21, 2024
edited
Loading

@ghostghost added the area-System.Memory labelAug 21, 2024
@EgorBo
Copy link
MemberAuthor

@EgorBot -mono --filter System.Memory.ReadOnlyMemory.ToArray

EgorBot reacted with thumbs up emoji

@EgorBot
Copy link

Benchmark results on Intel
BenchmarkDotNet v0.13.13-nightly.20240311.145, Ubuntu 22.04.4 LTS (Jammy Jellyfish)Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores  Job-HTXVRI : .NET 9.0.0 (42.42.42.42424) using MonoVM, X64 X86Base  Job-WOJFSK : .NET 9.0.0 (42.42.42.42424) using MonoVM, X64 X86BasePowerPlanMode=00000000-0000-0000-0000-000000000000  IterationTime=250ms  MaxIterationCount=20MinIterationCount=15  WarmupCount=1
MethodToolchainSizeMeanErrorRatioGen0AllocatedAlloc Ratio
ToArrayMain512948.9 ns3.19 ns1.000.25041.03 KB1.00
ToArrayPR512196.8 ns1.75 ns0.210.25211.03 KB1.00

BDN_Artifacts.zip

@EgorBo
Copy link
MemberAuthor

EgorBo commentedAug 21, 2024
edited
Loading

@matouskozak PTAL, it fixes the issue according to the benchmark in#106764 (comment)

matouskozak reacted with thumbs up emoji

@matouskozak
Copy link
Member

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@matouskozakmatouskozak left a comment

Choose a reason for hiding this comment

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

Thank you for the fix and help with investigating the issue.

I don't think that MonoJIT (or other Mono codegens) have this guarantee to unroll blocks (<= 64 bytes) so I think this is a good fix.@BrzVlad do you know otherwise?

@BrzVlad
Copy link
Member

BrzVlad commentedAug 22, 2024
edited
Loading

We do unroll copies, inmini_emit_memcpy, but we might not be hitting that path for whatever reason, or we might emit some redundant instructions. I think this fix is ok, but it is a sign that our copy function is not optimal.

@matouskozak
Copy link
Member

matouskozak commentedAug 22, 2024
edited
Loading

mini_emit_memcpy

We do unroll copies, inmini_emit_memcpy, but we might not be hitting that path for whatever reason, or we might emit some redundant instructions. I think this fix is ok, but it is a sign that our copy function is not optimal.

Looking at the codepaths for[Write/Read]Unaligned we are going thrumini_emit_memory_[store/load] that doesn't pass thrumini_emit_memcpy but goes straight toEMIT_NEW_[STORE/LOAD]_MEMBASE_TYPE. So we are not even trying to take advantage of themini_emit_memcpy copy unroll.

@BrzVlad
Copy link
Member

That should still emit aOP_STOREV_MEMBASE that would later be decomposed to some optimal copy sequence inmono_decompose_vtype_opts.

matouskozak reacted with thumbs up emoji

@matouskozak
Copy link
Member

We might want to backport this fix to .NET 9 due to the severity of the perf regressionsdotnet/perf-autofiling-issues#33182@jkurdek@vitek-karas.

That should still emit aOP_STOREV_MEMBASE that would later be decomposed to some optimal copy sequence inmono_decompose_vtype_opts.

Thank you, you're right. However, we are taking this path

mono_emit_method_call (cfg,mini_get_memcpy_method (),iargs,NULL);
instead of going thrumini_emit_memcpy because we passsize / align > MAX_INLINE_COPIES (klass min_align is 1). As a future work, we could try tweaking theMAX_INLINE_COPIES heuristics.

@EgorBoEgorBo merged commit7266021 intodotnet:mainAug 22, 2024
@EgorBo
Copy link
MemberAuthor

/backport to release/9.0

matouskozak reacted with heart emoji

@github-actions
Copy link
Contributor

Started backporting to release/9.0:https://github.com/dotnet/runtime/actions/runs/10505141188

@xtqqczze
Copy link
Contributor

Looking at the codepaths for[Write/Read]Unaligned we are going thrumini_emit_memory_[store/load] that doesn't pass thrumini_emit_memcpy but goes straight toEMIT_NEW_[STORE/LOAD]_MEMBASE_TYPE. So we are not even trying to take advantage of themini_emit_memcpy copy unroll.

Is there an issue tracking this missed optimization?

@matouskozak
Copy link
Member

Looking at the codepaths for[Write/Read]Unaligned we are going thrumini_emit_memory_[store/load] that doesn't pass thrumini_emit_memcpy but goes straight toEMIT_NEW_[STORE/LOAD]_MEMBASE_TYPE. So we are not even trying to take advantage of themini_emit_memcpy copy unroll.

Is there an issue tracking this missed optimization?

I'm not aware of it so I created it#106822.

xtqqczze reacted with thumbs up emoji

matouskozak added a commit to matouskozak/runtime that referenced this pull requestSep 9, 2024
github-actionsbot pushed a commit that referenced this pull requestSep 11, 2024
carlossanlop pushed a commit that referenced this pull requestSep 12, 2024
This reverts commit7266021.Co-authored-by: Matous Kozak <matouskozak@seznam.cz>
jtschuster pushed a commit to jtschuster/runtime that referenced this pull requestSep 17, 2024
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 22, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@matouskozakmatouskozakmatouskozak approved these changes

Assignees

@EgorBoEgorBo

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Perf] Linux/x64: 183 Regressions on 4/15/2024 6:25:38 PM

5 participants

@EgorBo@EgorBot@matouskozak@BrzVlad@xtqqczze

[8]ページ先頭

©2009-2025 Movatter.jp