mirror of https://github.com/bsnes-emu/bsnes.git
![]() I've written a new scheduler for bsnes to take 100% full advantage of cooperative multithreading. Now, bsnes only performs jumps directly from one thread to another (CPU->SMP instead of CPU->main->SMP), and even then only when absolutely needed (eg CPU is accessing SMP when CPU is currently ahead of SMP). This unfortunately makes bCPU and bSMP no longer compile. However, it does yield some impressive speed gains. From 109fps to 125fps. By comparison, bsnes v0.017 yielded 128fps with my test ROM. The speed gain though is dependant upon how utilized the CPU<>SMP communication is, the difference in speed between v0.017 and my WIP can be anywhere between 1% and 10%, with the WIP always being slower. The better news is that this is still without IRQs fully optimized. I don't know how easy it will be to optimize these, if it's even doable at all... but if I can, that would yield another very important speed increase, making the next release the fastest ever. Here's to hoping. The bad news though is that cothreading's advantages are pretty much maxed out completely now. Don't expect any future leaps in performance from this. Still, overall... a 40% total speed increase and double the processor synchronization precision was definitely worth the effort, even for the potential loss of savestates. The scheduler should also make sPPU much faster when and if that's ever started upon, but that's still going to take a very significant speed hit over bPPU. One last benefit of the scheduler is that the new synchronization method isn't limited to only two clocks. I can now easily add another clock, eg for SFX/SA-1. Not that I'll be emulating either of those within the next year or two, though. Just saying... I might also make two schedulers, one for cothreaded cores and one for non-cothreaded cores. One thing is for certain though, I won't be writing schedulers for every combination of cothreaded<>non-cothreaded cores (there's 4 of them, CPU, SMP, PPU and DSP). And this will also rule out run-time polymorphism's compile-time option, so expect that to change to a compile-time only setting, meaning possibly two versions of bsnes in the future. Now then, I also fixed up S-CPU emulation mode opcodes. Direct page wrapping, stack wrapping with native mode opcodes and processor status flag fixes. No games use emulation mode, but accuracy is always nice. [No archive available] |
||
---|---|---|
src |