P4 to Git Change 1082378 by lmoriche@lmoriche_opencl_dev on 2014/09/29 17:08:11

ECR #304775 - Replace amd::Atomic with std::atomic

	Pre-checkin: http://ocltc.amd.com:8111/viewModification.html?modId=40639&personal=true&buildTypeId=&tab=vcsModificationBuilds&show_all_builds=true

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/os/os_posix.cpp#38 edit
... //depot/stg/opencl/drivers/opencl/runtime/os/os_win32.cpp#40 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#64 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#73 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#108 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#86 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/runtime.cpp#33 edit
... //depot/stg/opencl/drivers/opencl/runtime/thread/monitor.hpp#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/thread/semaphore.cpp#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/thread/semaphore.hpp#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/util.hpp#10 edit
This commit is contained in:
foreman
2014-09-29 17:38:55 -04:00
parent ad5a7696d1
commit 90c15d9f06
11 changed files with 78 additions and 158 deletions
+1 -90
View File
@@ -6,8 +6,8 @@
#define UTIL_HPP_
#include "top.hpp"
#include "thread/atomic.hpp"
#include <atomic>
#include <string>
namespace amd {
@@ -187,95 +187,6 @@ inline bool isMultipleOf(T* value, size_t alignment)
return isMultipleOf(ptr, alignment);
}
template <class T, class AllocClass = HeapObject>
struct SimplyLinkedNode : public AllocClass
{
typedef SimplyLinkedNode<T, AllocClass> Node;
protected:
Atomic<Node*> next_; /*!< \brief The next element. */
T volatile item_;
public:
//! \brief Return the next element in the linked-list.
Node* next() const { return next_; }
//! \brief Return the item.
T item() const { return item_; }
//! \brief Set the next element pointer.
void setNext(Node* next) { next_ = next; }
//! \brief Set the item.
void setItem(T item) { item_ = item; }
//! \brief Swap the next element pointer.
Node* swapNext(Node* next) { return next_.swap(next); }
//! \brief Compare and set the next element pointer.
bool compareAndSetNext(Node* compare, Node* next)
{
return next_.compareAndSet(compare, next);
}
};
/* For the implementation of a doubly-linked list, check:
* Lock-Free and Practical
* Deques and Doubly Linked
* Lists using Single-Word
* Compare-And-Swap
*
* Hakan Sundell, Philippas Tsigas
* Department of Computing Science
* Chalmers Univ. of Technol. and Goteborg Univ.
*/
template <class T, class AllocClass = HeapObject>
struct DoublyLinkedNode
{
typedef SimplyLinkedNode<T, AllocClass> Node;
protected:
Atomic<Node*> prev_; //!< The previous element.
Atomic<Node*> next_; //!< The next element.
T volatile item_;
public:
//! \brief Return the previous element in the linked-list.
Node* prev() const { return prev_; }
//! \brief Return the next element in the linked-list.
Node* next() const { return next_; }
//! \brief Return the item.
T item() const { return item_; }
//! \brief Set the previous element pointer.
void setPrev(Node* prev) { prev_ = prev; }
//! \brief Set the next element pointer.
void setNext(Node* next) { next_ = next; }
//! \brief Set the item.
void setItem(T item) { item_ = item; }
//! \brief Swap the previous element pointer.
Node* swapPrev(Node* prev)
{
return prev_.swap(prev);
}
//! \brief Swap the next element pointer.
Node* swapNext( Node* next)
{
return next_.swap(next);
}
//! \brief Compare and set the previous element pointer.
bool compareAndSetPrev(Node* compare, Node* prev)
{
return prev_.compareAndSet(compare, prev, false, false);
}
//! \brief Compare and set the next element pointer.
bool compareAndSetNext(Node* compare, Node* next)
{
return next_.compareAndSet(compare, next, false, false);
}
};
template <class Reference, class Value>
struct DeviceMap {
Reference ref_;