Add ComplexDotProduct to SVE microbenchmark#5045
Open
ylpoonlg wants to merge 4 commits intodotnet:mainfrom
Open
Add ComplexDotProduct to SVE microbenchmark#5045ylpoonlg wants to merge 4 commits intodotnet:mainfrom
ylpoonlg wants to merge 4 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Arm64 SVE microbenchmark to measure complex dot-product implementations across scalar, AdvSimd (Vector128), SVE, and SVE2 paths, and wires it into the microbenchmark project with TFM gating for newer intrinsics.
Changes:
- Introduce
ComplexDotProductSVE microbenchmark with Scalar, Vector128, SVE, and SVE2 implementations. - Add MSBuild conditional to exclude this benchmark for target frameworks older than
net10.0(due to SVE2 API usage).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/benchmarks/micro/sve/ComplexDotProduct.cs |
New benchmark implementing and verifying multiple complex dot-product variants (Scalar/AdvSimd/SVE/SVE2). |
src/benchmarks/micro/MicroBenchmarks.csproj |
Excludes the new benchmark when building for TFMs < net10.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| { | ||
| public Config() | ||
| { | ||
| AddFilter(new SimpleFilter(_ => Sve2.IsSupported)); |
Comment on lines
+257
to
+260
| <!-- Remove Sve2 microbenchmarks when running on net versions < 10.0 --> | ||
| <ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net10.0'))"> | ||
| <Compile Remove="sve\ComplexDotProduct.cs" /> | ||
| </ItemGroup> |
| int[] scalar = (int[])_output.Clone(); | ||
|
|
||
| // Check that the result is the same as scalar. | ||
| for (int i = 0; i < Size; i++) |
Comment on lines
+93
to
+113
| // Helper function for calculating dot product. | ||
| Func<Vector128<int>, Vector128<int>, Vector128<int>, Vector128<int>, | ||
| Vector128<int>, Vector128<int>, Vector128<int>, Vector128<int>, | ||
| (Vector128<int>, Vector128<int>)> dotProduct = (a0, a1, a2, a3, b0, b1, b2, b3) => { | ||
|
|
||
| Vector128<int> cr = Vector128<int>.Zero; | ||
| Vector128<int> ci = Vector128<int>.Zero; | ||
|
|
||
| // Compute dot product of the real part. | ||
| cr = AdvSimd.MultiplyAdd(cr, a0, b0); | ||
| cr = AdvSimd.MultiplySubtract(cr, a1, b1); | ||
| cr = AdvSimd.MultiplyAdd(cr, a2, b2); | ||
| cr = AdvSimd.MultiplySubtract(cr, a3, b3); | ||
| // Compute dot product of the imaginary part. | ||
| ci = AdvSimd.MultiplyAdd(ci, a0, b1); | ||
| ci = AdvSimd.MultiplyAdd(ci, a1, b0); | ||
| ci = AdvSimd.MultiplyAdd(ci, a2, b3); | ||
| ci = AdvSimd.MultiplyAdd(ci, a3, b2); | ||
|
|
||
| return (cr, ci); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Performance Results
Run on Neoverse-V2
cc @dotnet/arm64-contrib @SwapnilGaikwad @LoopedBard3