From 1829aa5823f4f40889e8ec6eaab8737544374a0c Mon Sep 17 00:00:00 2001 From: Marc Bevand Date: Wed, 14 Nov 2018 15:33:26 -0800 Subject: [PATCH] Change DAG read offsets every iteration to prevent ASIC optimization of memory subsystem --- README.md | 2 +- libprogpow/ProgPow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a1546f6e1..163b91bdc 100644 --- a/README.md +++ b/README.md @@ -332,7 +332,7 @@ void progPowLoop( // global load to sequential locations uint32_t data_g[PROGPOW_DAG_LOADS]; 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_g*PROGPOW_LANES + (l + loop) % 16)*PROGPOW_DAG_LOADS + i]; // initialize the seed and mix destination sequence int mix_seq_dst[PROGPOW_REGS]; diff --git a/libprogpow/ProgPow.cpp b/libprogpow/ProgPow.cpp index b55b14e36..303629bdf 100644 --- a/libprogpow/ProgPow.cpp +++ b/libprogpow/ProgPow.cpp @@ -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) % 16;\n"; ret << "data_dag = g_dag[offset];\n"; ret << "// hack to prevent compiler from reordering LD and usage\n"; if (kern == KERNEL_CUDA)