From f37e70e1b1474789567dde09daab13b8d4ea4eae Mon Sep 17 00:00:00 2001 From: rob thijssen Date: Sun, 14 Sep 2025 15:31:46 +0300 Subject: [PATCH] Fix nonce advancement logic and update CUDA miner env settings --- crates/engine-gpu-cuda/src/lib.rs | 7 +++++-- examples/.env/cuda-miner-3060-debug.env | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/engine-gpu-cuda/src/lib.rs b/crates/engine-gpu-cuda/src/lib.rs index 7f3a538..658c837 100644 --- a/crates/engine-gpu-cuda/src/lib.rs +++ b/crates/engine-gpu-cuda/src/lib.rs @@ -719,8 +719,9 @@ impl CudaEngine { } // Advance by covered window and continue to next batch, honoring cancel between batches let attempts = active_threads * (effective_iters as u64); + // Advance by attempted nonces this batch; CPU handled +1 before the G2 loop hash_count = hash_count.saturating_add(attempts); - current = current.saturating_add(U512::from(1u64 + attempts)); + current = current.saturating_add(U512::from(attempts)); if cancel.load(AtomicOrdering::Relaxed) { break; } @@ -807,7 +808,9 @@ impl CudaEngine { } } - // Not found in this window (no additional advance; already advanced per batch) + // Not found in this window + // Advance by the single CPU step consumed at the beginning of this outer loop iteration + current = current.saturating_add(U512::from(1u64)); continue; } else { // G1 launch: computes y for (current + t + 1) for each thread t in [0, num_threads) diff --git a/examples/.env/cuda-miner-3060-debug.env b/examples/.env/cuda-miner-3060-debug.env index 046cf01..50c9824 100644 --- a/examples/.env/cuda-miner-3060-debug.env +++ b/examples/.env/cuda-miner-3060-debug.env @@ -5,8 +5,9 @@ MINER_CUDA_IMAGE=ptx MINER_CUDA_ITERS=8192 MINER_CUDA_THREADS=4096 MINER_CUDA_BLOCK_DIM=256 -MINER_CUDA_BATCHES=32 +MINER_CUDA_BATCHES=4 MINER_CUDA_SAMPLER=1 -MINER_CUDA_DESIRED_ITERS=1024 +MINER_CUDA_DESIRED_ITERS=64 MINER_CUDA_VERIFY=2048 +MINER_CUDA_FORCE_WIN=0 RUST_LOG=miner=debug