Dynamic recompiler

Discussion of development and patch submission.
rflego
Posts: 18
Joined: Thu 12 Mar, 2015 7:39 am

Re: Dynamic recompiler

Post by rflego » Fri 03 Apr, 2015 6:09 pm

Sorry for not being able to explain the problem.
I made a video that shows the problem:

https://www.youtube.com/watch?v=XNN3DkXGPus

If you close and open the PCEm this problem returns...

ecksemmess
Posts: 155
Joined: Wed 18 Mar, 2015 5:27 am

Re: Dynamic recompiler

Post by ecksemmess » Mon 06 Apr, 2015 2:42 am

Wow! You weren't kidding. Your execution speed for sound playback is dropping from about 1.0 to 0.15 MIPS, and recompiled speed correspondingly from 100 to 15 MIPS, just by your opening and closing of the config. I'm nowhere near familiar enough with the recompiler to know how to interpret that, but I would think that what we're seeing here is simply a bug in which the config is somehow initializing with the wrong CPU speed selection, despite the list box continuing to display as MMX 233. It therefore switches the Pentium to a much slower speed, likely the slowest in the drop-down list, and that's why your performance is suddenly jumping back to 100% the instant you close the config. Does that sound about right, Tom?

EDIT: Just noticed that the effective clock speed readout isn't dipping from 233 MHz, so maybe my analysis is off. Definitely a weird bug, but it will require attention from someone who knows the recompiler.

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Mon 06 Apr, 2015 10:18 am

This might be a cache issue. I can't test right now, but can you set cache to 'Infinite' and see if that makes a difference?

rflego
Posts: 18
Joined: Thu 12 Mar, 2015 7:39 am

Re: Dynamic recompiler

Post by rflego » Mon 06 Apr, 2015 11:23 pm

Just test with the infinite cahe, the same problem occurred.

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Tue 07 Apr, 2015 5:11 pm

Fixed in rev 220. Cache setting wasn't being applied correctly on startup.

rflego
Posts: 18
Joined: Thu 12 Mar, 2015 7:39 am

Re: Dynamic recompiler

Post by rflego » Tue 07 Apr, 2015 11:21 pm

Great, problem solved, I will continue testing various games for DOS and Windows (including 3Dfx Voodoo), thank you Tom.

ecksemmess
Posts: 155
Joined: Wed 18 Mar, 2015 5:27 am

Re: Dynamic recompiler

Post by ecksemmess » Wed 08 Apr, 2015 3:51 am

rflego, now that the bug has been fixed, are you getting a consistent 100% or a consistent 30% when you run the MMX 233 on the Windows desktop? If 100%, can you try a bunch of high-intensity games and applications to see if anything you do ever makes the execution dip below 100%? You do appear to have an unusually fast system, and it would be interesting to know where the limit is...

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Wed 08 Apr, 2015 7:37 am

The Windows desktop is massively affected by the somewhat crap cache emulation. I would expect performance in actual applications to be a bit more modest.

ecksemmess
Posts: 155
Joined: Wed 18 Mar, 2015 5:27 am

Re: Dynamic recompiler

Post by ecksemmess » Thu 09 Apr, 2015 8:51 am

Understood. Speaking of which, if/when you ever turn your attention toward improving the cache emulation, would it be feasible to make it settable to actual values, instead of simply "a little/some/a lot", etc.? It's a relatively minor thing, but it is somewhat jarring in contrast to the highly accurate and specific settings that are possible for most of the other emulated components.

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Thu 09 Apr, 2015 4:34 pm

The cache emulation is a massive horrible hack which does an extremely bad job of simulating a cache, hence the extremely vague settings. I was actually considering removing it altogether; I can't think of a way to improve it without completely destroying emulator performance.

ecksemmess
Posts: 155
Joined: Wed 18 Mar, 2015 5:27 am

Re: Dynamic recompiler

Post by ecksemmess » Thu 09 Apr, 2015 6:01 pm

I see. For what it's worth, I've greatly enjoyed having the setting there to mess about with, hack or no hack. I'd be sad to see it go, even if its value is more as a semi-novelty than an actual respectable feature. Thanks for the info.

rflego
Posts: 18
Joined: Thu 12 Mar, 2015 7:39 am

Re: Dynamic recompiler

Post by rflego » Fri 10 Apr, 2015 4:21 am

I do not think a good idea to remove the cache, because there are many who use the PCEm to try to get "as real as possible in a certain PC."
I for one like to use WinBIOS AMD 486, DX4 100Mhz, 32MB Ram, therefore this setting and this WinBIOS is identical to a 486 that I had as a child, the only problem I'm having is the emulation of the joystick, though many games work, the X-Wing and Tie Fighter refuse to detect it.
As I am using the PCEm, I'll post the possible bugs to encounter.

Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: Dynamic recompiler

Post by Battler » Fri 10 Apr, 2015 11:32 am

- rflego: What about just adding the ability to disable cache then? That way, those who want it, can still use it, while those who don't, can just disable it.

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Fri 10 Apr, 2015 5:29 pm

That's already present - setting cache to 'Infinite' essentially disables it.

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Sat 11 Apr, 2015 5:36 pm

Recompiler should now work on Linux (32-bit only) as of rev 222. Build with ./configure --enable-dynarec.

ecksemmess
Posts: 155
Joined: Wed 18 Mar, 2015 5:27 am

Re: Dynamic recompiler

Post by ecksemmess » Sat 11 Apr, 2015 9:33 pm

I don't have Linux set up at the moment and therefore can't actually put this to the test, but I know a lot of people who will be thrilled about this (even to the extent that they've been waiting on such a development to really dive in and start using PCem), so many thanks on their behalf. Excellent work!

User avatar
leilei
Posts: 686
Joined: Fri 25 Apr, 2014 4:47 pm

Re: Dynamic recompiler

Post by leilei » Sun 19 Apr, 2015 7:55 pm

rev 226: Quake's explosion particles do not ramp its color properly, seems to go to the first color in its ramp

Turok (W95TurokDemov101.exe) now crashes at the Acclaim screen. (The game crashes, not the emulator)


Win98SE, 430VX, Pentium 120, A lot of cache, Sound Blaster 16, 32MB, Fast VLB/PCI, Phoenix S3 Trio64, Voodoo Graphics, no filter/bilinear.

astocky
Posts: 11
Joined: Sat 11 Apr, 2015 8:29 am

Re: Dynamic recompiler

Post by astocky » Mon 20 Apr, 2015 9:05 am

I have not performed significant testing, but the CPU usage on Quake has definitely dropped from r225 to r226. Running the timedemo demo1 average CPU usage from ~65 (peak 77) down to ~55 (peak 62). Running DOS 6.22, Intel Adv/EV, Pentium 120, A lot of cache, Sound Blaster 16, 32MB, Fast VLB/PCI, Phoenix S3 Trio64, 320x200 graphics mode.

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Tue 21 Apr, 2015 4:44 pm

Rev 227 should fix Turok.

Can you provide some screenshots of the Quake particle issue so I know what I'm looking for? I can't immediately spot anything wrong with it.

User avatar
leilei
Posts: 686
Joined: Fri 25 Apr, 2014 4:47 pm

Re: Dynamic recompiler

Post by leilei » Tue 21 Apr, 2015 6:33 pm

Here's a GIF with some pauses


I don't know if it's compiler related either.

Code: Select all

CFLAGS = -O3 -march=i686 -fomit-frame-pointer -DDYNAREC
Possibly related or not, i've noticed while trying Tyrian out, the 'secret level' text fading that pops up after you trigger a secret level item or area (easiest to just blast the big gray ground rock on the right edge of the screen and hover over its water), had a lookup translation error with its darkest pixels.

In interpreter, the Quake bug doesn't show, though the Tyrian one still does
Attachments
tysecret.png
tysecret.png (162.4 KiB) Viewed 12177 times
pcemqparticlesrampbug.gif
pcemqparticlesrampbug.gif (142.47 KiB) Viewed 12177 times

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Wed 22 Apr, 2015 6:32 pm

Rev 228 should fix Quake. The text issue in Tyrian is a bug in the game, I've reproduced it on real hardware.

rflego
Posts: 18
Joined: Thu 12 Mar, 2015 7:39 am

Re: Dynamic recompiler

Post by rflego » Thu 23 Apr, 2015 6:53 am

I played Tyrian in my real Cyrix MII 300, I have to remember if this bug happened, but I tested the same games recently, and in fact this bug occurs even in a real machine, is the game itself.

User avatar
leilei
Posts: 686
Joined: Fri 25 Apr, 2014 4:47 pm

Re: Dynamic recompiler

Post by leilei » Sat 30 May, 2015 10:00 pm

At rev 250 it's Nice to see stable ~90%'s at P166 w/ A lot cache in Quake. :)

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Sun 31 May, 2015 7:08 am

Rev 250 also hits one of my performance targets for v10 - on my machine (Core i5-something-or-other, ~3.6 GHz) Quake II timedemo demo1, in software at 320x240, hits 20 fps without the emulator dropping below 100%. On P166 I think, with infinite cache.

Orchidsworn
Posts: 63
Joined: Sun 22 Mar, 2015 10:16 pm

Re: Dynamic recompiler

Post by Orchidsworn » Mon 01 Jun, 2015 8:00 am

TomWalker wrote:Rev 250 also hits one of my performance targets for v10 - on my machine (Core i5-something-or-other, ~3.6 GHz) Quake II timedemo demo1, in software at 320x240, hits 20 fps without the emulator dropping below 100%. On P166 I think, with infinite cache.
Does 3D acceleration hurt or help framerate in this case. Just curious since I am unable to test this myself.

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Mon 01 Jun, 2015 12:46 pm

Hurts, because there are still some bottlenecks in the Voodoo emulation on the CPU side. I can get around ~10 fps at 640x480 with 3dfx + Pentium 75, but am unable to go any higher than that before the emulator slows down.

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Mon 01 Jun, 2015 6:25 pm

Rev 254 should improve the 3dfx case somewhat.

User avatar
SarahWalker
Site Admin
Posts: 1719
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Dynamic recompiler

Post by SarahWalker » Sun 07 Jun, 2015 11:44 am

Haven't done a performance sweep for a while, so here's the current state of performance verses the interpreter :

Code: Select all

DOS prompt         -  96% faster (55% / 108%)
Doom               - 158% faster (36% /  93%)
Duke 3D            - 110% faster (31% /  65%)
Quake              - 214% faster (49% / 154%)
Transport Tycoon   - 100% faster (56% / 112%)
Tyrian             - 133% faster (43% / 100%)
Terminal Velocity  - 349% faster (39% / 175%)
Worms              - 216% faster (45% / 142%)
Blake Stone        -  98% faster (47% /  89%)

Windows 95 OSR 2 :
Win 95 desktop     -  53% faster (34% /  52%)
Jazz 2             - 112% faster (43% / 134%)
GLQuake            -  79% faster (47% /  84%)
Croc (SW)          - 293% faster (30% / 118%)
Croc (Virge)       -  98% faster (43% /  85%)
Quake II           - 253% faster (38% / 134%)
GTA                - 189% faster (36% / 104%)
The drop in Blake Stone is surprising, and probably the result of self-modifying code changes required to get BeOS working. Otherwise it's all looking quite positive, the overall gain over the interpreter is now 159%.

rflego
Posts: 18
Joined: Thu 12 Mar, 2015 7:39 am

Re: Dynamic recompiler

Post by rflego » Sun 07 Jun, 2015 11:19 pm

Tom, i was testing some ms-dos games, using dynamic recompiler:

Tested machine:

AMI WinBIOS 486
AMD 486 DX4 100Mhz
32MB ram
Sound Blaster 16
MS-DOS 6.22 with Windows 98 EMM386.exe and HIMEM.SYS

(tested in other settings when found problems in some games)

Code: Select all

Magic Carpet 1 = video worked perfectly (svga / VGA);
can not calibrate the joystick;
Sound worked perfectly.

Magic Carpet 2 = video worked perfectly (svga / VGA);
The joystick detected and calibrated, worked
perfectly;
Sound worked perfectly.

Comanche 2 = video worked perfectly (VGA);
Joystick worked perfectly
sound worked perfectly

Comanche = Video worked perfectly (VGA);
Joystick worked perfectly;
sound worked perfectly

Alone in the Dark = Video worked perfectly (VGA);
I do not know if it supports joystick, not
I found on configuration;
Sound worked perfectly.

Destruction Derby = Video worked perfectly (VGA);
Joystick worked perfectly;
Sound worked perfectly.

Descent = Video worked perfectly (VGA);
Joystick worked perfectly;
sound worked perfectly.

Descent 2 = video worked perfectly (svga / VGA)
Joystick worked perfectly;
EDIT: Sound worked perfectly.

Dark Forces = Video worked perfectly  (VGA);
Joystick worked perfectly;
sound worked perfectly.

*Litil Divil = video worked perfectly (VGA);
Joystick detects but not calibrate;
sound effects worked but not music.

Doom = worked slow, tested several settings, various bios and processors, worse in Pentium MMX 233 (strangely, the faster the processor, slower is) perfect in AMD 486DX2 50Mhz (VGA);
Joystick works perfectly
Sound works, but in consequence of being slow, presents lag.

Doom2 = worked slow in "best" processors and perfect in AMD 486DX2 50Mhz (same as Doom 1);
Joystick works perfectly;
Sound works with lag (same as Doom 1).

Duke Nukem 3D = Video worked perfectly (svga / VGA);
Joystick worked perfectly;
sound worked well, but with some lag when you start
play.

Microprose F1 Grand Prix = After animation, freezes.

Microprose F1 Grand Prix 2 = Video works perfectly (svga / VGA);
Joystick works perfectly;
Sound works perfectly.

FIFA International Soccer = does not work, shows error "Abnormal program termination: Page fault CS: EIP = 000Fh: 000AC0E7h" In DOSBox is the same mistake.

Indy5000 = Video works perfectly;
The game does not support the joystick;
sound uses pc speaker.

Indycar Racing = does not work, the game closes and returns to DOS, works well in Dosbox.

Indycar Racing 2 = worked slow processors 'better', playable in AMD 486DX2 33Mhz (VGA)
Joystick works perfectly;
Sound works, but in consequence of being slow, presents lag.

Micro Machines = wheel game but freezes in the menu screen.

Pinball Fansies = worked slow in processors "better" perfect in AMD 486DX2 50Mhz (VGA);
do not use joystick;
Sound works, but in consequence of being slow, presents lag.

Screamer = Video worked perfectly (svga / VGA)
does not detect joystick;
Sound worked perfectly.

Screamer 2 = Video worked well (svga / VGA);
does not detect joystick;
Sound worked perfectly.

Spear of Destiny = Video worked perfectly (VGA);
Joystick worked perfectly;
Sound worked perfectly.

*Street Fighter 2 = worked slow in "best" processors, good at AMD 486DX2 50Mhz (VGA);
do not use joystick;
Sound works, but in consequence of being slow,
presents lag.

Street Fighter 2 Turbo = worked on over fps;
do not supports joystick;
sound worked perfectly.

Street Rod = video works perfectly (VGA);
joystick is detected but not calibrated;
sound uses pc speaker.

Street Rod 2 = video works perfectly (VGA);
joystick is detected but not calibrated;
sound uses pc speaker or Adlib.

Super Street Fighter 2 = Video worked perfectly (VGA);
Joystick worked perfectly;
sound worked perfectly.

Star Trek 25th aniversary = Video worked perfectly (VGA);
Joystick worked perfectly;
sound worked perfectly.

Star Trek Judgment Rites = Video worked perfectly (VGA);
Joystick worked perfectly;
sound worked perfectly.

Shadow Warrior = Video worked perfectly (svga / VGA);
Joystick worked perfectly;
sound worked perfectly.

Tie Fighter Floppy Version = Video worked perfectly (VGA);
Joystick is not detected;
sound worked perfectly.

X-Wing Floppy Version = Video worked perfectly (VGA);
Joystick is not detected;
sound worked perfectly.

Wolfenstein 3D = Video worked perfectly (VGA);
Joystick worked perfectly;
sound worked perfectly.

Blood = Video worked perfectly (svga / VGA);
Joystick worked perfectly;
sound worked perfectly. 

*it was necessary to use a memory manager (QEMM)

Trying to run games based on DOS4GW with QEMM, the PCEM crashes.

I would like to understand the problems related to the joystick, which are not detected in some games.
Last edited by rflego on Mon 08 Jun, 2015 4:14 am, edited 1 time in total.

User avatar
leilei
Posts: 686
Joined: Fri 25 Apr, 2014 4:47 pm

Re: Dynamic recompiler

Post by leilei » Mon 08 Jun, 2015 12:23 am

Descent 2 = video worked perfectly (svga / VGA)
Joystick worked perfectly;
SB16 is detected but sound effects did not work, music worked perfectly.
Sound works for me. It also detects and tests properly
Attachments
pcemd2.png
pcemd2.png (14.8 KiB) Viewed 11463 times

Post Reply