6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Sep 28, 2024 2:18 pm

All times are UTC




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Jul 26, 2021 10:38 pm 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
Hey guys!

I was wondering, assuming the perfect circuit, bottlenecks, overclocking and all that stuff aside - Would a dual 6502 setup perform faster at say 5MHz a piece, than a single 10MHz 6502?

At first thought I figured it would have to, but then thinking about it, the performance would have to be the same wouldn't it? As you'd have the sacrafice of halving the clock speed.

So I thought I'd ask the experts what their thoughts were (yes, that's you guys! :lol: )

Again, I'm not really after "just overclock" or things like that. I'd like to stick to the 'rule of the discussion' that you either have 10MHz for one or 5 MHz for two. Unless there's something really 'out of this world' that might be worth adding to this.

Love to hear your thoughts :D


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 26, 2021 11:05 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8520
Location: Southern California
This recent topic will be of interest:
A multiprocessor system with mainly just the 6502 (?)
(and it has links to more).

I recommend this post from Andre Fachat too:
Parallel Processing with 6502s

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 26, 2021 11:19 pm 
Offline
User avatar

Joined: Mon Apr 23, 2012 12:28 am
Posts: 760
Location: Huntsville, AL
I think that you may need to consider whether, in your application, the potential speedup provided by your dual 6502 processor will be limited in the manner described by Amdahl's Law. Another consideration may be that a heterogenous processor, one consisting of different processor cores with different instruction sets / performance, may provide a better means of extracting greater speedup than may provided by a homogenous processor consisting of a single processor and instruction set type.

This is a fascinating subject, and will likely generate lively arguments in favor of a single fast processor (essentially Amdahl's argument), or arguments in favor of multiple processors. :D

_________________
Michael A.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 26, 2021 11:49 pm 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
Cool, thanks for the heads up, Garth. Interesting topics! 8)

Doesn't seem to address if two CPU's running at half speed are faster than one running at full speed, which is more of what I was wondering.

Not so much 'if you can run a system with multiple CPU's', which the answer is always going to be 'yes' on that front.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 26, 2021 11:50 pm 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
MichaelM wrote:
I think that you may need to consider whether, in your application, the potential speedup provided by your dual 6502 processor will be limited in the manner described by Amdahl's Law. Another consideration may be that a heterogenous processor, one consisting of different processor cores with different instruction sets / performance, may provide a better means of extracting greater speedup than may provided by a homogenous processor consisting of a single processor and instruction set type.

This is a fascinating subject, and will likely generate lively arguments in favor of a single fast processor (essentially Amdahl's argument), or arguments in favor of multiple processors. :D


Yeah, I can see for and against in both. So, I'm interested on see peoples thoughts on this.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 27, 2021 12:31 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8520
Location: Southern California
J64C wrote:
Cool, thanks for the heads up, Garth. Interesting topics! 8)

Doesn't seem to address if two CPU's running at half speed are faster than one running at full speed, which is more of what I was wondering.

Not so much 'if you can run a system with multiple CPU's', which the answer is always going to be 'yes' on that front.

They do address the administrative overhead of assigning and sharing the loads, and of the communication time needed to split the load then put the data back together after each processor has done its part. This overhead will, in most cases, reduce the performance to well below the product of the MHz times the number of processors. (IOW, in most cases, two 6502's each running at 5MHz cannot give the performance of a single one running at 10MHz.) There also have links to the Wikipedia articles on Amdahl's law (which MichaelM mentioned) and Gustafson's law.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 27, 2021 12:48 am 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
That's assuming there is overhead of assigning and sharing loads. I know I'm the new guy and don't know better. But I'm designing something as I type this. 8)

(I know, we all know an ambitious newbie. Look's like I'm him this time round :lol: )

With what I have in mind, there will be no need for sharing loads and assigning of tasks. Thankfully, I'm not a "make my thing for me" type of person. I'm very much a hands on type.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 27, 2021 1:18 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8403
Location: Midwestern USA
Knowing that the WDC 65C02 can easily run at or beyond 20 MHz (q.v., the FMAX vs VCC curve in the data sheet), I'm not visualizing any good reason for this exercise. A single 65C02 at 20 MHz will easily outperform two of them running at 10 MHz, if for no reason other than both can't share resources without operating on opposite clock phases. That, in turn, will raise complications for any part of the system (mainly I/O hardware) that requires specific things to happen during specific clock phases.

If this is an exercise whose purpose is "let's see if I can do it" then best of luck. The hardware design and execution will be interesting.

If you are working toward higher performance, I think you are going to be disappointed.

In any case, the 65C816 would be better suited to this sort of thing than the 65C02 because of the former's ability to let the logic know exactly what it is up to (using MLB, VDA, VPA and VPB to control the glue logic), as well as having the flexibility of defining the stack and direct page anywhere in bank $00 RAM.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 27, 2021 1:35 am 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
Thanks BDD! And yep, it is pretty much purely an exercise of 'wonder if I can'.

For me, pushing things like that has always given me a finer understanding of the intricate details. So when it's to to go back an play 'sensible', then things are a total breeze.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 27, 2021 7:48 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1467
Location: Scotland
J64C wrote:
Hey guys!

I was wondering, assuming the perfect circuit, bottlenecks, overclocking and all that stuff aside - Would a dual 6502 setup perform faster at say 5MHz a piece, than a single 10MHz 6502?



If only it worked like that ...

You'd need to write your code to utilise both (or more) CPUs - and that's a topic that's been thought about for decades now. Code doesn't magically "just work" when you throw multiple CPUs at it - and some problems work better than others.

I was working for a supercomputer company in the late 80's/early 90's and the usual question we got: I have this 30 year old FORTRAN program: Make it go faster. ... So we ended up doing the hard work of parallelising it, re-writing it and so on. Mostly if they used standard libraries then we'd just link in our version of that library to get the speed-up they wanted, but sometimes that didn't work and the program needed a re-think...

Problems with the same data set often do work well - take ray tracing (or Mandelbrot) for an example - to generate each point in the final image you need to look at the whole 'scene' - if you have one CPU per pixel then you get a great speed-up, but then your problem becomes one of data-flow - getting the data into and out of each CPU fast enough.

(and you may be surprised at just how many problems look like ray tracing in certain fields... Modelling tiny droplets of ink from an ink-jet printer, or a nuclear bomb exploding, nanosecond by nanosecond...)

So it's not just a matter of throwing CPUs at a problem, often the problem has to be re-designed.

It's a fascinating subject though - today we have far better tools and program analysers that we had 30 years back too.

Thinking what we might be able to do with a multiple CPU 6502 system - well, it's purely academic and/or a great hobby project in terms of compute capacity compared to the processing power in a modern smartwatch, but some things are possible for a demonstration - parallel quicksort, even mandelbrot and other fractals which are visually nice or even "the game of life", but making the action of 'copy a file' go faster? tricky ...

Cheers,

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 27, 2021 7:56 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Just to chip in...

I can't see any reason why two half-speed CPUs might outperform one full-speed CPU: at best, you'll run exactly the same number of instructions per second, and have the same aggregate memory bandwidth.

As noted, you've added a rigid demarcation between the tasks which might run: if they are not doing exactly equal work then you'll have unused capacity on one CPU.

The reason to have two CPUs is when you can arrange for a greater aggregate instruction rate or memory bandwidth - but you still have to reckon with task granularity.

What you do get is a more interesting system which offers more challenges, in the construction and the usage.

If the two CPUs share memory, then you don't get extra memory capacity... and if they have separate memory, you have a bigger challenge of communicating between them.

As a final note, I think the software aspect is going to be at least as challenging as the hardware aspect: so, again, if you're after more challenge, go for it.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 27, 2021 8:14 am 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
Thanks guys! Some great points and things to think about.

Yeah, I agree that software is just as much the issue in this project as well and you never get 100% scalability. Exactly the same sort of thing when dealing with multithreaded applications.

I started designing a dual CPU PCB today that I’ll use as a experimental test bed. Got lots in mind that I want to try out, which I find is half the fun. If it crashes and burns, then oh well! Haha! No harm can possibly come from it, as I’ll be learning a heap along the way.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 27, 2021 8:15 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8520
Location: Southern California
BigEd wrote:
I can't see any reason why two half-speed CPUs might outperform one full-speed CPU

An example I saw once where multiple processors might make a dramatic speed-up is this search:
Code:
                            ┌──Item searched for happens to be here.
                            │
                            V
     ┌────────────────────┬────────────────────┐
     │   Processor 1      │    Processor 2     │
        searches this         searches this
          portion.              portion.

If there are two processors and the array or file to be searched is split in two, with each processor searching half, you can see that if the searched-for item is, say, 55% of the way through the array or file, the second processor will find it soon after starting, whereas a single processor doing the job by itself would take about ten times as long. This is kind of an exception though, which is why I said that in most cases, overhead will reduce the performance to well below the product of the MHz times the number of processors.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 27, 2021 9:12 am 
Offline

Joined: Fri Jul 09, 2021 10:12 pm
Posts: 741
The only benefit I can see for two half speed processors is that they have their own registers, and the 6502 is short of those.

A couple of years ago I was thinking about a design where two 6502s run from the same clock, and have their own memory (code and data), but the address bus is shared, driven only by the primary CPU. The secondary CPU could receive the same instruction stream from its memory, or different instructions (within tight constraints!) and would have its own separate data to input and output.

It was just a crazy idea a bit like J64C's, I never worked out if there was actually any value to it. A difference here is that you could run at a fast clock speed, as far as the memory can tolerate, and you're not running both CPUs off the same memory.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 27, 2021 9:39 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Hmm, good point about the extra registers - I can't quite see it in detail, but it just might give an advantage.

Garth, your searching example is interesting, but I think it doesn't show an advantage. It's just as likely that the result will be found at the 45% point, in which case the dual-cpu system takes longer. Indeed, it's easy to see that the single CPU system will on average work through half the data, at full speed, whereas the dual CPUs will on average work through a quarter the data, but at half speed. (In the case of a binary search rather than a linear search, the single CPU system takes about half the time as the dual-CPU system, I think, but the dual CPU system has one CPU free to get on with the next search, so again it's a draw. Maybe!)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: