Commit graph

553 commits

Author SHA1 Message Date
Eladash f03d4cf8fd PPU: Optimize reservation load for success 2020-10-30 10:49:47 +02:00
Nekotekina 3419d15878 vm: add extern clear_range_locks function
Allows to wait for range locks to clear for specified range.
vm::range_lock now monitors specified reservation lock as well.
2020-10-30 07:58:16 +03:00
Nekotekina 0da24f21d6 CPU: improve cpu_thread::suspend_all for cache efficiency (TSX)
Add prefetch hint list parameter.
Workloads may be executed by another thread on another CPU core.
It means they may benefit from directly prefetching the data as hinted.
Also implement mov_rdata_nt, for "streaming" data from such workloads.
2020-10-30 05:22:09 +03:00
Nekotekina 4378a09867 PPU: reload old data on STCX failure
In 128-byte reservation mode, it can reload the whole cache line.
2020-10-30 02:58:39 +03:00
Nekotekina fb24b06a5d PPU: add LARX perf counter
Also refactor ppu_store_reservation a bit.
2020-10-30 02:58:39 +03:00
Nekotekina 8ce0819b42 SPU: add stx/ftx counters
Just count pure transaction successes and failures.
2020-10-29 18:57:57 +03:00
Nekotekina 688a456642 TSX tweaks
Allow to do more in first-chance transactions.
Give PUTLLC +1 priority (minor change).
2020-10-29 18:57:57 +03:00
Nekotekina 280958ee74 Revert "TSX: adjust transaction logic"
This reverts commit ff550b5c3c.
2020-10-28 21:59:12 +03:00
Nekotekina ff550b5c3c TSX: adjust transaction logic
Allow more in first-chance transactions.
Allow abandonment of PUTLLC as in original path.
Make PUTLLUC unconditionally shared-locked.
Give PUTLLC +1 priority (minor change).
2020-10-28 14:00:09 +03:00
Nekotekina d6daa0d05b Fix cpu_flag::temp, make sure it removes cpu_flag::wait 2020-10-28 14:00:09 +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 f1e66085cd Fixup for cpu_flag::temp
Wrong check_state() result was triggering assertion.
2020-10-26 01:18:26 +03:00
Nekotekina 130a0ef20e Implement cpu_flag::temp flag
Accompanies wait flag, indicating that it was set in limited conditions.
Such condition don't allow thread to terminate after its removal.
2020-10-25 21:48:20 +03:00
kd-11 18ca3ed449 rsx: Block-level reservation access 2020-10-25 20:21:04 +03:00
Nekotekina dc8252bb9f Remove XABORT in PPU/SPU transactions.
It's expensive for unknown reason. Simply XEND is usually much cheaper.
Add some minor improvements. Use g_sudo_addr.
2020-10-20 09:10:21 +03:00
Nekotekina 72d1ac22aa SPU: report too many PUTLLC attempts (TSX)
Mirrored to PPU STCX code and PUTLLUC (STORE128).
2020-10-19 19:41:28 +03:00
Nekotekina 8ce5392390 TSX: add prefetchw instruction in transaction code 2020-10-19 19:41:28 +03:00
Nekotekina 120849c734 Implement perf stat counter for PPU/SPU reservation ops
Adds Emu/perf_meter.hpp header file.
Uses RDTSC for speed.
Prints stats at exit.
2020-10-19 19:41:28 +03:00
Nekotekina adf50b7c4b Implement cpu_thread::if_suspended
Use it for opportunistic guaranteed GETLLAR execution (TSX-FA).
2020-10-18 20:10:48 +03:00
Nekotekina 4078f43984 Fix ppu_stcx_accurate_tx (operand size mismatch) 2020-10-17 21:26:17 +03:00
Eladash 443c2b920d PPU: Handle cache line inconsistencies (PPU 128 reservations) 2020-10-16 22:51:30 +03:00
Nekotekina 583ed61712 SPU: return some give-up behaviour for PUTLLC (TSX)
Despite using concept of "shared" lock, allow only first to proceed.
This is similar how conditional stores for PPU are implemented.
2020-10-16 12:14:42 +03:00
Nekotekina facde63460 PPU: fix ppu_stcx_accurate_tx
Don't destroy xmm6/xmm7 state on exit.
Improve addr arg handling (simplify).
2020-10-15 19:24:00 +03:00
Nekotekina 494953997e PPU/SPU: give up on conditional stores if locking fails
Restores Non-TSX behaviour partially.
2020-10-15 17:18:49 +03:00
Nekotekina 3bddba0c7a SPU: fix spu_getllar_tx
Was not executing.
2020-10-14 02:53:29 +03:00
Nekotekina 97cd641da9 TSX: reimplement spu_getllar_tx
Only used as a backup method of reading reservation data.
Increase long GETLLAR reporting threshold.
2020-10-13 21:10:04 +03:00
Nekotekina dcff8c2637 Fix remaining vm::reservation_lock usages (for now)
Optimization can be restored later.
2020-10-13 12:04:59 +03:00
Nekotekina 7a76fb1469 PPU: Add loop logging in STWCX/STDCX 2020-10-13 11:06:58 +03:00
Nekotekina 17f805ae64 PPU: cleanup for TSX path remnant 2020-10-13 10:54:10 +03:00
Nekotekina dc39a9b84f SPU: Report 'GETLLAR took too long'
Also move similar code in PPU.
2020-10-13 00:12:11 +03:00
Nekotekina 5bd5a382c0 PPU: fix LDARX/LWARX in accurate mode (closes #9058)
Fixup after #9048
Use SSE intrinsics in mov_rdata.
2020-10-11 19:52:10 +03:00
Nekotekina 2f329cf7b5 PPU: minor improvement for LWARX/LDARX
Improve chances of loading actual data in memory.
2020-10-11 17:22:28 +03:00
Nekotekina f2d2a6b605 JIT cleanup for PPU LLVM
Remove MemoryManager3 as unnecessary.
Rewrite MemoryManager1 to use its own 512M reservations.
Disabled unwind info registration on all platforms.
Use 64-bit executable pointers under vm::g_exec_addr area.
Stop relying on deploying PPU LLVM objects in first 2G of address space.
Implement jit_module_manager, protect its data with mutex.
2020-10-11 17:22:28 +03:00
Nekotekina e8e3a3b2a2 PPU: improve LWARX/LDARX progression
Should reduce spam ("...took too long")
2020-10-10 17:36:41 +03:00
Nekotekina 050c3e1d6b Rewrite cpu_thread::suspend_all
Now it's a function of higher order.
Make only one thread do the hard work of thread pausing.
2020-10-10 13:58:48 +03:00
Nekotekina 6d83c9cc0e PPU: remove ppu_stcx_tx
Very small transaction, benefit questionable.
2020-10-10 13:58:48 +03:00
Nekotekina 346a1d4433 vm: rewrite reservation bits
Implement classic unique/shared locking concept.
Implement vm::reservation_light_op.
2020-10-10 13:58:48 +03:00
Eladash 871b15f6e1
PPU: fixup for Accurate 128-byte reservations (#8998) 2020-10-01 18:15:07 +03:00
Eladash f4ca6f02a1 PPU: Implement support for 128-byte reservations coherency 2020-09-28 22:34:42 +03:00
Eladash 3f7eba19c8 PPU: Upgrade reservations to 8-byte always 2020-09-28 22:34:42 +03:00
Eladash 09cddc84be SPU/PPU: Implement Atomic Cache Line Stores 2020-09-27 20:09:21 +03:00
Eladash a52a16807f PPU: Use SEQ-CST memory barrier in reservation load 2020-09-15 11:20:17 +02:00
Eladash d489b02fc1 PPU: Do not allow unaligned/unmapped reservation addresses 2020-09-10 13:35:57 +02:00
Eladash 43fce92aa9 PPU: reduce LARX logging level to warning 2020-09-08 15:23:55 +02:00
Eladash 2f3e0044f1
PPU: Cleanup & unify reservation loads (#8849) 2020-09-07 22:06:09 +01:00
Eladash 73d23eb6e6
SPU: Implement Accurate DMA (#8822) 2020-09-02 23:58:29 +02:00
Eladash 933737e8f0 PPU: log LR in HLE functions 2020-08-27 23:52:37 +01:00
Eladash c099bb817f Debugger: Disable PPU address redirection
It causes more confusion than it helps.
2020-08-25 17:43:07 +02:00
Eladash 7fe98d8d66 Debugger: Add missing PPU stack register checks 2020-08-25 17:43:07 +02:00
Eladash 3ce7fd7894 Debugger: Fix instructions editor 2020-08-25 17:43:07 +02:00
Eladash 917069e31a
PPU Precise/LLVM: Support NJ modes (#8617) 2020-07-25 07:41:41 +01:00
Eladash 84470c34db SPU: Disable PUTLLC NOP transfers detection on TSX path 2020-07-09 03:17:35 +01:00
Eladash dc25a3fa2a PPU debugger: Show stack address of each function 2020-07-06 18:58:16 +02:00
Eladash c98ec4d014 PPU debugger: Fix functions stack bounds check 2020-07-06 18:58:16 +02:00
sampletext32 437f374bae Fix some checks 2020-06-04 19:48:08 +03:00
Nekotekina 938ca90a02 Improve Stop Watchdog
Prevent termination if PPU LLVM compilation is in progress.
2020-06-01 02:27:33 +03:00
Eladash f0cdd8ace6 PPU: Implement PPU Traps Stubbing option 2020-05-27 22:39:29 +03:00
Eladash 91d06a9729
SPU LLVM: fixup after #8175 (#8214)
Mask out RESULT cmd bit, do not create unbound branch blocks. (non-TSX)
2020-05-14 13:34:14 +01:00
Nick Renieris b1fb5b6239 Emu/Config: Add option for accurate PPU LLVM vector NaNs
Turned off by default.
2020-05-14 11:14:28 +01:00
Eladash 5c4c8f4539 PPU: Use optimized reservation waiting for reservation load (non-TSX) 2020-05-13 16:53:59 +03:00
Eladash 525453794f SPU/PPU reservations: Optimizations part 1
- Implement vm::reservation_trylock, optimized locking on reservation stores with no waiting. Always fail if reservation lock bitsa are set.
- Make SPU accurate GET transfers on non-TSX not modify reservation lock bits.
- Add some optimization regarding to unmodified data reservations writes.
2020-05-13 11:10:13 +01:00
Nekotekina e1042bc631 Get rid of "module" keyword
Workaround some intellisense problems.
2020-05-06 18:20:11 +03:00
Eladash 1bd6cb2105 SPU/PPU debugger: use ':' instead of '=' 2020-05-05 13:46:26 +03:00
Eladash 72bef8dd7f PPU: Clear reservation on context switch
Ensure that only 2 PPU reservations exist at maximum at a time.
2020-05-02 14:57:38 +03:00
Eladash f4f0fb88b1 kernel explorer: Add more information about SPU/PPU threads 2020-04-29 15:32:16 +03:00
Eladash dd6825a7bd Fix sys_ppu_thread_start error checking, fix rare bug in sys_ppu_thread_create
* Correct error code to EBUSY.
* lv2_obj::awake was called even when EBSUY should be returned.
* Fix sys_ppu_thread_create for a newly created thread with the same id as ppu_thread::id_base. (can happen if main thread exited before its creation)
2020-04-29 08:58:09 +03:00
Eladash 954e3f6e6c Fixup for cpu_flag::pause state check after #8114 2020-04-29 05:56:47 +03:00
Nekotekina 689419b0ca Remove test_stopped() check from ppu_load_acquire_reservation
Fixes warning.
2020-04-29 00:09:40 +03:00
Eladash a505d87565 Partial revert of 3be687cd18 2020-04-28 20:20:19 +03:00
Eladash 3be687cd18 PPU: Fix LWARX/LDARX on TSX path 2020-04-28 14:27:40 +03:00
Eladash 0bf73ba0bc PPU debugger: report functions on registers display 2020-04-19 10:56:42 +01:00
Eladash 368bd7cf02 PPU debugger: read 32-bit pointer instead of 64-bit
PPU ABI supports only 32-bit pointers in userland, also fix it to use super ptr.
2020-04-19 10:56:42 +01:00
Eladash 83c7f6f149 debugger: Rephrase "Current function" to "In function"
Takes less space which makes actual function name display a bit nicer.
Also the meaning is clearer.
2020-04-19 10:56:42 +01:00
Nekotekina c7fe8567b8 Experimental squashing of reservation memory area.
Enables trivial synchronization between shared mem.
Reduces memory usage, but potentially degrades performance.
Rename an overload of vm::passive_lock to vm::range_lock.
2020-04-16 02:25:43 +03:00
Eladash 63be05d5d3 minor ppu fixup
does not affect anything except consistency.
2020-04-14 17:09:58 +03:00
Eladash c8b8cafeec PPU: Merge reservations store functions into one 2020-04-13 14:34:37 +03:00
Eladash 158b24ec25 SPU LLVM: Add accurate double-precision FMA support 2020-04-09 17:27:14 +03:00
Eladash c948c9305c sys_ppu_thread_create: read function descriptor immediately and save it 2020-04-08 19:23:13 +03:00
Eladash cc8f024c6c Fixup ppu/spu_thread::dump_all() 2020-04-08 14:35:44 +03:00
Nekotekina 91d80aa7b9 Implement jit_compiler::check
Instead of checking file existence (because file may be damaged).
2020-04-07 16:09:47 +03:00
Megamouse b1fdbc7fcc Move some format functions 2020-04-06 20:59:58 +02:00
Eladash dc5cdb3bb4 sys_ppu_thread: reduce global memory stats after thread creation 2020-04-05 15:23:09 +03:00
Eladash 63080c22a3 Fix ppu_thread::dump_callstack() 2020-04-04 00:06:51 +03:00
Eladash 0beea91d5e Minor debugger fixups 2020-04-03 18:37:21 +03:00
Nick Renieris 6cbb12e5cd PPUThread: String & hex previews for register pointers in register dump 2020-04-03 01:36:35 +01:00
Nick Renieris 1231274e0f CPUThread: Split dump() info to separate methods 2020-04-03 01:36:35 +01:00
Eladash 92f821aeb1
PPU LLVM: Add FMA accuracy setting (#7874)
* PPU LLVM : Match PS3 for the instructions fmadd, fmadds, fmsub, fmsubs, fnmadd, fnmadds, fnmsub, fnmsubs

Co-authored-by: doesthisusername <yfirestorm@gmail.com>
2020-03-31 20:01:10 +03:00
Nekotekina 471db3219d Finalize constexpr ppu_decoder<> thing
Move SSSE3 checks to runtime in PPUInterpreter.cpp
2020-03-25 11:18:48 +03:00
Nekotekina 1ceb779a38 Make ppu_decoder<> objects constexpr (partial) 2020-03-24 13:46:46 +03:00
Nekotekina e606130262 Memoize and print r3-r6 under Current function in the ppu_thread::dump() 2020-03-22 14:13:52 +03:00
Eladash dc839e1784 lv2: Do not lose r3 data on syscalls
Allows to get the ID of the lv2 sync objects in the debugger by looking at r3's content.
2020-03-22 12:41:02 +03:00
Eladash 1dbb5422a2 Avoid a segfault when reading ppu stack contents in debuggers
TODO: lock vm mutex.
2020-03-19 14:18:05 +03:00
Nekotekina 45389dca51 PPU: minor fix for ppu_join_status::max
Don't treat it as special "invalid" value.
2020-03-14 20:36:56 +03:00
Eladash efe6e1eb0a sys_ppu_thread: Make PPU id removal after exit atomic with descheduling
* Make PPU id removal after exit atomic with descheduling
* Make joining thread scheduling atomic with thread exit sleep.
* Update sys_ppu_thread_stop/restart.
* Add idm::remove_verify.
2020-03-14 18:30:14 +02:00
Nekotekina 04dedb17eb Disable exception handling.
Use -fno-exceptions in cmake.
On MSVC, enable _HAS_EXCEPTION=0.
Cleanup throw/catch from the source.
Create yaml.cpp enclave because it needs exception to work.
Disable thread_local optimizations in logs.cpp (TODO).
Implement cpu_counter for cpu_threads (moved globals).
2020-03-12 16:03:08 +03:00
Nekotekina Aux1 250736ece5 Fix warnings in emucore 2020-03-04 21:23:34 +03:00
Nekotekina bdbc7b5f1d PPU: use named_thread_group to compile modules
Improves internal logic by not using too many threads.
2020-03-04 14:10:38 +03:00
Nekotekina 3105b21909 Print PPU Syscall Usage Stats
* Every 10 seconds
* On normal exit
2020-03-02 20:48:20 +03:00
Nekotekina 490f58ff3c Try to purge thread_state::detached
It's rarely necessary, but can cause unexpected problems.
2020-02-28 21:11:13 +03:00
Nekotekina 65eeee0f4c Remove cancerous lf_value<>
Replace thread names (generic, PPU, SPU) with new shared pointers.
Devirtualize cpu_thread::get_name (used in single case).
2020-02-28 18:54:46 +03:00
JohnHolmesII 479a64c4e8 Remove some inline compiler pragmas 2020-02-23 09:38:04 +03:00
Nekotekina 972e0ab31d Remove -Wno-reorder and make it an error 2020-02-21 15:20:34 +03:00
Nekotekina 92e3eaf3ff Fix signed-unsigned comparisons and mark warning as error (part 2). 2020-02-19 22:54:58 +03:00
Nekotekina f08c778d2c Use more starts_with/ends_with.
Remove ends_with global func.
2020-02-18 14:53:23 +03:00
Nekotekina 244e74ebe2 Try to ignore some annoying warning (seems CIB) 2020-02-17 20:56:03 +03:00
Megamouse fe75311be2 move config structs to own files and clean up some headers 2020-02-17 15:08:17 +03:00
Nekotekina c0f80cfe7a Use attributes for LIKELY/UNLIKELY
Remove LIKELY/UNLIKELY macro.
2020-02-05 10:42:34 +03:00
Nekotekina 327bb2d8f0 Modernize PPU logging (ppu_log variable) 2020-02-01 11:52:24 +03:00
Nekotekina 1d0f359406 logs: add more log channels instead of GENERAL 2020-01-31 16:44:48 +03:00
Ivan 7f07b79c04 Partial revert of #7180
PC is PS
2020-01-27 07:05:18 +03:00
Eladash a7aef22754 ppu: Log SELF header information and CIA of caller HLE functions 2020-01-27 01:21:40 +00:00
Eladash ec9622b513 Fix ppu_patch invalid address check 2019-12-31 18:57:14 +03:00
Eladash 8427af8886 Implement runtime PPU executable code modification via Cheat Manager 2019-12-31 18:57:14 +03:00
Nekotekina 70e26eeb45 LLVM: compress PPU cache
Compress PPU modules to .gz (backward compatible with uncompressed cache)
2019-12-27 23:12:16 +03:00
Nekotekina 185c067d5b C-style cast cleanup V 2019-12-03 17:23:00 +03:00
Nekotekina 28eacc616a C-style cast cleanup III 2019-12-01 00:32:44 +03:00
Nekotekina a83cbf63c6 Remove gsl::finally only use 2019-11-09 19:30:06 +01:00
Nekotekina 1cca00ec3a Fix SSSE3 usage in PPUThread.cpp
Remove legacy ifdefs, allow SSSE3 usage in AppImages.
2019-11-09 20:10:59 +03:00
Nekotekina 191675bf31 Remove gsl::finally only use 2019-11-09 19:11:01 +03:00
Nekotekina ccac9d4777 Remove throwing and catching cpu_flag::stop
Since there is spu_runtime::g_escape function now.
2019-11-08 19:27:11 +03:00
Nekotekina 587ae17aa2 Simplify fmt::throw_exception
Gradual exception deprecation: disallow choosing exception type.
However, the function itself can remain here forever.
2019-11-08 19:27:11 +03:00
MSuih f3ed26e9db Small warnings cleanup (#6671)
* Ignore more warnings

These are intentional

* Signed/unsigned mismatch when comparing

* Explictly cast values

* Intentionally discard a nodiscard value

* Change ppu_tid to u32

* Do not use POSIX function name on Windows

* Qt: Use horizontalAdvance instead of width

* Change progress variables to u32
2019-10-25 13:32:21 +03:00
Eladash c16319f959 PPU Precise: Fix fused float ops misaccuracy by using fma
Also cleanup add64_flags, remove redundent copy of s_ppu_itype.
2019-10-20 20:58:31 +03:00
Nekotekina 49e96b39dd [SPU, TSX] Fix reservation corruption in PUTLLC
Change reservation locking logic.
2019-10-12 15:41:24 +03:00
Nekotekina a29d4150df GDB Server: fix and cleanup
Move source files to Emu/GDB.cpp, GDB.h
Remove "WITH_GDB" option, enable GDB Server by default.
Change class name to gdb_thread.
Alias for external access gdb_server.
Change config option name to "GDB Server"
Bind on 127.0.0.1 by default.
2019-10-09 00:11:44 +03:00
Nekotekina b48cdc2260 Use g_fxo for global ppu_module instance
Also fix autonomous PRX/SPU loading sequence.
2019-09-26 23:26:36 +03:00
Nekotekina 4ec3e968ff Use g_fxo for jit_core_allocator 2019-08-27 03:50:15 +03:00
Nekotekina 3dd6961ee5 Use g_fxo in PPUThread.cpp misc
Replace fxm::get_always
2019-08-27 03:50:15 +03:00
eladash 050339bb3e PPU/LV2: Make thread-lists scheduling atomic 2019-08-17 22:46:36 +03:00
Nekotekina f8f3067deb Always check page_allocated in vm::check_addr 2019-08-14 20:28:34 +03:00
eladash 4f00af6000 ppu interpreter: Allow non-ssse3 to use fast path
byte shuffle is now removed which was the barrier for ssse3 check.
2019-08-13 04:56:00 +03:00
Eladash 3ce18fd960 Implement vm::page_executable (#6330)
Fixes segfaults when attenpting to set segfaults on non-executable memory.
2019-08-11 21:04:17 +03:00
Nekotekina 949f33c8a4 Fix sys_config_get_io_event syscall name 2019-07-29 21:55:59 +03:00
Eladash 85b1152e29 Timers scaling and fixes 2019-07-23 00:09:01 +01:00
Eladash 537d3f2548 Log last function on debug pause or exception, dump cpu_thread state on access violation 2019-07-10 17:35:39 +03:00
Lassi Hämäläinen 499035512b Split Emu/Memory into more logical headers
- Add vm_locking.h and vm_reservation.h and move relevant functions
  and types to these headers.
- Change include order and make vm_ptr.h, vm_var.h and vm_ref.h headers
  usable invidually and them including vm.h instead of other way around
- Because usage of vm::ptr now requires including vm_ptr.h instead of
  vm.h updated multiple #includes
- Added additional #includes to vm_reservation.h and vm_locking to
  where vm::reservation_* and locking related functions are used
2019-06-25 17:11:10 +03:00
Nekotekina 5d45a3e47d Implement cpu_thread::suspend_all
Remove Accurate PUTLLC option.
Implement fallback path for SPU transactions.
2019-06-19 20:36:12 +03:00
Eladash d52953fca6 minor UB fix 2019-06-17 02:52:43 +03:00
Nekotekina 7de3c410cf SPU/PPU: update reservation logic on TSX path transactions
Make use of lock bits in reservation counters.
On PPU, fallback to compare_and_swap instead of desperate retry.
On SPU, lighten write set on retry by 'locking' outside of the transaction.
2019-05-20 14:32:50 +03:00
Nekotekina 9abb303569 vm: expand reservation lock bit area to 7 bit
This is minor change.
2019-05-19 17:46:55 +03:00
Nekotekina 7492f335e9 SPU analyser: basic function detection in Giga mode
Misc: fix EH frame registration (LLVM, non-Windows).
Misc: constant-folding bitcast (cpu_translator).
Misc: add syntax for LLVM arrays (cpu_translator).
Misc: use function names for proper linkage (SPU LLVM).

Changed function search and verification in Giga mode.
Basic stack frame layout analysis.
Function detection in Giga mode.
Basic use of new information in SPU LLVM.
Fixed jump table compilation in SPU LLVM.
Disable broken optimization in Accurate xfloat mode.
Make compiled SPU modules position-independent in SPU LLVM.

Optimizations include but not limited to:
 * Compiling SPU functions as native functions when eligible
 * Avoiding register context write-out
 * Aligned stack assumption (CWD alike instruction)
2019-05-11 02:13:19 +03:00
eladash ea1c9a2e17 Fix PPU Breakpoints and ppu_check_toc 2019-04-29 23:04:16 +03:00
Nekotekina 524aac75ed LLVM DSL: rewrite bitcast, zext, sext, trunc, select, min, max ops
Are made composable in expressions similar to arithmetic ops.
Implement noncast in addition to bitcast (no-op case).
Implement bitcast constant folding.
Fixed some misuse of sext<>.
2019-04-24 23:55:41 +03:00
eladash b307aff9eb Prefetch byteswapped opcodes in ppu interpreter 2019-04-11 17:47:52 +03:00
eladash f028737db8 Implement fallback for PPU LLVM
This matches with interpreter implementation, fixing unregistered functions in lost cases
2019-04-11 17:47:52 +03:00
eladash e21504d52d ppu interpreter: Improve FPCC field handling 2019-04-11 17:47:52 +03:00
Nekotekina 3354f068fc PPU/SPU transactions: ease cache line interference (TSX path)
Touch memory on the same memory page, but different cache lines.
2019-04-10 13:58:12 +03:00
Nekotekina d873802b9c Use LLVM 9
Use new add/sub with saturation intrinsics
2019-03-30 01:36:48 +03:00
Nekotekina 849411693a PPU LLVM: add MemoryManager3
For temporary allocations.
Add flags in jit_compiler constructor.
2019-03-23 02:43:41 +03:00
Nekotekina 7f6a410770 Add dummy __has_builtin macro, use rotate builtins if possible 2019-03-01 00:08:19 +03:00
eladash 0861226271 Make more use of the new atomic_t<>::release 2019-02-10 00:16:57 +03:00
elad fc92ae4085 SPU/PPU atomics performance and LR event fixes (#5435)
* Fix SPU LR event setting in atomic commands according to hw test
* MFC: increment timestamp for PUT cmd in non-tsx path
* MFC: fix reservation lost test on non-tsx path in regard to the lock bit
* Reservation notification moved out of writer_lock scope to reduce its lifetime
* Use passive_lock/unlock in ppu atomic inctrustions to reduce redundancy
* Lock only once for dma transfers (non-TSX)
* Don't use RDTSC in reservation update logic
* Remove MFC cmd args passing to process_mfc_cmd
* Reorder check_state cpu_flag::memory check for faster unlocking
* Specialization for 128-byte data copy in SPU dma transfers
* Implement memory range locks and isolate PPU and SPU passive lock logic
2019-01-15 18:31:21 +03:00
Nekotekina a419e98acb Move PPU and shader cache
New hash-based location (already used for SPU)
Bump PPU cache version, improve naming and decrease size

Remove fs::get_data_dir
Disable boot.elf cache
2019-01-14 01:24:05 +03:00
Nekotekina bd9131ae1c Implement fs::get_cache_dir
Win32: equal to config dir for now
Linux: respect XDG_CACHE_HOME if specified
OSX: possibly incomplete
2019-01-13 14:45:36 +03:00
Megamouse a4f67ccb87 Add log messages for PPU compilation 2018-12-31 23:03:03 +03:00
Nekotekina 96cabeadff Rewrite condition variables
Implement helper functions balanced_wait_until and balanced_awaken
They include new path for Windows 8.1+ (WaitOnAddress)

shared_mutex, cond_variable, cond_one, cond_x16 modified to use it
Added helper function utils::popcnt16
Replace most semaphore<> with shared_mutex
2018-11-29 01:30:05 +03:00
eladash 3a7f5b970f ppu: Fix stack base 2018-11-02 02:16:29 +03:00
Nekotekina 1b37e775be Migration to named_thread<>
Add atomic_t<>::try_dec instead of fetch_dec_sat
Add atomic_t<>::try_inc
GDBDebugServer is broken (needs rewrite)
Removed old_thread class (former named_thread)
Removed storing/rethrowing exceptions from thread
Emu.Stop doesn't inject an exception anymore
task_stack helper class removed
thread_base simplified (no shared_from_this)
thread_ctrl::spawn simplified (creates detached thread)
Implemented overrideable thread detaching logic
Disabled cellAdec, cellDmux, cellFsAio
SPUThread renamed to spu_thread
RawSPUThread removed, spu_thread used instead
Disabled deriving from ppu_thread
Partial support for thread renaming
lv2_timer... simplified, screw it
idm/fxm: butchered support for on_stop/on_init
vm: improved allocation structure (added size)
2018-10-19 22:22:35 +03:00
Nekotekina f2229a5f53 PPU reservations: ensure aligned atomic ops
Store aligned 64 bits to ppu.rdata
Don't save reservation size
2018-09-15 17:09:56 +03:00
eladash cd11ae5d8b ppu: Fix extreme reservation corner case 2018-09-12 23:17:53 +03:00
Nekotekina d750e955c3 Use std::uncaught_exceptions()
Also remove wrong attributes
2018-09-08 00:32:04 +03:00
Nekotekina ca5158a03e Cleanup semaphore<> (sema.h) and mutex.h (shared_mutex)
Remove semaphore_lock and writer_lock classes, replace with std::lock_guard
Change semaphore<> interface to Lockable (+ exotic try_unlock method)
2018-09-03 23:00:36 +03:00
Nekotekina 8abe6489ed Mega-cleanup for atomic_t<> and named bit-sets bs_t<>
Remove "atomic operator" classes
Remove test, test_and_set, test_and_reset, test_and_complement global functions
Simplify atomic_t<> with constexpr if, remove some garbage
Redesign bs_t<> to use class, mark its methods constexpr
Implement atomic_bs_t<> for optimizations
Remove unused __bitwise_ops concept (should be in other header anyway)
Bitsets can now be tested via safe bool conversion
2018-09-03 21:40:36 +03:00
Nekotekina 85fa0942e7 vm: allow 4k-aligned allocations for vm::stack
Fix utils::shm::map logic for MapViewOfFileEx
2018-08-30 14:56:45 +03:00
Ani 6fc869e21b Revert d1fd4d5000 2018-08-20 00:12:30 +04:00
eladash f349695a75 Rsx: rewrite address translation 2018-08-13 16:16:34 +03:00
Nekotekina 801089cf44 PPU LLVM: always link syscall_## functions
Regardless of whether they have name or not
Should fix "Linkage failed" errors introduced after #4886
2018-08-12 15:42:47 +03:00
Nekotekina d1fd4d5000 PPU: don't use transactions (test) 2018-08-12 02:42:32 +03:00
Chris Weermann (TGE) fdcc5adc8d Fix overflow in PPUThread stack frame dump 2018-08-11 20:56:19 +04:00
Nekotekina a0bf103e8b Implement cpu_translator::pshufb<>()
Remove spu_translator::pshufb<>()
Improve PSHUFB emulation (pre-SSSE3)
Emit static shufflevector for the constant mask
PPU: Inline VPERM instruction
2018-07-06 00:33:52 +03:00
isJuhn 83f096c435 Add conditional reservation update to STW 2018-06-23 23:13:34 +04:00
Nekotekina 6229b3ca8d Fixes for booting PS1 games 2018-06-23 17:30:16 +03:00
Nekotekina e4da284176 SPU: analyser v4 and fixes
Build SPU cache after PPU, fix mixing progress
SPU ASMJIT: add support for Giga mode
SPU ASMJIT: use the same spu.log location as SPU LLVM
SPU: improve spu.log disasm
SPU: improve trampolines, unify with SPU ASMJIT
SPU: decode interrupt handler address from BR/BRA at 0x0
SPU LLVM: support Mega/Giga modes
SPU LLVM: implement function chunks
SPU LLVM: use PHI nodes, value visibility across basic blocks
SPU LLVM: implement function chunk table
New simple memory manager for LLVM (bugfix)
2018-06-21 22:29:34 +03:00
Nekotekina b0ee369135 Rewrite LLVM compilation progress dialog
Use a single dialog
2018-05-30 20:35:35 +03:00
Nekotekina 72574b11ff SPU: use reservation spinlocks on writes (non-TSX)
This should decrease contention by avoiding global lock
2018-05-21 21:56:14 +03:00
Nekotekina 6fd402bcf8 Transactions: drop RDTSC usage
Use simple increment (minor optimization)
2018-05-21 00:18:37 +03:00
Nekotekina 33a1c743a4 Transactions: move loops inside
Rewrite loops in assembler (minor optimization)
2018-05-21 00:18:37 +03:00
Nekotekina 67391322f4 Transactions: touch memory only after a failure
Minor optimization
2018-05-17 22:19:26 +03:00
Nekotekina 367f039523 Build transactions at runtime
Drop _xbegin family intrinsics due to bad codegen
Implemented `notifier` class, replacing vm::notify
Minor optimization: detach transactions from global mutex on TSX path
Minor optimization: don't acquire vm::passive_lock on PPU on TSX path
2018-05-16 17:31:58 +03:00
Nekotekina 4c7afb6952 Opt-in set DAZ and FTZ 2018-05-13 00:03:08 +03:00
Nekotekina 737db90058 Set DAZ and FTZ 2018-05-09 23:38:26 +03:00
Nekotekina 5d15d64ec8 Memory mirror support
Implemented utils::memory_release (not used)
Implemented utils::shm class (handler for shared memory)
Improved sys_mmapper syscalls
Rewritten ppu_patch function
Implemented vm::get_super_ptr (ignores memory protection)
Minimal allocation alignment increased to 0x10000
2018-05-09 23:35:34 +03:00
Nekotekina fe4c3c4d84 Implement SPU recompiler cache
Shared between ASMJIT/LLVM recompilers, compiled at startup
2018-05-09 23:35:18 +03:00
Nekotekina f4af3f2987 PPU: improve LWARX/LDARX consistency 2018-05-08 13:05:29 +03:00
Robbie 477522210e Refactor debugger_frame into subclasses. Mostly trying to simplify
breakpoints.
2018-04-21 22:21:51 +04:00
Nekotekina 0797164fac SPU: fix possible livelock
The bug affects TSX path
2018-04-07 20:51:21 +03:00
Nekotekina 2b5cf2455f SPU: improve TSX usage
Reduce transaction failure amount
Remove vm::try_to_lock
2018-04-06 21:47:54 +03:00
Nekotekina d392379c7a Use vm::passive_lock for SPU threads 2018-04-06 15:47:00 +03:00
Nekotekina 402ca480cd Fix vm::check_addr usage 2018-04-01 22:39:48 +03:00
Nekotekina a3db2774f1 [LLVM] Fix thread limiter
Allow to apply max llvm threads setting as usual
2018-03-31 20:35:30 +03:00
Nekotekina 19944eeed0 Implement SPRX precompilation
Automatically precompile firmware modules
Add "Create LLVM Cache" menu (for games)
Reimplement jit_compiler::cpu as static method
2018-03-22 23:24:58 +03:00
Jake 7bbadfd08b ppu/sys_interrupt: add stack_reset command to fix sys_interrupt stack overflowing 2018-03-09 20:30:59 +04:00
Andrey e0f53ace19 Improve GDB debug server (#4027)
* Made GDB debugger working with IDA

* Added async interrupts support

* Report proper thread after pausing

* Support attaching debugger before running app
2018-02-28 19:31:39 +04:00
Nekotekina cce0ad0c35 Clean vm::ps3 namespace use 2018-02-09 17:49:37 +03:00
Megamouse b9c10a186d Qt/Core: implement max llvm compile threads 2018-01-26 01:57:05 +04:00
kd-11 cbc8bf01a1 cell/scheduler: Manage thread placement depending on cpu hardware 2018-01-19 12:03:57 +03:00
TGEnigma d770a42349 Fix debug build 2018-01-06 04:45:55 +04:00
Nekotekina 198e9dce1d Fix #4005 regression
Delay unregister EH frames (Linux)
2018-01-01 10:41:07 +03:00
VelocityRa 383c501a35 [gui] Show total number of llvm compilation dialogs
- Doesn't account for dynamic libraries loaded after the fact,
  but usually good enough since
  1) Those aren't even present in some games
  2) They usually only have about 1 or 2 fragments (dialogs) each.
2017-12-31 22:08:17 +03:00
Nekotekina d40aaf0391 PPU: use shared jit_compiler instance
(Linux) Fix deregisterEHFrames error message
2017-12-31 22:08:17 +03:00