-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use SIMD in matrix multiplication #8
Comments
packed_simd will be deprecated and portable_simd will be the mainstream.
|
I am sure about the reason but core_simd doesn't support u8x64 vector. rust-lang/portable-simd#80 (comment)
Here is the error. 1.57 nightly + current master c2f59483f96cf1ab1e92cf10e0f9094432a8374c
But I think twice and found depending on AVX512 might not be a good way. |
fn gather_simd(index: &[u8;54], v: &[u8;54]) -> [u8;54] {
let mut idx0 = [55;32];
let mut idx1 = [55;32];
for i in 0..32 {
idx0[i] = index[i] as usize;
}
for i in 0..22 {
idx1[i] = index[i+32] as usize;
}
let idx0 = Simd::from_array(idx0);
let idx1 = Simd::from_array(idx1);
let res0 = Simd::gather_or_default(v, idx0);
let res1 = Simd::gather_or_default(v, idx1);
let mut out = [0;54];
for i in 0..32 {
out[i] = res0[i];
}
for i in 0..22 {
out[i+32] = res1[i];
}
out
} The initial impl is shit and x70 slower than before. But hope is that if 512bit vector is supported. We can remove the copies in both directions (because we can use Simd vector as |
I think portable-simd will improve multiplication because it is gather operation.
and portable_simd has one.
It looks quite an early stage but let's trust it.
The text was updated successfully, but these errors were encountered: