-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix size used for vectorization check in BitArray (#111558) #111564
Conversation
@@ -885,7 +885,7 @@ public unsafe void CopyTo(Array array, int index) | |||
} | |||
} | |||
} | |||
else if (Ssse3.IsSupported && ((uint)m_length >= Vector512<byte>.Count * 2u)) | |||
else if (Ssse3.IsSupported && ((uint)m_length >= Vector128<byte>.Count * 2u)) |
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.
I think while you're on it, we can also replace various Sse2.And with just plain operators, e.g.
Vector128<byte> extractedLower = Sse2.And(shuffledLower, bitMask128);
to
Vector128<byte> extractedLower = shuffledLower & bitMask128;
but that's optional
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.
Thanks
Run a quick perf test that shows this is a perf improvement for all affected sizes? |
FWIW this would only affect pre-AVX2 X86 CPUs (or NAOT as I was informed we don't do Avx2 checks :/) else if (Avx2.IsSupported && (uint)m_length >= Vector256<byte>.Count)
...
else if (Ssse3.IsSupported && ((uint)m_length >= Vector128<byte>.Count * 2u))
...
else if (AdvSimd.Arm64.IsSupported) |
f5a0bbf
to
b3e4f10
Compare
b3e4f10
to
f217968
Compare
Seems like the test failures are all unrelated to this PR. Is there anything else I should do? @stephentoub |
Let's merge and retrigger to see what happens. |
@eiriktsarpalis I still do not think the remaining failures are related as they seem to be timeouts. Are they expected to pass? Let me know what else I can do! Thanks |
@EgorBot -intel --envvars DOTNET_EnableAVX=0
|
@jkotas |
@EgorBot -intel --envvars DOTNET_EnableAVX:0
|
This change improves the perf 3x-10x for the affected sizes (on machines without AVX): EgorBot/runtime-utils#296 (comment) |
Right, the failures are unrelated. |
* main: (71 commits) Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20250212.3 (dotnet#112626) JIT: Unify struct arg morphing (dotnet#112612) Enable `SA1015`: Closing generic bracket should not be followed by a space (dotnet#112597) Clean up normalizeLocale for mono browser target (dotnet#112575) SPMI: Ensure proper zero extension for isObjectImmutable and friends (dotnet#112617) Quote --version-scripts path (dotnet#112603) Remove incompatible API from PKCS netstandard2.0 lib [main] Update dependencies from dotnet/emsdk (dotnet#112393) Avoid `Unsafe.As` in `RangeCharSearchValues` (dotnet#112606) Fixed the issue of incorrect return value of PalVirtualAlloc (dotnet#112579) Fix size used for vectorization check in BitArray (dotnet#111558) (dotnet#111564) Fix build of windows arm64 crossdac (dotnet#112553) Simplify `ShuffleTakeIterator.GetCount` (dotnet#112593) Fix VS div-by-0 in DacEnumerableHashTable code (dotnet#112542) R2RDump: normalize GC info totalInterruptibleLength (dotnet#112003) Fix alignment padding and add test for saving managed resources (dotnet#110915) Adds `ccmp` logic into emitter backend. (dotnet#112153) Disable AVX10.2 by default (dotnet#112572) Outbox AesGcm in to Microsoft.Bcl.Cryptography Make test `IUnknown` conforming (dotnet#112566) ...
This PR resolves #111558 by correcting the vector size used in the vectorization check within BitArray.