- Notifications
You must be signed in to change notification settings - Fork5.2k
Implement Interlocked for small types.#92974
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Implements Interlocked.CompareExchange/Exchange forbyte/sbyte/short/ushort.Uses an intrinsic on CoreCLR x64 and ARM64 and fallbacksfor other platforms.Fixesdotnet#64658.
ghost commentedOct 3, 2023
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
ghost commentedOct 3, 2023
Tagging subscribers to this area:@mangod9 Issue DetailsImplements Interlocked.CompareExchange/Exchange for byte/sbyte/short/ushort. Uses an intrinsic on CoreCLR x64 and ARM64 and fallbacks for other platforms. Fixes#64658.
|
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
MichalPetryka commentedJan 24, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I've checked that earlier, it calls into a Additionally, on arm32 it gives such warning: |
jkotas commentedJan 24, 2024
It is a problem with Other operations are implemented using If
|
MichalPetryka commentedJan 24, 2024
I've opened a new issue to track this as this PR doesn't introduce the issue:#97452. |
MichalPetryka commentedJan 24, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
|
jkotas commentedJan 24, 2024
It does not introduce it, but it makes the problem worse. Could you please replace the new uses of |
MichalPetryka commentedJan 24, 2024
As I've noted in that issue, those other APIs also use helper calls so I'd assume they have the same issue. |
ryujit-bot commentedJan 24, 2024
Diff results for#92974Throughput diffsThroughput diffs for linux/x64 ran on windows/x64Overall (+0.00% to+0.02%)
MinOpts (+0.01% to+0.03%)
FullOpts (+0.00% to+0.01%)
Throughput diffs for windows/x64 ran on windows/x64Overall (-0.01% to-0.00%)
MinOpts (-0.02% to+0.00%)
FullOpts (-0.01% to-0.00%)
Detailshere Throughput diffs for linux/x64 ran on linux/x64Overall (-0.03% to-0.01%)
MinOpts (-0.07% to-0.04%)
FullOpts (-0.02% to-0.01%)
Detailshere Throughput diffs for windows/x86 ran on windows/x86Overall (+0.00% to+0.01%)
MinOpts (+0.01% to+0.02%)
FullOpts (+0.00% to+0.01%)
Detailshere |
MichalPetryka commentedJan 24, 2024
ryujit-bot commentedJan 24, 2024
Diff results for#92974Throughput diffsThroughput diffs for linux/x64 ran on windows/x64Overall (+0.00% to+0.01%)
MinOpts (+0.01% to+0.02%)
FullOpts (+0.00% to+0.01%)
Detailshere Throughput diffs for linux/x64 ran on linux/x64Overall (-0.02%)
MinOpts (-0.05%)
FullOpts (-0.02%)
Detailshere |
ryujit-bot commentedJan 24, 2024
Diff results for#92974Throughput diffsThroughput diffs for linux/x64 ran on linux/x64Overall (-0.03% to-0.01%)
MinOpts (-0.07% to-0.04%)
FullOpts (-0.02% to-0.01%)
Detailshere |
ryujit-bot commentedJan 25, 2024
Diff results for#92974Throughput diffsThroughput diffs for linux/x64 ran on windows/x64Overall (+0.00% to+0.01%)
MinOpts (+0.01% to+0.03%)
FullOpts (+0.00% to+0.01%)
Throughput diffs for windows/x64 ran on windows/x64Overall (-0.01% to-0.00%)
MinOpts (-0.02% to+0.00%)
FullOpts (-0.01% to-0.00%)
Detailshere Throughput diffs for windows/x86 ran on windows/x86Overall (+0.00% to+0.01%)
MinOpts (+0.01% to+0.02%)
FullOpts (+0.00% to+0.01%)
Detailshere Throughput diffs for linux/x64 ran on linux/x64Overall (-0.03% to-0.01%)
MinOpts (-0.07% to-0.04%)
FullOpts (-0.02% to-0.01%)
Detailshere |
MichalPetryka commentedJan 25, 2024
@jkotas I think the arm32 atomic helper issue should be fixed in a separate PR (I can take a look at using the safe LLVM helpers later today) so this should be ready to merge. |
jkotas commentedJan 25, 2024
What was this bug? |
jkotas commentedJan 25, 2024
/azp run runtime-coreclr outerloop, runtime-nativeaot-outerloop |
| Azure Pipelines successfully started running 2 pipeline(s). |
MichalPetryka commentedJan 25, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
A missing cast to |
jkotas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thank you for making this happen!
| publicstaticintCompareExchange(refintlocation1,intvalue,intcomparand) | ||
| { | ||
| #ifTARGET_X86||TARGET_AMD64||TARGET_ARM64||TARGET_RISCV64 | ||
| returnCompareExchange(reflocation1,value,comparand); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is a self-referential "must expand" intrinsic now.
Implements Interlocked.CompareExchange/Exchange for byte/sbyte/short/ushort.
Uses an intrinsic on CoreCLR x64 and ARM64 and fallbacks for other platforms.
Fixes#64658.