x86: add avx512 permvar.qi shims#5156
Conversation
There was a problem hiding this comment.
I don't have the hardware to validate them
In case it is useful, Intel SDE can be used for running AVX512 on unsupported hardware, it is even used in CI here as an example.
GitHub Actions runners are also a mix of those that support AVX512 and those that do not. So it might be non-determinstically tested that way too.
| #[rustfmt::skip] | ||
| let a = _mm256_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | ||
| 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31); | ||
| let r = _mm256_permutexvar_epi8(idx, a); |
There was a problem hiding this comment.
So the idx vector is all 1s? That doesn't seem like it tests very much...
There was a problem hiding this comment.
Right, many such cases...
Well, I remembered that we have an avx512 machine at work that I can ssh into, so I've made some tests with more arbitrary input and validated them on actual hardware.
Unfortunately stdarch CI is messed up right now, so I can't additionally test it there rust-lang/stdarch#2181.
| unsafe fn test_mm_permutexvar_epi8() { | ||
| let idx = _mm_set1_epi8(1); | ||
| let a = _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); | ||
| // Only the lower 4 bits of the index are used, the rest is masked off. |
There was a problem hiding this comment.
Please have a u8::MAX in each of these to make it obvious that we are testing the masking.
|
Thanks for the real HW test. :) You can also already squash the commits. |
|
Reminder, once the PR becomes ready for a review, use |
81c681e to
8b18dc8
Compare
cc rust-lang/portable-simd#524
These instructions are used by
portable-simd'sswizzle_dyn.The tests are taken straight from
stdarch, I don't have the hardware to validate them. But the implementation is using existing logic so hopefully that is sufficient?