Commit graph

30 commits

Author SHA1 Message Date
Nekotekina 3dd48a24ce atomic.cpp: remove tiny redundancy 2020-11-17 15:22:04 +03:00
Nekotekina badb3dc2dd atomic.cpp/threads: remove old wait callback
Add new wait callback which simply collects statistics.
Shift workarounds towards actual problem detection.
2020-11-14 18:16:27 +03:00
Nekotekina e48f160a29 atomic.cpp: continuation of fixing all-ones masks
Also added missing const noexcept.
2020-11-13 12:40:02 +03:00
Nekotekina 70761a4ef0 atomic.cpp: fix notification bug from few commits before
Make sure forced notification ignores mask comparison.
Also fix masks provided by smaller types to correct ones.
2020-11-12 05:01:44 +03:00
Nekotekina 7cd1e767be atomic.cpp: implement some atomic wait operations.
Instead of plain waiting while equal to some value,
it can be something like less, or greater, or even bitcount.
But it's a draft and untested. Hopefully doesn't break anything.
2020-11-11 20:46:37 +03:00
Nekotekina c047ab6147 atomic.cpp: waitable atomics got brutally rewritten
Hashtable increased and flatten, tree-alike extensions removed.
Some things simplified, so it can actually decrease perf a bit.
But most platforms shouldn't be affected.
Removed limit of 56 waiters per pointer.
Real limit now is about 65535.
2020-11-11 05:35:27 +03:00
Nekotekina 0bd989b118 atomic.cpp: allow waiting on multiple variables simultaneously
Arbitrary maximum set to 8, but really we need 2, maybe 3.
Added atomic_wait::list object for multi-waiting.
Added atomic_wait::get_unique_tsc just in case.
2020-11-07 18:18:02 +03:00
Nekotekina 1e45437498 Remove unused atomic with lock bit 2020-11-06 16:48:43 +03:00
Nekotekina 557f0c5a8a atomic.cpp: remove load() from notify functions
Only compare masks for overlap for second overload (with mask provided).
Explicit "new value" can be provided in new 3-arg overloads.
Also rename atomic_storage_futex -> atomic_wait_engine.
2020-11-06 04:44:31 +03:00
Nekotekina 5248240e10 atomic.cpp: improvements.
Reduced static memory amount for waitable atomics.
Allow notifier to skip notifications if wait/notify masks don't overlap.
Improve raw_notify to wake up the thread by its id, add thread_id arg.
Add optional mask argument to notify_one() and notify_all().
2020-11-05 05:51:43 +03:00
Eladash e791678dfc atomic.cpp: fix memory ordering loads and release stores 2020-10-28 20:45:13 +03:00
Nekotekina c491b73f3a SPU: improve accurate DMA
Remove vm::reservation_lock from it.
Use lock bits to prevent memory clobbering in GETLLAR.
Improve u128 for MSVC since it's used for bitlocking.
Improve 128 bit atomics for the same reason.
Improve vm::reservation_op and friends.
2020-10-28 03:47:41 +03:00
Nekotekina c50233cc92 atomics.cpp: add support for waiting on 128-bit atomics
Complementarily.
Also refactored to make waiting mask non-template arg.
2020-10-28 03:47:41 +03:00
Nekotekina 6806e3d5c7 atomic.cpp: implement notify callback
Notification can be very heavy, especially if we need to wake many threads.
Callback is set for cpu_thread in order to set wait flag accordingly.
2020-10-27 17:56:19 +03:00
Nekotekina d344701fd5 atomic.cpp: add sparse atomics
Set alignment as second template argument (typically cache line).
2020-10-26 01:15:31 +03:00
Nekotekina 98ab5d5ba2 atomic.hpp: modernize inline assembly for lock bts/btr/btc
Use flag output (requires clang 9+).
2020-04-28 18:05:32 +03:00
Nekotekina 17f3a114be Fat atomics: implement exchange() and compare_exchange()
Also includes compare_and_swap() and compare_and_swap_test().
Also includes fixes for load(), store(), and atomic_op().
2020-04-12 16:56:21 +03:00
Megamouse 078c31c1da Qt: fix lupdate warnings (used for translation) 2020-04-06 20:59:58 +02:00
Eladash 13820d6802 SPU debugger: Show channels data 2020-04-03 18:37:21 +03:00
Eladash ddf87864de atomic_t: Fix regression from #7489 2020-02-15 14:07:52 +03:00
Eladash eb8710d3c1 atomic.hpp: C-style casts cleanup 2020-02-15 11:37:13 +03:00
Nekotekina 7ea4eb0095 Atomic fix
Fix possible pointer arithmetic ops.
Fix fat atomics (currently unused).
2020-02-09 14:09:29 +03:00
Nekotekina c0f80cfe7a Use attributes for LIKELY/UNLIKELY
Remove LIKELY/UNLIKELY macro.
2020-02-05 10:42:34 +03:00
Nekotekina 59a0f810b9 Implement fat atomics
Atomics with embedded mutex bit.
2020-01-31 12:09:52 +03:00
Nekotekina 28eacc616a C-style cast cleanup III 2019-12-01 00:32:44 +03:00
Nekotekina 2fc8844315 atomic.hpp: add atomic wait mask support 2019-09-13 15:53:34 +03:00
Nekotekina aa99faa85d atomic.hpp: add timeout support 2019-09-10 19:25:39 +03:00
Nekotekina 1668d6ee1b atomic.hpp: implement wait callback interface
Will be used to wake up threads uniformly.
2019-09-10 17:43:04 +03:00
Nekotekina 4f22559ff0 Remove dumb overloads of atomic_op, fetch_op
And lf_queue::apply.
Fix inlining problem by passing F by value.
2019-08-14 20:28:34 +03:00
Nekotekina f63e89f9b4 Implement waitable atomics
Moved Atomic.h to util/atomic.hpp
List source files in CMakeLists.txt
2019-07-29 03:04:55 +03:00
Renamed from Utilities/Atomic.h (Browse further)