[libomptarget] Implement locks for amdgcn
authorJon Chesterfield <jonathanchesterfield@gmail.com>
Thu, 5 Mar 2020 20:25:30 +0000 (20:25 +0000)
committerJon Chesterfield <jonathanchesterfield@gmail.com>
Thu, 5 Mar 2020 20:25:31 +0000 (20:25 +0000)
commit221ada654b28a524d01dc70ec16d38e0f2484f78
tree2ae9844d64956b8ae62a42c3005a36f1293d83db
parentc359f9537ffb17c4f40a933980ddb515d7ee923b
[libomptarget] Implement locks for amdgcn

Summary:
[libomptarget] Implement locks for amdgcn

The nvptx implementation deadlocks on amdgcn. atomic_cas with multiple
active lanes can deadlock - if one lane succeeds, all the others are locked
out. The set_lock implementation therefore runs on a single lane.

Also uses a sleep intrinsic instead of the system clock for a probably
minor performance improvement. The unset/test implementations may be revised
later, based on code size / performance or similar concerns.

This implements the lock at a per-wavefront scope. That's not strictly as
specified, since openmp describes locks in terms of threads. I think the
nvptx implementation provides true per-thread locking on volta and the same
per-warp locking on other architectures.

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: jdoerfert

Subscribers: jvesely, mgorny, jfb, openmp-commits

Tags: #openmp

Differential Revision: https://reviews.llvm.org/D75546
openmp/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
openmp/libomptarget/deviceRTLs/amdgcn/src/amdgcn_locks.hip [new file with mode: 0644]