KawPow: optimized CPU share verification
- 2 times faster CPU share verification (11 -> 5 ms) - 1.5 times faster light cache initialization
This commit is contained in:
parent
03e9797b92
commit
5724d8beb6
4 changed files with 61 additions and 38 deletions
|
@ -92,9 +92,9 @@ bool KPCache::init(uint32_t epoch)
|
|||
const uint32_t b = (cache_nodes * (i + 1)) / n;
|
||||
|
||||
threads.emplace_back([this, a, b, cache_nodes, &cache]() {
|
||||
for (uint32_t j = a; j < b; ++j) {
|
||||
ethash_calculate_dag_item_opt(((node*)m_DAGCache.data()) + j, j, num_dataset_parents, &cache);
|
||||
}
|
||||
uint32_t j = a;
|
||||
for (; j + 4 <= b; j += 4) ethash_calculate_dag_item4_opt(((node*)m_DAGCache.data()) + j, j, num_dataset_parents, &cache);
|
||||
for (; j < b; ++j) ethash_calculate_dag_item_opt(((node*)m_DAGCache.data()) + j, j, num_dataset_parents, &cache);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -285,10 +285,7 @@ void KPHash::calculate(const KPCache& light_cache, uint32_t block_height, const
|
|||
uint32_t item_index = (mix[r % LANES][0] % num_items) * 4;
|
||||
|
||||
node item[4];
|
||||
ethash_calculate_dag_item_opt(item + 0, item_index + 0, KPCache::num_dataset_parents, &cache);
|
||||
ethash_calculate_dag_item_opt(item + 1, item_index + 1, KPCache::num_dataset_parents, &cache);
|
||||
ethash_calculate_dag_item_opt(item + 2, item_index + 2, KPCache::num_dataset_parents, &cache);
|
||||
ethash_calculate_dag_item_opt(item + 3, item_index + 3, KPCache::num_dataset_parents, &cache);
|
||||
ethash_calculate_dag_item4_opt(item, item_index, KPCache::num_dataset_parents, &cache);
|
||||
|
||||
uint32_t dst_counter = 0;
|
||||
uint32_t src_counter = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue