What can I do to help with Loongson support?

Archived bsnes development news, feature requests and bug reports. Forum is now located at http://board.byuu.org/
D--
Rookie
Posts: 17
Joined: Sat Feb 07, 2009 2:59 pm
Location: Chaoyang District, Beijing, China
Contact:

What can I do to help with Loongson support?

Post by D-- »

There are already five laptops out with the Loongson 2F CPUs. While I don't except any of them will ever be able to run bsnes (unless you make that speed-friendly version), the Loongson 3 due out next year might be able to.

The instruction set will be the same, with the 3 also supporting x86 translation. Even with 8 cores, I don't except 32bit x86-to-64bit mips3 translation to be friendly to bsnes given its already hgih emulation demands.

If I can provide any information to help with getting bsnes ready to compile on the 2F, it should be useful so bsnes will work on the Loongson 3 when that chip is released. Am I wrong to assume an 8-core 64-bit risc at 1.4 GHz will probably be able to run bsnes?

I know I'm probably your only contact with access to Loongson hardware unless you've been chatting with RMS, so I'll do what I can to help though I know it will never be running full (or half) speed here.

By the way, how can I get ahold of bearoso to let him know snes9x-gtk cannot compile on a Loongson even with assembler hacks off?
Thristian
Hazed
Posts: 76
Joined: Tue Feb 07, 2006 11:02 am

Re: What can I do to help with Loongson support?

Post by Thristian »

D-- wrote:Am I wrong to assume an 8-core 64-bit risc at 1.4 GHz will probably be able to run bsnes?
Well, the eight cores won't help, and I don't think bsnes has been ported to any fundamentalist RISC architectures (even older versions of bsnes struggled on my 1.6GHz PowerPC G5, but I don't know if that was just OS X being piggish.
By the way, how can I get ahold of bearoso to let him know snes9x-gtk cannot compile on a Loongson even with assembler hacks off?
He's pretty responsive to posts in his thread in the SNES9x forums.
D--
Rookie
Posts: 17
Joined: Sat Feb 07, 2009 2:59 pm
Location: Chaoyang District, Beijing, China
Contact:

Post by D-- »

Just providing the information. byuu and I talk regularly and he has mentioned an interest in Loongson support. I just wanted to get this down somewhere public so there would be more people providing input than our two-man AIM chats.
Verdauga Greeneyes
Regular
Posts: 347
Joined: Tue Mar 07, 2006 10:32 am
Location: The Netherlands

Post by Verdauga Greeneyes »

Eight cores would be enough to dedicate a core to each component of the SNES, I expect. But it's all about the speed of synchronisation between the cores.. if it can't sync up the millions of times per second bsnes needs, all its cores will mean nothing. (of course, in its current form bsnes can't handle more than one physical core anyway)
byuu

Post by byuu »

If I can provide any information to help with getting bsnes ready to compile on the 2F, it should be useful so bsnes will work on the Loongson 3 when that chip is released.
Appreciate the help.

The only non-ISO C++ portion of bsnes is libco, which amounts to ~1-2kb of code per platform that has to be written in assembler.

I would be very interested in porting libco to the MIPS architecture, but it's going to be very tough without having access to one.

Even for the x86, it took me ~50 or so compile tries to get it working there. I think if we were to do this, I'd need a shell account on your Loongson. I would also need the full instruction set reference, and ABI (application binary interface) convention for Loongson/Linux.

Or perhaps someone here is familiar with the MIPS architecture? The Loongson is extremely similar, they just didn't buy the license themselves, instead going through a Canadian company, IIRC.
Am I wrong to assume an 8-core 64-bit risc at 1.4 GHz will probably be able to run bsnes?
It's a possibility. My 1.8GHz Pentium Dual-Core (half-cache Core 2) was capable of ~60-70fps. If the MIPS architecture is more efficient, it could work. Note that the Atom in-order CPU in other netbooks gets ~40fps now.

Otherwise, the eight-core part is really promising. Right now, VG is right that I can only use one thread.

But if a platform had really tight thread synchronization (~50-100x faster than on x86), then I could indeed use one core per emulated chip. In theory, that would give me enough power for even SuperFX / SA-1 support, or a dot-accurate PPU.

The entire libco architecture was designed with this in mind. Though it's coöperative for now, it really only needs to replace co_switch(dest) with dest->lock = true; co_waitfor(dest->lock == false); and it will be truly multi-threaded.

PCs though, they only have 2-4 cores (I need at least 4 of my own), and I can only sync two threads ~100k times a second, versus the ~10 million I'd need, and that's just for syncing without any actual emulation.

Eight cores is really promising ... I'll have to look into ordering one when they come out, perhaps.
ZH/Franky

Post by ZH/Franky »

longson... isn't that the new chinese CPU that's getting a lot of attention lately? It's a 32-bit MIPS processor, right?
EDIT:
Yes, I remember now. Derrick Sobodash talked about it on his website:
http://cinnamonpirate.com/2009/01/enter ... on-laptop/
byuu

Post by byuu »

Good news, SJLJ libco works on the MIPS Loongson 2F. Meaning bsnes will work, however slowly we do not know. Way to go, Nach!!

Code: Select all

~/libco/test$ ./test_timing
context-switching timing test

0.140 seconds per  50 million subroutine calls (5000000 iterations)
2.180 seconds per 100 million co_switch  calls (5000000 iterations)
co_switch skew = 15.571429x
That makes me ~70% certain that it will work on the PS3 as well.
D--
Rookie
Posts: 17
Joined: Sat Feb 07, 2009 2:59 pm
Location: Chaoyang District, Beijing, China
Contact:

Post by D-- »

ZH wrote:longson... isn't that the new chinese CPU that's getting a lot of attention lately? It's a 32-bit MIPS processor, right?
EDIT:
Yes, I remember now. Derrick Sobodash talked about it on his website:
http://cinnamonpirate.com/2009/01/enter ... on-laptop/
Hi to you, too. I guess you didn't check my profile. The Loongson 2F is a 64-bit MIPS-compatible CPU, though it has its own instructions in addition to MIPS. It's significant for drawing only 4W at 1GHz which is amazing for a chip made on a 90nm process. It also has an on-chip northbridge included int hat figure, putting it far below the power consumption of an Intel Atom which relies on a power-wasting VIA northbridge.
byuu wrote:Good news, SJLJ libco works on the MIPS Loongson 2F. Meaning bsnes will work, however slowly we do not know. Way to go, Nach!!

Code: Select all

~/libco/test$ ./test_timing
context-switching timing test

0.140 seconds per  50 million subroutine calls (5000000 iterations)
2.180 seconds per 100 million co_switch  calls (5000000 iterations)
co_switch skew = 15.571429x
That makes me ~70% certain that it will work on the PS3 as well.
Is SJLJ in the latest bsnes source package? If so I'll try compiling it later tonight. Snes9x-gtk I'm done with until BearOso makes some big changes. Four hours of work to make it link, then discovering it had no sound output or video output with any combination of settings was disappointing, especially since those were the few areas that didn't have trouble building :( Maybe I'll try it again with absolutely no gcc optimizations to see if it's even possible.

But you are really going to need a MIPS assembler core if you want to bring that sync speed down. I'm not sure the Loongson3 will offer a big enough speed jump to overcome that delay, and if you're talking about syncing multiple cores ... it could get pretty hairy I would think.

On the up side, you have an Xv display which should help a lot. SDL's refusal to hook an Xv port is one of the things crippling mednafen on the Loongson right now. After profiling it almost has enough power for the GBA, assuming no software scaling and a big sound buffer. SDL sound has some problems too :(

Side note: I have bview, tsukuyomi and xkas packaged for Loongson. Is there anything else you want me to build besides bsnes?
ZH/Franky

Post by ZH/Franky »

Hi to you, too. I guess you didn't check my profile. The Loongson 2F is a 64-bit MIPS-compatible CPU, though it has its own instructions in addition to MIPS. It's significant for drawing only 4W at 1GHz which is amazing for a chip made on a 90nm process. It also has an on-chip northbridge included int hat figure, putting it far below the power consumption of an Intel Atom which relies on a power-wasting VIA northbridge.
Oh, you're Derrick Sobodash? Well, hey there :)

I didn't really know the exact details. I read through some of your posts on cinnamonpirate, albeit quickly from time to time; I got the impression that the loongson 2F is a 32-bit MIPS cpu. So, it's 64-bit and has it's own instruction set: what's the name of this instruction set? Aside from it being MIPS-compatible.
D--
Rookie
Posts: 17
Joined: Sat Feb 07, 2009 2:59 pm
Location: Chaoyang District, Beijing, China
Contact:

Post by D-- »

Let's think about this:

The instruction set of the 6502 is the 6502 instruction set.
The instruction set of the Z80 is the Z80 instruction set.
The instruction set of the 68000 is the 68000 instruction set.
The instruction set of the 486 is the x86 instruction set.
The instruction set of the MIPS is the MIPS instruction set.

Would you like to try guessing again what the instruction set of the Loongson is?
DataPath
Lurker
Posts: 128
Joined: Wed Jul 28, 2004 1:35 am
Contact:

Post by DataPath »

ZH wrote:I didn't really know the exact details. I read through some of your posts on cinnamonpirate, albeit quickly from time to time; I got the impression that the loongson 2F is a 32-bit MIPS cpu. So, it's 64-bit and has it's own instruction set: what's the name of this instruction set? Aside from it being MIPS-compatible.
MIPS-III.
ZH/Franky

Post by ZH/Franky »

D-- wrote:Let's think about this:

The instruction set of the 6502 is the 6502 instruction set.
The instruction set of the Z80 is the Z80 instruction set.
The instruction set of the 68000 is the 68000 instruction set.
The instruction set of the 486 is the x86 instruction set.
The instruction set of the MIPS is the MIPS instruction set.

Would you like to try guessing again what the instruction set of the Loongson is?
<|>_<_>_<|>
Let me guess, the Spoony-bard instruction set?
Panzer88
Inmate
Posts: 1485
Joined: Thu Jan 11, 2007 4:28 am
Location: Salem, Oregon
Contact:

Post by Panzer88 »

good to see you around D.
[quote="byuu"]Seriously, what kind of asshole makes an old-school 2D emulator that requires a Core 2 to get full speed? [i]>:([/i] [/quote]
D--
Rookie
Posts: 17
Joined: Sat Feb 07, 2009 2:59 pm
Location: Chaoyang District, Beijing, China
Contact:

Post by D-- »

Well, compiled and profiled. bsnes gets a peak of 23 fps on the Loongson 2F at 796MHz and an average of 18 fps. I did not try it with the CPU overclocked to its maximum speed of 1GHz.

The most interesting point is that the Xv driver works how it should, with absolutely no speed penalty no matter how you scale it. If mednafen adds support for this driver, it will have full speed on every system except PC-FX. Currently it can only achieve this with no scaling, meaning no possibility of full-screen gaming.
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

D-- wrote:Let's think about this:

The instruction set of the 6502 is the 6502 instruction set.
The instruction set of the Z80 is the Z80 instruction set.
The instruction set of the 68000 is the 68000 instruction set.
The instruction set of the 486 is the x86 instruction set.
The instruction set of the MIPS is the MIPS instruction set.

Would you like to try guessing again what the instruction set of the Loongson is?
Eh, it's just Franky

don't worry about him
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

Why did Franky change username? to "somehow" hide away from all the negativity he has gotten ever since joining here?
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
ZH/Franky

Post by ZH/Franky »

franpa wrote:Why did Franky change username? to "somehow" hide away from all the negativity he has gotten ever since joining here?
Fuck you. I just wanted a better name, and ZH sounded cool.
Like I give a shit what you guys think of me anyway.
kick
Trooper
Posts: 550
Joined: Wed Mar 01, 2006 8:47 pm

Post by kick »

ZH = Chinese
[i]Have a nice kick in da nutz[/i] @~@* c//
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

he says it means Zero Hero

but yeah ZH is for Chinese, lol

in after TL Note
D--
Rookie
Posts: 17
Joined: Sat Feb 07, 2009 2:59 pm
Location: Chaoyang District, Beijing, China
Contact:

Post by D-- »

ZHongwen.

And stop derailing my damn thread :(
Gil_Hamilton
Buzzkill Gil
Posts: 4294
Joined: Wed Jan 12, 2005 7:14 pm

Post by Gil_Hamilton »

D-- wrote:ZHongwen.

And stop derailing my damn thread :(
I'd just like to say you have the best avatar ever, before this gets back on track.
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

kick wrote:Franky is a weeaboo
Fixed, also explains a lot..
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
funkyass
"God"
Posts: 1128
Joined: Tue Jul 27, 2004 11:24 pm

Post by funkyass »

adventure_of_link wrote:
kick wrote:Franky is a weeaboo
Fixed, also explains a lot..
you have no clue what a weeaboo is do you?
Does [Kevin] Smith masturbate with steel wool too?

- Yes, but don’t change the subject.
gllt
NO VOWELS >:[
Posts: 753
Joined: Sun Aug 31, 2008 12:59 pm
Location: ALABAMA
Contact:

Post by gllt »

funkyass wrote:
adventure_of_link wrote:
kick wrote:Franky is a weeaboo
Fixed, also explains a lot..
you have no clue what a weeaboo is do you?
Derail; AoL postcount + butar > your postcount

Rerail; Where would one obtain one of these processors and in what environment would it be found suitable, I never get to work much outside an x86 environment and I'm terribly interested!
D--
Rookie
Posts: 17
Joined: Sat Feb 07, 2009 2:59 pm
Location: Chaoyang District, Beijing, China
Contact:

Post by D-- »

At the moment you would need to contact Lemote. You might also look into the Beijing Linux Users Group. The vice president Pockey Lam and some of the other members work for the company producing the Gdium, which is more targeted toward foreign users (Lemote offers NO English support). Your current options are:

In Production:
Yeeloong 8089a (2G SSD, 512M RAM, SM712 video, 2 USB ports)
Yeeloong 8089b (160G HD, 1G RAM, SM712 video, 3 USB ports, webcam that doesn't work)

Pre-Production:
Gdium (16G "G-Key" [USB flash on which the OS is stored, slides seamlessly into a socket under the touchpad], 512M RAM, SM502 video)

There is also the E-benton, though I'm told they royally fucked Lemote and never paid them for all the technology they borrowed. Chances are you won't see many more of their computers.

For a full desktop system instead of a netbook, there is the Fulong 2F box. It comes with an 80G hard disk and 512M RAM. Too many ports to list. Built to be the same size as a CD-ROM USB enclosure, requires a keyboard, mouse and monitor.

These all cost between $210 and $500. Mine (the 8089a) was $300.
Locked