gtechn
Posts: 156
Joined: Thu Jan 07, 2016 5:32 pm

Weird Thought

Tue May 09, 2017 4:21 pm

Hello,

I don't expect this on a Raspberry Pi (pretty much ever), but I had an odd thought recently.

Every CPU has an instruction set. x86, x64, ARM, RISC-V. There are programs (like QEMU) which translate instruction sets to run on others, but slowly.

Could a processor, theoretically, build an instruction-set conversion tool into the chip and therefore be able to accept 2 instruction sets at once?

For example: An Intel processor, with circuitry that converts ARM to x86 from processing, then from x86 back to ARM for the result, to run an ARM version of Android. In Hardware.

So, I am curious all of you chip designers and electrical engineers out there, why would something like this not be achievable? (Other than the heavy cost to design such conversion chips.)

W. H. Heydt
Posts: 11010
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Weird Thought

Tue May 09, 2017 4:28 pm

gtechn wrote:Hello,

I don't expect this on a Raspberry Pi (pretty much ever), but I had an odd thought recently.

Every CPU has an instruction set. x86, x64, ARM, RISC-V. There are programs (like QEMU) which translate instruction sets to run on others, but slowly.

Could a processor, theoretically, build an instruction-set conversion tool into the chip and therefore be able to accept 2 instruction sets at once?

For example: An Intel processor, with circuitry that converts ARM to x86 from processing, then from x86 back to ARM for the result, to run an ARM version of Android. In Hardware.

So, I am curious all of you chip designers and electrical engineers out there, why would something like this not be achievable? (Other than the heavy cost to design such conversion chips.)
It's been done. What you are talking about is what an "emulator" really is, as it's done largely in hardware. I can cite two instances that I know about. The first was on IBM S/360 mainframes. To support legacy code, the S/360s had an optional 1401 emulator (I worked with it in the early '70s). The hardware was supported with software that simulated the 1401s environment, using things like JCL statements to "set" console switches that the S.360 didn't actually have. The other was the Transmeta chips that were supposed to emulate an Intel x86 on an internal RISC design, with the ability to emulate other chip architectures as well.

hippy
Posts: 6093
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Weird Thought

Tue May 09, 2017 7:25 pm

gtechn wrote:Could a processor, theoretically, build an instruction-set conversion tool into the chip and therefore be able to accept 2 instruction sets at once?
Many ARM chips support a full instruction set and a Thumb instruction set.

A fast, direct hardware-only translation is possible where one instruction set is a subset of the other or there is good mapping between them, but micro-code and emulation can do the job or assist with that when there isn't.

User avatar
PeterO
Posts: 5079
Joined: Sun Jul 22, 2012 4:14 pm

Re: Weird Thought

Tue May 09, 2017 7:37 pm

W. H. Heydt wrote:The other was the Transmeta chips that were supposed to emulate an Intel x86 on an internal RISC design, with the ability to emulate other chip architectures as well.
That's what I though as well, until I went and looked up Transmeta. I can't find any mention of them producing anything other than X86 derivatives.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Heater
Posts: 13668
Joined: Tue Jul 17, 2012 3:02 pm

Re: Weird Thought

Tue May 09, 2017 7:51 pm

This is exactly what happens in modern Intel x86 processors.

Firstly your 64 bit x86 machine still boots up in a mode that runs the good old 16 bit instruction set of the original Intel 8086/8088 as used in the original IBM PC. After boot in gets switched into the new swanky 64 bit mode.

The 64 bit instruction set is derived from the old 16 bit one but is practically very different, with more registers, some instructions dropped, many others added.

From what I recall of the guts of x86 it is possible for a 32 or 64 bit machine to also run 16 bit code, in it's own 16 bit memory segments. I don't know if there is any OS that supports that though.

Further...the x86 instruction set is amazingly irregular and complex, in order to get speed modern Intel chips translate that on the fly into their own simple instruction set, which fits better with the pipelining, parallel execution, etc that you need for speed.

Google Complex Instruction Set Comuter (CISC) vs Reduced Instruction Set Computer (RISC) to see what that is all about.

The ARM seems to have about a dozen different instructions sets. Which is why the instruction set manual for it is many hundreds of pages. ARM used to be regarded as RISC but it has a ton of complex instructions today.

There were older ARMs that even ran Java byte codes directly. How nuts is that?!

All in all, my gut tells me that having a CPU execute multiple instruction sets is not the way to go for an efficient and fast machine.
Memory in C++ is a leaky abstraction .

Heater
Posts: 13668
Joined: Tue Jul 17, 2012 3:02 pm

Re: Weird Thought

Tue May 09, 2017 7:54 pm

PeterO,

I seem to recall the claim that the Transmeta chip could be morphed into running different instruction sets, presumably by reprogramming it's microcode or whatever on the fly.

They hired Linus Torvalds to make it work!

I suspect the company did not live long enough to support any other architectures. And there is not enough Linus Torvalds around :)
Memory in C++ is a leaky abstraction .

User avatar
PeterO
Posts: 5079
Joined: Sun Jul 22, 2012 4:14 pm

Re: Weird Thought

Tue May 09, 2017 8:06 pm

Heater wrote:I suspect the company did not live long enough to support any other architectures. And there is not enough Linus Torvalds around :)
And reading about them , it seems they got overtaken by Intel and AMD's own improvements in speed and lower power consumptions.
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Weird Thought

Tue May 09, 2017 8:42 pm

Heater wrote:All in all, my gut tells me that having a CPU execute multiple instruction sets is not the way to go for an efficient and fast machine.
If the number of transistors that is possible gets farther ahead from the ability to cool them, the amount of dark silicon will increase. So the question might be how do you use those extra transistors when you can't turn them all on at once. Maybe an answer is to dedicate some of them to jobs that don't need to happen at once, such as this idea of having support for different CPU instruction sets in hardware. So a core could be AMD64 or ARM64 but not both at the same time. If you have a thousand cores, some cores might be ARM64 all the time and others AMD64 all the time but many would be switching between supporting one or the other as demands changed.

Heater
Posts: 13668
Joined: Tue Jul 17, 2012 3:02 pm

Re: Weird Thought

Tue May 09, 2017 9:46 pm

stderr,

That is an interesting point re: dark silicon.

I'm told that we have pretty much hit the end of the road as far as Moore's law is concerned. So we can't expect to see the huge rises in transistor count that we have become used to.

Personally I see no reason to support multiple instruction sets. The motivation for that would be supporting old binaries or mixing and matching binaries from different vendors and operating systems. Supporting the ISA is one thing, but to be useful you also have to support the OS/libraries/environment those binaries can run in. It all get's overly complex and out of hand.

Far better in my mind that we demand open source software and a common instruction set architecture.

Any dark transistors available can be set to doing useful work when required, not supporting legacy binaries.
Memory in C++ is a leaky abstraction .

W. H. Heydt
Posts: 11010
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Weird Thought

Tue May 09, 2017 10:27 pm

Heater wrote:stderr,

That is an interesting point re: dark silicon.

I'm told that we have pretty much hit the end of the road as far as Moore's law is concerned. So we can't expect to see the huge rises in transistor count that we have become used to.

Personally I see no reason to support multiple instruction sets. The motivation for that would be supporting old binaries or mixing and matching binaries from different vendors and operating systems. Supporting the ISA is one thing, but to be useful you also have to support the OS/libraries/environment those binaries can run in. It all get's overly complex and out of hand.

Far better in my mind that we demand open source software and a common instruction set architecture.

Any dark transistors available can be set to doing useful work when required, not supporting legacy binaries.
While not a single chip solution, I suggest taking note of the S/360-30, where the I/O channels were actually implemented in the hardware as a mode switch on the CPU. (In other models starting the the Model 40, the channels were actually additional hardware.)

Since I/O is invariably slower than the GPU/CPU and even DRAM, "dark silicon" could be used for dedicated I/O processors and only go active when an interupt occurs. It could even be done the way the CDC 6600 worked. On that machine, there was a 60-bit word Central Processor (CP) and 8 18-bit word Peripheral Processors (PPs). The OS ran on PP0, so there was no system time on the CP at all, its cycles were dedicated to applications programs. The other PPs handled I/O.

I must admit that I find it mildly amusing that something IBM did 50 years ago in the earliest S/360s (hardware emulation) suddenly pops up as a new idea...

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Weird Thought

Wed May 10, 2017 7:27 am

This thread has reminded me of another machine that attempted to do something very similar, One of the early ARM machines :D

The Acorn Risc PC has two processor slots, One would host an ARM Processor running the main RiscOS operating system, the second slot could host a i486/i586 (fairly current at the time) processor which allowed you to run a native DOS/Windows environment at the same time. Ram and other peripherals were shared between the two processors.

In most cases I suspect the cost of building something similar now is probably higher than just buying two dedicated systems.

hippy
Posts: 6093
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Weird Thought

Wed May 10, 2017 11:22 am

mfa298 wrote:The Acorn Risc PC has two processor slots, One would host an ARM Processor running the main RiscOS operating system, the second slot could host a i486/i586 (fairly current at the time) processor which allowed you to run a native DOS/Windows environment at the same time.
Perhaps something for the Pi 5 :P

I have pondered the viability of an ARM + X86 architecture, but it's not purely about the CPU and hardware. If software emulation can deliver an integrated Linux plus Windows platform having physical X86 hardware could improve on that. Whether it would be worth the cost is key. If there is an X86 core available that should be no more difficult than dropping any other core on a silicon die, though it may be larger and have higher power demands. It doesn't have to run full-tilt; just be fast enough to deliver what that Linux + Windows user wants.

We have tended to stick with a 'choose one architecture, choose one OS, and, if you want anything else, emulate that' approach. The idea of being able to run multiple OS's let alone multiple architectures on a single machine hasn't been seen as credible or viable. Probably because it's felt that would mean paying for something which is only rarely used, it would be a 'jack of all trades, master of none' approach, and have zero appeal to people who only want one architecture, one OS.

With loyalties to architectures and OS disappearing there is more interest these days in supporting more than one.

User avatar
rpdom
Posts: 15417
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Weird Thought

Wed May 10, 2017 7:52 pm

mfa298 wrote:This thread has reminded me of another machine that attempted to do something very similar, One of the early ARM machines :D

The Acorn Risc PC has two processor slots, One would host an ARM Processor running the main RiscOS operating system, the second slot could host a i486/i586 (fairly current at the time) processor which allowed you to run a native DOS/Windows environment at the same time. Ram and other peripherals were shared between the two processors.
Perhaps similar to the "tube" interface on the original BBC Microcomputers. That allowed them to connect a variety of boxes running different CPUs such as Z80, NS32016 and ARM1, just using the original Beeb as an I/O Processor handling video, disk, tape, network, printer, keyboard and so on.

Heater
Posts: 13668
Joined: Tue Jul 17, 2012 3:02 pm

Re: Weird Thought

Wed May 10, 2017 7:59 pm

ARM + X86 architecture...

Great, worst of both worlds. Pay for the licensing of ARM and pay for the licensing of x86.

And all the horrible complexity of running and supporting mutiple operating systems.

Sounds like a horrible kludge that will flop like it did in the early 1980's.
Memory in C++ is a leaky abstraction .

hippy
Posts: 6093
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Weird Thought

Thu May 11, 2017 10:20 am

Heater wrote:ARM + X86 architecture...

Great, worst of both worlds. Pay for the licensing of ARM and pay for the licensing of x86.

And all the horrible complexity of running and supporting mutiple operating systems.

Sounds like a horrible kludge that will flop like it did in the early 1980's.
Yes; those are the arguments against. But people are becoming increasingly frustrated at being tied to one platform with one OS and not having access to things which require something else.

Anyone who has ever tried to create a program which runs on Linux, Windows, Chrome OS, Android and IOS knows what a nightmare that is, wishes it were the case they could easily create one app which ran on everything.

Users and developers are looking for some kind of convergence. We have virtual machines and emulators but they are rarely nicely integrated with their hosts. We have a move to the cloud and things which run in browsers but people like to have native apps. And currently no one will agree on what the single framework which will rule them all will be, and perhaps never will.

We need solutions which improve the situation even if they don't entirely solve them. There does seem to be resurgence of interest in multi-architecture chips. I don't know if it is the solution ( and as I have said its more than just a hardware issue ) but it does seem to be one solution people at higher pay grades than me are again looking at.

YCN-
Posts: 246
Joined: Fri Jun 10, 2016 3:18 pm

Re: Weird Thought

Thu May 11, 2017 12:25 pm

It's been done and very well done, look at ARM intrinsics and Intel intrinsics, you can use several different version of the same kind of very close to processor intructions.

intel (SSE & friends) : https://software.intel.com/sites/landin ... sicsGuide/
arm (NEON) : http://infocenter.arm.com/help/index.js ... JBEFE.html
NEON to SSE : https://software.intel.com/en-us/blogs/ ... and-tricks

YCN-

User avatar
rpdom
Posts: 15417
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Weird Thought

Thu May 11, 2017 8:29 pm

hippy wrote:But people are becoming increasingly frustrated at being tied to one platform with one OS and not having access to things which require something else.
Indeed. That is why I stopped using Windows many years ago.

hippy
Posts: 6093
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Weird Thought

Fri May 12, 2017 12:17 am

rpdom wrote:That is why I stopped using Windows many years ago.
It is a problem which affects all systems. Moving from Windows to something else is just as problematic if there is something which happens to be Windows only which needs to be used, or anything else which the chosen system cannot run.

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: Weird Thought

Fri May 12, 2017 12:53 am

hippy wrote:
rpdom wrote:That is why I stopped using Windows many years ago.
It is a problem which affects all systems. Moving from Windows to something else is just as problematic if there is something which happens to be Windows only which needs to be used, or anything else which the chosen system cannot run.
The thing is that if there is one big OS, then there would be no competition and development may move at a slower place. I personally use only Linux on all my computers, but competition is needed as well, as hard as it is. I just want more programs to support Linux.
There are 10 types of people: those who understand binary and those who don't.

hippy
Posts: 6093
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Weird Thought

Fri May 12, 2017 9:24 am

kusti8 wrote:I just want more programs to support Linux.
It would be nice but there are three factors which are working against that for those who currently produce apps which only work on Windows.

First; Windows usually has a much greater market share of people who would be using that app. Linux may be dominant in embedded, server and mobile systems, but for day to day desktop use it lags behind Windows. ROI and take-up can be better achieved by focusing on Windows than on Linux.

Second; developing for Linux can feel like building on shifting sand. There are so many different distros out there with slightly different ways of doing things that it can be an effort to support what the user may be wanting to use. Libraries may be present on one system but not on another, versions may be different and incompatible, things like udev rule format changes can make setup instructions obsolete and not work, distros dropping support for 32-bit is a major pain when that's what the developer tools produce.

The company I work for has a Linux product which on some distros sometimes crashed losing people's work. No idea why but the cause seemed to lay outside our application. But because it was our app crashing we were taking the flak, suffering reputational damage from that. Those people who reported the issue are now reporting everything is fine since there's been a new distro release. It seems it wasn't our fault, but we suffered for it.

Even building things on Linux, intended for Linux, with instructions on how to do that, can be problematic. I was going to say I have lost count of how many times that has happened, but in truth it's probably very few - VS Code, AIY the latest I recall on Raspbian - but enough for that to feel like a very major issue. If Linux experts cannot always make things work, what chance developers who aren't experts with Linux ?

Third; there's the framework problem. If one doesn't want separate apps for each platform one has to choose a multi-platform framework and that may mean moving towards the lowest common denominator. That can be commercially disadvantaging against others who are using the latest whiz-bang, very shiny, Windows-only frameworks.

There is also the toolset issue. Everyone likes what they have, don't like change, and if those tools don't support Linux, 64-bit or, increasingly important, ARM, it needs a convincing argument to make change to something which does. And it is difficult to decide what should that should be.

I am not trying to start a Windows-Linux war, not arguing Windows is best or better, the right way to go. I am just explaining how it sometimes is. Not all companies have massive resources and the skills to do everything, and supporting Linux can often feel onerous with little real benefit.

And it's no good telling me I am wrong, am short sighted, that there are solutions, it is actually easy or whatever; people need to go and tell those companies producing apps, convince them.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Weird Thought

Fri May 12, 2017 10:02 am

hippy wrote:
kusti8 wrote:I just want more programs to support Linux.
It would be nice but there are three factors which are working against that for those who currently produce apps which only work on Windows.

First; Windows usually has a much greater market share of people who would be using that app. Linux may be dominant in embedded, server and mobile systems, but for day to day desktop use it lags behind Windows. ROI and take-up can be better achieved by focusing on Windows than on Linux.
...
And it's no good telling me I am wrong, am short sighted, that there are solutions, it is actually easy or whatever; people need to go and tell those companies producing apps, convince them.
Whilst we're probably heading slowly off on a tangent here that's well put and I'd agree with all those points.

I'd also add in the manageability of systems within an enterprise environment. Whilst there are tools within the *nix environment that can help with rolling out and managing servers they don't always scale so well with desktops. The windows domain environment is much better at this for servers and end user PCs.

When choosing a system it should be a case of choosing the right tool for the job. That can include the system architecture, operating system and software. This isn't really a new thing 15-20 years ago there were several architectures of unix systems and the Unix team where I worked at the time were managing IRIX on MIPS, Solaris on Sparc and Linux in X86 hardware (interestingly back in those days Microsoft also supported other CPU architectures with NT4)

hippy
Posts: 6093
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Weird Thought

Fri May 12, 2017 11:12 am

mfa298 wrote:When choosing a system it should be a case of choosing the right tool for the job.
That's true and the key issue. It would be great if there were one thing which did everything well and we could all agree on that one thing. But we won't, nor likely to any time soon. Wanting the best tool for the job is at odds with the convergence we would like to see. That's the conundrum.

User avatar
r3d4
Posts: 967
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: Weird Thought

Fri May 12, 2017 3:53 pm

hippy wrote:Second; developing for Linux can feel like building on shifting sand. ...
AFAIK 'The Purely Functional Software Deployment Model.' aims to fix this!
( and after playing around abit with nix-env ect ;
, ontop of a few diffrent 'live' systems sofar it appears to function )
& guix!

hippy
Posts: 6093
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Weird Thought

Fri May 12, 2017 4:24 pm

r3d4 wrote:The Purely Functional Software Deployment Model.
That is an interesting read. It is in English despite some opening text which suggest not ...

http://grosskurth.ca/bib/2006/dolstra-thesis.pdf

User avatar
r3d4
Posts: 967
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: Weird Thought

Fri May 12, 2017 6:20 pm

It most definitely is that !..

Geting
0) weirder & hopfuly more interesting
1) abit more back on topic
2) while continung the package manager tangent

--- > Assembling SOCs with Nix (NixCon 2015)
><

Return to “General discussion”