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

[mono] Unaligned read/write only when NO_UNALIGNED_ACCESS is set #91813

Merged
merged 6 commits into from
Sep 26, 2023

Conversation

matouskozak
Copy link
Member

@matouskozak matouskozak commented Sep 8, 2023

Using unaligned read code path only when NO_UNALIGNED_ACCESS is set. Otherwise emit regular memory load (EMIT_NEW_LOAD_MEMBASE_TYPE) without using memcpy.

Edit: Increased the scope of the change to both load/store operations. When CPU supports unaligned memory access (NO_UNALIGNED_ACCESS is not set) we let CPU handle the unaligned load/store operation rather than handling it ourselves.


Locally confirmed that it fixes Perf_Matrix3x2.CreateRotation* benchmarks (#91361)

@matouskozak matouskozak changed the title [mono] Detect aligned read in ReadUnaligned [mono] Unaligned read in ReadUnaligned only when NO_UNALIGNED_ACCESS is set Sep 19, 2023
@matouskozak
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@matouskozak
Copy link
Member Author

Microbenchmarks results from x64-Ubuntu22.04

Microbenchmark ecef854 65536eb this PR
CreateRotationBenchmark 95.55 201.7 95.04
CreateRotationWithCenterBenchmark 99.09 209.7 98.62

@matouskozak matouskozak changed the title [mono] Unaligned read in ReadUnaligned only when NO_UNALIGNED_ACCESS is set [mono] Unaligned read/write only when NO_UNALIGNED_ACCESS is set Sep 22, 2023
@vargaz
Copy link
Contributor

vargaz commented Sep 25, 2023

What change caused the regression ?

@matouskozak
Copy link
Member Author

matouskozak commented Sep 25, 2023

What change caused the regression ?

It was introduced in #89364 by changing BitCast to use ReadUnaligned.

@matouskozak
Copy link
Member Author

The failures seem unrelated, and all can be found on main (e.g. bbe5c66)

@matouskozak matouskozak merged commit 169e22c into dotnet:main Sep 26, 2023
143 of 158 checks passed
@ghost ghost locked as resolved and limited conversation to collaborators Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants