Implement simple SIMD intrinsics for AVX/AVX2#16287
Conversation
|
test Windows_NT x64 Checked jitincompletehwintrinsic test Windows_NT x86 Checked jitincompletehwintrinsic test Ubuntu x64 Checked jitincompletehwintrinsic test OSX10.12 x64 Checked jitincompletehwintrinsic |
|
@CarolEidt @tannergooding PTAL I removed the test cases of |
|
test OSX10.12 x64 Checked jitincompletehwintrinsic |
| ("SimpleBinOpTest.template", new string[] { "Avx", "Avx", "AndNot", "Single", "Vector256", "32", "(float)(random.NextDouble())", "((~BitConverter.SingleToInt32Bits(left[0])) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", "((~BitConverter.SingleToInt32Bits(left[i])) & BitConverter.SingleToInt32Bits(right[i])) != BitConverter.SingleToInt32Bits(result[i])"}), | ||
| ("SimpleTernOpTest.template",new string[] { "Avx", "Avx", "BlendVariable", "Double", "Vector256", "32", "(double)(random.NextDouble())", "(double)(((i % 2) == 0) ? -0.0E0 : 1.0E0)", "((BitConverter.DoubleToInt64Bits(thirdOp[0]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[0]) != BitConverter.DoubleToInt64Bits(result[0]) : BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", "((BitConverter.DoubleToInt64Bits(thirdOp[i]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[i]) != BitConverter.DoubleToInt64Bits(result[i]) : BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])"}), | ||
| ("SimpleTernOpTest.template",new string[] { "Avx", "Avx", "BlendVariable", "Single", "Vector256", "32", "(float)(random.NextDouble())", "(float)(((i % 2) == 0) ? -0.0E0 : 1.0E0)", "((BitConverter.SingleToInt32Bits(thirdOp[0]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[0]) != BitConverter.SingleToInt32Bits(result[0]) : BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", "((BitConverter.SingleToInt32Bits(thirdOp[i]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[i]) != BitConverter.SingleToInt32Bits(result[i]) : BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])"}), | ||
| ("SimpleUnOpTest.template", new string[] { "Avx", "Avx", "DuplicateEvenIndexed", "Double", "Vector256", "32", "(double)(random.NextDouble())", "BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", "(i % 2 == 0) ? (BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])) : (BitConverter.DoubleToInt64Bits(firstOp[i - 1]) != BitConverter.DoubleToInt64Bits(result[i]))"}), |
There was a problem hiding this comment.
nit: It would be useful to treat this code as a "table" and keep the individual columns aligned, where possible.
|
test OSX10.12 x64 Checked Innerloop Build and Test |
| ("SimpleBinOpTest.template", new string[] { "Avx", "Avx", "AndNot", "Double", "Vector256", "32", "(double)(random.NextDouble())", "((~BitConverter.DoubleToInt64Bits(left[0])) & BitConverter.DoubleToInt64Bits(right[0])) != BitConverter.DoubleToInt64Bits(result[0])", "((~BitConverter.DoubleToInt64Bits(left[i])) & BitConverter.DoubleToInt64Bits(right[i])) != BitConverter.DoubleToInt64Bits(result[i])"}), | ||
| ("SimpleBinOpTest.template", new string[] { "Avx", "Avx", "AndNot", "Single", "Vector256", "32", "(float)(random.NextDouble())", "((~BitConverter.SingleToInt32Bits(left[0])) & BitConverter.SingleToInt32Bits(right[0])) != BitConverter.SingleToInt32Bits(result[0])", "((~BitConverter.SingleToInt32Bits(left[i])) & BitConverter.SingleToInt32Bits(right[i])) != BitConverter.SingleToInt32Bits(result[i])"}), | ||
| ("SimpleTernOpTest.template",new string[] { "Avx", "Avx", "BlendVariable", "Double", "Vector256", "32", "(double)(random.NextDouble())", "(double)(((i % 2) == 0) ? -0.0E0 : 1.0E0)", "((BitConverter.DoubleToInt64Bits(thirdOp[0]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[0]) != BitConverter.DoubleToInt64Bits(result[0]) : BitConverter.DoubleToInt64Bits(firstOp[0]) != BitConverter.DoubleToInt64Bits(result[0])", "((BitConverter.DoubleToInt64Bits(thirdOp[i]) >> 63) & 1) == 1 ? BitConverter.DoubleToInt64Bits(secondOp[i]) != BitConverter.DoubleToInt64Bits(result[i]) : BitConverter.DoubleToInt64Bits(firstOp[i]) != BitConverter.DoubleToInt64Bits(result[i])"}), | ||
| ("SimpleTernOpTest.template",new string[] { "Avx", "Avx", "BlendVariable", "Single", "Vector256", "32", "(float)(random.NextDouble())", "(float)(((i % 2) == 0) ? -0.0E0 : 1.0E0)", "((BitConverter.SingleToInt32Bits(thirdOp[0]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[0]) != BitConverter.SingleToInt32Bits(result[0]) : BitConverter.SingleToInt32Bits(firstOp[0]) != BitConverter.SingleToInt32Bits(result[0])", "((BitConverter.SingleToInt32Bits(thirdOp[i]) >> 31) & 1) == 1 ? BitConverter.SingleToInt32Bits(secondOp[i]) != BitConverter.SingleToInt32Bits(result[i]) : BitConverter.SingleToInt32Bits(firstOp[i]) != BitConverter.SingleToInt32Bits(result[i])"}), |
There was a problem hiding this comment.
Why -0.0E0 and -1.0E0 instead of just -0.0 and 1.0?
|
|
||
| namespace JIT.HardwareIntrinsics.X86 | ||
| { | ||
| public unsafe struct SimpleTernaryOpTest__DataTable<T> : IDisposable where T : struct |
There was a problem hiding this comment.
I had originally kept the unaligned data tables around because not all the tests had been moved over to use the templates (and therefore couldn't be easily switch to using he aligned data tables).
We might not need/want to add new unaligned data tables and instead should probably just add new properties to the aligned table to get an unaligned address (for the scenarios where we need to explicitly test it).
There was a problem hiding this comment.
We might not need/want to add new unaligned data tables and instead should probably just add new properties to the aligned table to get an unaligned address (for the scenarios where we need to explicitly test it).
In which case it might make sense to remove the "aligned" from the name, as it would then just become the "data table"?
There was a problem hiding this comment.
as it would then just become the "data table"?
Agree.
There was a problem hiding this comment.
Yes. As said above, the primary reason the original ones were kept is because not all tests could be moved to the template quite yet (my PR originally just modified DataTable to support alignment and then later had to be split into two separate tables).
tannergooding
left a comment
There was a problem hiding this comment.
This looks good to me, overall. Just a couple of questions/nits.
|
|
||
| namespace JIT.HardwareIntrinsics.X86 | ||
| { | ||
| public unsafe struct SimpleTernaryOpTest__DataTable<T> : IDisposable where T : struct |
There was a problem hiding this comment.
We might not need/want to add new unaligned data tables and instead should probably just add new properties to the aligned table to get an unaligned address (for the scenarios where we need to explicitly test it).
In which case it might make sense to remove the "aligned" from the name, as it would then just become the "data table"?
|
test Windows_NT x64 Checked jitincompletehwintrinsic test Windows_NT x86 Checked jitincompletehwintrinsic test Ubuntu x64 Checked jitincompletehwintrinsic test OSX10.12 x64 Checked jitincompletehwintrinsic |
|
test Windows_NT x86 Checked jitx86hwintrinsicnoavx |
|
All feedback addressed and all tests passed. @tannergooding Could you please merge this PR? |
This is the first part of https://github.com/dotnet/coreclr/issues/16246
close https://github.com/dotnet/coreclr/issues/16244