v0.2.7 - fix Vulkan wrong-hits miscompile on NVIDIA + Windows GPU-watchdog crash
A correctness fix for the Vulkan backend, contributed by @K-Singh in #3 — thank you.
Vulkan backend computed wrong hits on NVIDIA (every share rejected)
Mining with the Vulkan build on an affected NVIDIA card, every share came back
Low difficulty share even though the miner reported a healthy hashrate and its
own local re-verification passed. NVIDIA's shader compiler miscompiled the
byte-array repack in genElement — the blake2b hash was correct, but rebuilding
the 64-bit dataset limbs from a staged uint8_t[] came back with corrupted high
bytes, so every dataset element was wrong and therefore every hit was wrong.
Nothing downstream could catch it: search() and verify() read the same wrong
table and agreed with each other. AMD (RDNA2), where this backend was developed,
compiles it correctly, which is why it hid.
The fix derives the limbs directly from the blake2b state words with byte swaps
and a mask, so there is no byte array for the compiler to get wrong. Verified on
an RTX 3070 Ti against the reference vectors, and this build still reproduces a
pinned mainnet block byte-for-byte on both backends (make test).
Windows GPU watchdog killed the dataset build
Building a 2.15 GB chunk in a single dispatch is ~2.1 s of GPU time, over
Windows' 2-second TDR limit — two runs in three died with VK_ERROR_DEVICE_LOST
before mining even started. The build is now sliced into ~130 ms dispatches; the
work and the result are identical, only the number of submissions changes.
CUDA is unaffected by both issues. No dev fee.