Skip to content

Commit

Permalink
Shuffle lane->dag data mapping
Browse files Browse the repository at this point in the history
Based on suggestion from PR #13
  • Loading branch information
ifdefelse committed Nov 16, 2018
1 parent b45389b commit e9745a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,12 @@ void progPowLoop(
// Lanes can execute in parallel and will be convergent
for (int l = 0; l < PROGPOW_LANES; l++)
{
// global load to sequential locations
// global load to the 256 byte DAG entry
// every lane can access every part of the entry
uint32_t data_g[PROGPOW_DAG_LOADS];
uint32_t offset_l = offset_g * PROGPOW_LANES + (l ^ loop) % PROGPOW_LANES;
for (int i = 0; i < PROGPOW_DAG_LOADS; i++)
data_g[i] = dag[(offset_g*PROGPOW_LANES + l)*PROGPOW_DAG_LOADS + i];
data_g[i] = dag[offset_l * PROGPOW_DAG_LOADS + i];
// initialize the seed and mix destination sequence
int mix_seq_dst[PROGPOW_REGS];
Expand Down
2 changes: 1 addition & 1 deletion libprogpow/ProgPow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ std::string ProgPow::getKern(uint64_t block_number, kernel_t kern)
ret << "offset = share[group_id];\n";
}
ret << "offset %= PROGPOW_DAG_ELEMENTS;\n";
ret << "offset = offset * PROGPOW_LANES + lane_id;\n";
ret << "offset = offset * PROGPOW_LANES + (lane_id ^ loop) % PROGPOW_LANES;\n";
ret << "data_dag = g_dag[offset];\n";
ret << "// hack to prevent compiler from reordering LD and usage\n";
if (kern == KERNEL_CUDA)
Expand Down

0 comments on commit e9745a4

Please sign in to comment.