-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Support recognizing Blend
as commutative
#82365
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak Issue DetailsWe don't currently track Support should be added to treat this as commutative which really just entails inverting the constant (e.g.
|
I'm trying to grok this request (as I know nothing about Avx) In the process, I noticed this code in the /src/tests/JIT/HardwareIntrinsics/X86/Avx1/Blend.cs test code at line 29-36, that looks wrong to me: // SDDD SDDD
var vf3 = Avx.Blend(vf1, vf2, 1);
Unsafe.Write(floatTable.outArrayPtr, vf3);
if (!floatTable.CheckResult((x, y, z) => (z[0] == y[0]) && (z[1] == x[1]) &&
(z[2] == x[2]) && (z[3] == x[3]) &&
(z[4] == x[4]) && (z[5] == x[5]) &&
(z[6] == x[6]) && (z[7] == x[7]))) I think the pattern in the comment is supposed to mean that we're expecting the By that reading (which I may be wrong about), the test on line 35 against This is not area of any expertise at all given this is my very first look at AVX at any level, but the code at line 83-90 looks to match my expectation in that S in the comment means compare to // SDSD SDSD
vf3 = Avx.Blend(vf1, vf2, 85);
Unsafe.Write(floatTable.outArrayPtr, vf3);
if (!floatTable.CheckResult((x, y, z) => (z[0] == y[0]) && (z[1] == x[1]) &&
(z[2] == y[2]) && (z[3] == x[3]) &&
(z[4] == y[4]) && (z[5] == x[5]) &&
(z[6] == y[6]) && (z[7] == x[7]))) If I'm absolutely nuts, please let me know, I don't want to start down the road with the wrong understanding. |
@tannergooding, could you guide @IDisposable for this? |
We won't be able to land this in .NET 8; but it can be done at any point in the future.
The comment is wrong, the behavior is:
So it is not done as 1 operation repeated across 2x128-bit lanes, but rather as 1x256-bit lane instead. |
Excellent, I'll tackle this for the next release. Thanks for the confirmation @tannergooding |
We don't currently track
Blend
as commutative and so we miss an opportunity to ensure that "memory operands" always appear on the RHS: SixLabors/ImageSharp#2359 (comment)Support should be added to treat this as commutative which really just entails inverting the constant (e.g.
Blend(x, y, 0b0111_0111)
is equivalent toBlend(y, x, 0b1000_1000)
).There are actually a few operations this applies to that involve
two inputs
+control mask
. Not all of them are as trivially as inverting the constant, however.The text was updated successfully, but these errors were encountered: