Skip to content

Commit

Permalink
Get rid of yielding at stupid times (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaAtulTewari authored May 19, 2024
1 parent ea6c177 commit a7a7397
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pando-rt/src/atomic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void atomicStoreImpl(GlobalPtr<T> ptr, const T value, [[maybe_unused]] std::memo
// local store

// yield to other hart and do atomic store
hartYield();
//hartYield();
auto dstNativePtr = static_cast<T*>(Memory::getNativeAddress(ptr.address));
__atomic_store_n(dstNativePtr, value, stdToGccMemOrder(order));

Expand Down Expand Up @@ -377,7 +377,7 @@ T atomicCompareExchangeImpl(GlobalPtr<T> ptr, T expected, const T desired) {
// local compare-exchange

// yield to other hart and do compare-exchange
hartYield();
//hartYield();
auto nativePtr = static_cast<T*>(Memory::getNativeAddress(ptr.address));
__atomic_compare_exchange_n(nativePtr, &expected, desired, weak, __ATOMIC_SEQ_CST,
__ATOMIC_SEQ_CST);
Expand Down Expand Up @@ -445,7 +445,7 @@ void atomicIncrementImpl(GlobalPtr<T> ptr, T value, [[maybe_unused]] std::memory
// local increment

// yield to other hart and do atomic increment
hartYield();
//hartYield();
auto nativePtr = static_cast<T*>(Memory::getNativeAddress(ptr.address));
__atomic_fetch_add(nativePtr, value, stdToGccMemOrder(order));

Expand Down Expand Up @@ -502,7 +502,7 @@ void atomicDecrementImpl(GlobalPtr<T> ptr, T value, [[maybe_unused]] std::memory
// local increment

// yield to other hart and do atomic decrement
hartYield();
//hartYield();
auto nativePtr = static_cast<T*>(Memory::getNativeAddress(ptr.address));
__atomic_fetch_sub(nativePtr, value, stdToGccMemOrder(order));

Expand Down Expand Up @@ -559,7 +559,7 @@ T atomicFetchAddImpl(GlobalPtr<T> ptr, T value, [[maybe_unused]] std::memory_ord
// local increment

// yield to other hart and do atomic fetch-add
hartYield();
//hartYield();
auto nativePtr = static_cast<T*>(Memory::getNativeAddress(ptr.address));
auto result = __atomic_fetch_add(nativePtr, value, stdToGccMemOrder(order));

Expand Down Expand Up @@ -619,7 +619,7 @@ T atomicFetchSubImpl(GlobalPtr<T> ptr, T value, [[maybe_unused]] std::memory_ord
// local increment

// yield to other hart and do atomic fetch-sub
hartYield();
//hartYield();
auto nativePtr = static_cast<T*>(Memory::getNativeAddress(ptr.address));
auto result = __atomic_fetch_sub(nativePtr, value, stdToGccMemOrder(order));

Expand Down Expand Up @@ -675,7 +675,7 @@ void atomicThreadFence([[maybe_unused]] std::memory_order order) {
#ifdef PANDO_RT_USE_BACKEND_PREP

// yield to other hart and issue fence
hartYield();
//hartYield();
std::atomic_thread_fence(order);

#else
Expand Down

0 comments on commit a7a7397

Please sign in to comment.