mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-02 21:00:16 -05:00
Use temporal stores for recovered data in SSSE3 and AVX2 REC1OF1 paths
This commit is contained in:
parent
6cd217ec2b
commit
b991d5e6c8
4 changed files with 110 additions and 24 deletions
56
raid/avx2.c
56
raid/avx2.c
|
|
@ -891,6 +891,54 @@ static __always_inline void raid_genX_avx2ext(int nd, size_t size, void **vv, in
|
|||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Recover one data failure using P with AVX2.
|
||||
*
|
||||
* The missing block is:
|
||||
*
|
||||
* Dx = P ^ D0 ^ ... ^ D(x-1) ^ D(x+1) ^ ... ^ Dn
|
||||
*
|
||||
* Use temporal stores because recovered data is consumed immediately by
|
||||
* validation and parity regeneration.
|
||||
*/
|
||||
static __always_inline void raid_rec1of1_avx2(int *id, int nd, size_t size, void **vv)
|
||||
{
|
||||
uint8_t **v = (uint8_t **)vv;
|
||||
uint8_t *src[RAID_DATA_MAX];
|
||||
uint8_t *p;
|
||||
uint8_t *pa;
|
||||
size_t i;
|
||||
int d, s, ns;
|
||||
|
||||
p = v[nd];
|
||||
pa = v[id[0]];
|
||||
|
||||
ns = 0;
|
||||
for (d = 0; d < nd; ++d) {
|
||||
if (d != id[0])
|
||||
src[ns++] = v[d];
|
||||
}
|
||||
|
||||
BUG_ON(ns != nd - 1);
|
||||
|
||||
raid_avx_begin();
|
||||
|
||||
for (i = 0; i < size; i += 64) {
|
||||
asm volatile ("vmovdqa %0,%%ymm0" : : "m" (p[i]));
|
||||
asm volatile ("vmovdqa %0,%%ymm1" : : "m" (p[i + 32]));
|
||||
|
||||
for (s = 0; s < ns; ++s) {
|
||||
asm volatile ("vpxor %0,%%ymm0,%%ymm0" : : "m" (src[s][i]));
|
||||
asm volatile ("vpxor %0,%%ymm1,%%ymm1" : : "m" (src[s][i + 32]));
|
||||
}
|
||||
|
||||
asm volatile ("vmovdqa %%ymm0,%0" : "=m" (pa[i]));
|
||||
asm volatile ("vmovdqa %%ymm1,%0" : "=m" (pa[i + 32]));
|
||||
}
|
||||
|
||||
raid_avx_end();
|
||||
}
|
||||
|
||||
/*
|
||||
* Recover one data failure using selected parity with AVX2.
|
||||
*
|
||||
|
|
@ -2695,9 +2743,9 @@ void raid_rec1_avx2(int nr, int *id, int *ip, int nd, size_t size, void **vv)
|
|||
{
|
||||
BUG_ON(nr != 1);
|
||||
|
||||
/* if recovering with P uses the delta function */
|
||||
/* if recovering with P, use a custom XOR-only path with temporal stores */
|
||||
if (ip[0] == 0) {
|
||||
raid_rec1of1(id, nd, size, vv);
|
||||
raid_rec1of1_avx2(id, nd, size, vv);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2760,9 +2808,9 @@ void raid_rec1_avx2ext(int nr, int *id, int *ip, int nd, size_t size, void **vv)
|
|||
{
|
||||
BUG_ON(nr != 1);
|
||||
|
||||
/* if recovering with P uses the delta function */
|
||||
/* if recovering with P, use a custom XOR-only path with temporal stores */
|
||||
if (ip[0] == 0) {
|
||||
raid_rec1of1(id, nd, size, vv);
|
||||
raid_rec1of1_avx2(id, nd, size, vv);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue