This commit is contained in:
Christopher Taylor 2017-06-05 01:33:37 -07:00
parent 9498f45011
commit 2ca6f0a818
2 changed files with 21 additions and 7 deletions

View File

@ -911,6 +911,8 @@ static void IFFT_DIT_Decoder_MT(
unsigned dist = 1, dist4 = 4; unsigned dist = 1, dist4 = 4;
for (; dist4 <= m; dist = dist4, dist4 <<= 2) for (; dist4 <= m; dist = dist4, dist4 <<= 2)
{ {
workBundle.Increment();
// For each set of dist*4 elements: // For each set of dist*4 elements:
for (unsigned r = 0; r < m_truncated; r += dist4) for (unsigned r = 0; r < m_truncated; r += dist4)
{ {
@ -923,6 +925,7 @@ static void IFFT_DIT_Decoder_MT(
for (unsigned i = r; i < i_end; ++i) for (unsigned i = r; i < i_end; ++i)
{ {
void** work_i = work + i; void** work_i = work + i;
workBundle.Increment();
PoolInstance->Dispatch([log_m01, log_m02, log_m23, bytes, work_i, dist, &workBundle]() { PoolInstance->Dispatch([log_m01, log_m02, log_m23, bytes, work_i, dist, &workBundle]() {
IFFT_DIT4( IFFT_DIT4(
bytes, bytes,
@ -933,17 +936,19 @@ static void IFFT_DIT_Decoder_MT(
log_m02); log_m02);
workBundle.OperationComplete(); workBundle.OperationComplete();
}); });
workBundle.Increment();
} }
} }
PoolInstance->Run(); PoolInstance->Run();
workBundle.OperationComplete();
workBundle.Join(); workBundle.Join();
} }
// If there is one layer left: // If there is one layer left:
if (dist < m) if (dist < m)
{ {
workBundle.Increment();
// Assuming that dist = m / 2 // Assuming that dist = m / 2
LEO_DEBUG_ASSERT(dist * 2 == m); LEO_DEBUG_ASSERT(dist * 2 == m);
@ -953,17 +958,18 @@ static void IFFT_DIT_Decoder_MT(
{ {
for (unsigned i = 0; i < dist; ++i) for (unsigned i = 0; i < dist; ++i)
{ {
workBundle.Increment();
PoolInstance->Dispatch([work, i, dist, bytes, &workBundle]() { PoolInstance->Dispatch([work, i, dist, bytes, &workBundle]() {
xor_mem(work[i + dist], work[i], bytes); xor_mem(work[i + dist], work[i], bytes);
workBundle.OperationComplete(); workBundle.OperationComplete();
}); });
workBundle.Increment();
} }
} }
else else
{ {
for (unsigned i = 0; i < dist; ++i) for (unsigned i = 0; i < dist; ++i)
{ {
workBundle.Increment();
PoolInstance->Dispatch([work, i, dist, log_m, bytes, &workBundle]() { PoolInstance->Dispatch([work, i, dist, log_m, bytes, &workBundle]() {
IFFT_DIT2( IFFT_DIT2(
work[i], work[i],
@ -972,11 +978,11 @@ static void IFFT_DIT_Decoder_MT(
bytes); bytes);
workBundle.OperationComplete(); workBundle.OperationComplete();
}); });
workBundle.Increment();
} }
} }
PoolInstance->Run(); PoolInstance->Run();
workBundle.OperationComplete();
workBundle.Join(); workBundle.Join();
} }
} }
@ -1602,6 +1608,8 @@ static void FFT_DIT_ErrorBits_MT(
unsigned dist4 = n, dist = n >> 2; unsigned dist4 = n, dist = n >> 2;
for (; dist != 0; dist4 = dist, dist >>= 2, mip_level -=2) for (; dist != 0; dist4 = dist, dist >>= 2, mip_level -=2)
{ {
workBundle.Increment();
// For each set of dist*4 elements: // For each set of dist*4 elements:
for (unsigned r = 0; r < n_truncated; r += dist4) for (unsigned r = 0; r < n_truncated; r += dist4)
{ {
@ -1617,6 +1625,7 @@ static void FFT_DIT_ErrorBits_MT(
{ {
void** work_i = work + i; void** work_i = work + i;
workBundle.Increment();
PoolInstance->Dispatch([bytes, &workBundle, work_i, dist, log_m01, log_m02, log_m23]() { PoolInstance->Dispatch([bytes, &workBundle, work_i, dist, log_m01, log_m02, log_m23]() {
FFT_DIT4( FFT_DIT4(
bytes, bytes,
@ -1627,19 +1636,22 @@ static void FFT_DIT_ErrorBits_MT(
log_m02); log_m02);
workBundle.OperationComplete(); workBundle.OperationComplete();
}); });
workBundle.Increment();
} }
} }
PoolInstance->Run(); PoolInstance->Run();
workBundle.OperationComplete();
workBundle.Join(); workBundle.Join();
} }
// If there is one layer left: // If there is one layer left:
if (dist4 == 2) if (dist4 == 2)
{ {
workBundle.Increment();
for (unsigned r = 0; r < n_truncated; r += 2) for (unsigned r = 0; r < n_truncated; r += 2)
{ {
workBundle.Increment();
PoolInstance->Dispatch([bytes, &workBundle, skewLUT, work, r]() { PoolInstance->Dispatch([bytes, &workBundle, skewLUT, work, r]() {
const ffe_t log_m = skewLUT[r + 1]; const ffe_t log_m = skewLUT[r + 1];
@ -1655,10 +1667,10 @@ static void FFT_DIT_ErrorBits_MT(
} }
workBundle.OperationComplete(); workBundle.OperationComplete();
}); });
workBundle.Increment();
} }
PoolInstance->Run(); PoolInstance->Run();
workBundle.OperationComplete();
workBundle.Join(); workBundle.Join();
} }
} }
@ -1779,17 +1791,19 @@ void ReedSolomonDecode(
else else
{ {
WorkBundle workBundle; WorkBundle workBundle;
workBundle.Increment();
for (unsigned j = i - width; j < i; ++j) for (unsigned j = i - width; j < i; ++j)
{ {
workBundle.Increment();
PoolInstance->Dispatch([work, j, width, &workBundle, buffer_bytes]() { PoolInstance->Dispatch([work, j, width, &workBundle, buffer_bytes]() {
xor_mem(work[j], work[j + width], buffer_bytes); xor_mem(work[j], work[j + width], buffer_bytes);
workBundle.OperationComplete(); workBundle.OperationComplete();
}); });
workBundle.Increment();
} }
PoolInstance->Run(); PoolInstance->Run();
workBundle.OperationComplete();
workBundle.Join(); workBundle.Join();
} }
} }

View File

@ -51,7 +51,7 @@ struct TestParameters
unsigned buffer_bytes = 64000; // multiple of 64 bytes unsigned buffer_bytes = 64000; // multiple of 64 bytes
unsigned loss_count = 32768; // some fraction of original_count unsigned loss_count = 32768; // some fraction of original_count
unsigned seed = 2; unsigned seed = 2;
bool multithreaded = false; bool multithreaded = true;
}; };
static const unsigned kLargeTrialCount = 1; static const unsigned kLargeTrialCount = 1;