P4 to Git Change 1602601 by skudchad@skudchad_test2_win_opencl on 2018/09/06 15:01:00

SWDEV-145570 - [HIP] Implement hipStreamAddCallback and hipStreamQuery

	ReviewBoardURL = http://ocltc.amd.com/reviews/r/15749/diff/

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_stream.cpp#13 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#27 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.hpp#19 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/concurrent.hpp#9 edit
This commit is contained in:
foreman
2018-09-06 15:21:28 -04:00
parent 27d67ac268
commit d305283689
3 changed files with 28 additions and 0 deletions
+19
View File
@@ -90,6 +90,9 @@ template <typename T, int N = 5> class ConcurrentLinkedQueue : public HeapObject
//! \brief Dequeue an element from this queue.
inline T dequeue();
//! \brief Check if queue is empty
inline bool empty();
};
/*@}*/
@@ -169,6 +172,22 @@ template <typename T, int N> inline T ConcurrentLinkedQueue<T, N>::dequeue() {
}
}
template <typename T, int N> inline bool ConcurrentLinkedQueue<T, N>::empty() {
for (;;) {
typename Node::Ptr head = head_.load(std::memory_order_acquire);
typename Node::Ptr tail = tail_.load(std::memory_order_acquire);
typename Node::Ptr next = head->ptr()->next_.load(std::memory_order_acquire);
if (likely(head == head_.load(std::memory_order_acquire))) {
if (head->ptr() == tail->ptr()) {
if (next->ptr() == NULL) {
return true;
}
}
return false;
}
}
}
} // namespace amd
#endif /*CONCURRENT_HPP_*/