Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some more host device declarations to satisfy hipcc #667

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions device/common/include/traccc/device/impl/mutex.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@

namespace traccc::device {
template <typename T>
mutex<T>::mutex(T& p) : m_atomic(p) {}
TRACCC_HOST_DEVICE mutex<T>::mutex(T& p) : m_atomic(p) {}

template <typename T>
mutex<T>::mutex(const vecmem::device_atomic_ref<T>& r) : m_atomic(r) {}
TRACCC_HOST_DEVICE mutex<T>::mutex(const vecmem::device_atomic_ref<T>& r)
: m_atomic(r) {}

template <typename T>
void mutex<T>::lock() {
TRACCC_HOST_DEVICE void mutex<T>::lock() {
while (!try_lock())
;
}

template <typename T>
bool mutex<T>::try_lock() {
TRACCC_HOST_DEVICE bool mutex<T>::try_lock() {
assert(!m_is_locked);

T false_v = static_cast<T>(false);
Expand All @@ -40,7 +41,7 @@ bool mutex<T>::try_lock() {
}

template <typename T>
void mutex<T>::unlock() {
TRACCC_HOST_DEVICE void mutex<T>::unlock() {
assert(m_is_locked);

m_atomic.store(static_cast<T>(false), vecmem::memory_order::release);
Expand Down
Loading