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
Этот коммит содержится в:
@@ -163,6 +163,12 @@ void HostQueue::append(Command& command) {
|
||||
queue_.enqueue(&command);
|
||||
}
|
||||
|
||||
|
||||
bool HostQueue::isEmpty() {
|
||||
// Get a snapshot of queue size
|
||||
return queue_.empty();
|
||||
}
|
||||
|
||||
DeviceQueue::~DeviceQueue() {
|
||||
delete virtualDevice_;
|
||||
ScopedLock lock(context().lock());
|
||||
|
||||
@@ -196,6 +196,9 @@ class HostQueue : public CommandQueue {
|
||||
//! Finish all queued commands
|
||||
void finish();
|
||||
|
||||
//! Check if hostQueue empty snapshot
|
||||
bool isEmpty();
|
||||
|
||||
//! Get virtual device for the current command queue
|
||||
device::VirtualDevice* vdev() const { return thread_.vdev(); }
|
||||
|
||||
|
||||
@@ -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_*/
|
||||
|
||||
Ссылка в новой задаче
Block a user