Skip to content

CUDA: atomic race on best_key / best_score #1

@saasixx

Description

@saasixx

dev_best_score and dev_best_key are updated in two separate atomic operations inside the CUDA kernel (bruteforce.cu). There is no guarantee these two values are updated as an atomic pair, so a thread could read a best_score that belongs to a different best_key.

Impact: Low in practice — the brute-force covers the full keyspace so the correct key is always found. But the intermediate "best candidate" reported during search could briefly show an inconsistent key/score pair.

Fix: Use a single 64-bit atomic CAS to update both, or protect with a mutex/lock, or accept the minor inconsistency and document it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions