Closed teppanyakii closed 6 months ago
This false alarm is expected, because GPUVerify only supports barrier-based synchronisation. Limited support for atomics is provided, as described in this paper:
https://www.doc.ic.ac.uk/~afd/homepages/papers/pdfs/2014/NFM.pdf
However, from what I recall this only supports simple use cases where atomic counters are used to access disjoint memory locations. In your case, the lock is being used to protect a particular location in shared memory, and that is beyond the scope of the tool.
While I closed the issue, happy to discuss more if you have questions (in which case just reopen it).
Hello, The following is a simple implementation of a CAS-lock using opencl-1.2 (in this outdated version, the CAS returns the old value).
Usually, the CAS would be in a loop. I created this version with an if since if the kernel contains loops there is a high chance that they may be false positives arising due to limitations of the tool invariant inference procedures. The lock is only released if it was acquired (otherwise this could cause problems with more than 2 threads). Unfortunately, gpu-verify still reports a race. Is this still a false alarm?