This is an early attempt at microarchitecture documentation for the CPU in the Apple M1, inspired by and building on the amazing work of Andreas Abel, Andrei Frumusanu, @Veedrac, Travis Downs, Henry Wong and Agner Fog. This documentation is my best effort, but it is based on black-box reverse engineering, and there are definitely mistakes. No warranty of any kind (and not just as a legal technicality). To make it easier to verify the information and/or identify such errors, entries in the instruction tables link to the experiments and results (~35k tables of counter values).
Amazing work, but the fact this kind of work is even needed illustrates just how anti-consumer these new Macs really are.
Thom, I’m not seeing how this points to how anti-consumer the Macs are. IF this truly is just mapping out the micro-architecture, not the instruction set, then the logical instructions still achieve the same results regardless of how they’re implemented. It would still be ARM instructions at a high level and could still be effectively programmed the same way.
Put another way: the ARM instructions are the interface and the micro-architecture is how those instructions get implemented. There’s various ways each instruction could be implemented, as long as the same inputs lead to the same outputs in each case. Perhaps you have an add instruction that uses normal adder digital circuits. Or maybe you have a pre-computed table of addition results & the inputs just map to the output — faster, but takes up more chip real estate. The logical add instruction is the same either way, but the way it is carried out differs.
The way it gets carried out is quite possibly company proprietary in order to give them an advantage over competitors. To say it is anti-consumer, then, would be to argue that EVERY chip manufacturer should be required to completely open source their micro-architectures in order to be consumer friendly. By that logic, EVERY company should do the same whether we’re talking about hardware, software, automotive, medical, etc, etc.
As a developer, I may be curious about the micro-architecture of a chip, but I don’t really NEED to know it to effectively code up a piece of software. The differences would only matter if (1) there’s side effects of one implementation that others don’t have — arguably a bug or (2) something nefarious in the implementation — like it siphons the data & uploads it to the manufacturer. #1 could lead to problems like with the Pentium FDIV issue decades ago. #2 would take a fair bit of work to siphon as it could be a large amount of data and the data would only be useful in certain states (e.g., I’d need to know to siphon the decrypted version of some data instead of just its encrypted form).
While I have my concerns about Big Tech, I’m really not sure how this fits as anti-consumer.
Very good response.
I think Thom was starting with his conclusion: That Apple is anti-consumer. And he simply assumed whatever matter/facts this article was about would naturally support his conclusion.
Most manufacturers only offer the high level details of a microarchitecture, and they are mainly pertaining about stuff that may be visible to the programmer.
The rest of the implementation are basically trade secrets. That are outside the scope any consumer could remotely need/be interested on.
Indeed. People don’t realize there are more layers beyond the layers which we see. Chips don’t really execute assembly code.
This is true. Apple builds custom chips which are Arm ISA compatible. They have a Architecture license which allows them to process the Arm ISA instructions however they would like inside the core. In contrast, the majority of Arm ISA vendors use the core designs from Arm.
It’s the same way Intel, AMD, and VIA have an x86 licenses which allow them to create their own chips which consume x86 instructions.
Yeah, this only really matters to a few computer engineers at various chip companies.
Arm Architecture License: https://en.wikipedia.org/wiki/ARM_architecture#Licensing
cacheline,
I agree that trade secrets are par for the course.
That said, there would be legitimate reasons to document the micro-architecture if possible. Not too long ago oiaohm was talking about the difficulty of proving software security against side channel leaks such as meltdown and spectre, and he rightfully pointed out that it requires a CPU’s implementation to be well defined. Assuming we had an accurate model of the CPU, one could enumerate all the possible code paths and systematically prove the absence of microprocessor timing channel leaks. We cannot do this today because the implementations are black boxes and are not well defined. Conceivably though it would be possible especially with an open architecture like RISC-V.
Arguably they should do that to open the path for stronger security proofs in the future, but it’s highly improbable that CPU manufacturers would cooperate without some mandate or incentive.
RISC-V has scope for proprietary extensions anyway. I’m not sure of the actual licence used – it may well just be BSD, but either way it’s effectively licensed the way the BSDs are – open source, but you can do whatever the heck you like with the IP, rather than a GPL-like “do what you want, but you must distribute the modified source if you distribute modified binaries.”
JeffR,
Indeed. The success of RISC-V as an open architecture could be put at risk if proprietary companies see to it that the end product stays proprietary. My understanding is that nvidia is already using it in proprietary products.
https://riscv.org/wp-content/uploads/2017/05/Tue1345pm-NVIDIA-Sijstermans.pdf
If so, open architectures could end up being a pipe dream if they are effectively locked down.
I suspect hardware is moving the same way software did. Therefore, if RISC-V isn’t destined to stay open, the next architecture or the next will. The difference – and the reason why progress in the area has been much slower – has been, IMO, that hardware is so expensive to produce by comparison. (Reproducing software costs nothing, of course, beyond the cost of the media it’s stored on. However programmers are still an expensive resource to their employer – a cost which is then passed on to the customer – because it’s a limited talent pool. By contrast, you can’t just “cp -a” or “rsync” a logic board.)
The “Open source is inherently secure” fallacy has been disproved several times on this website. In fact, i’d argue that open-sourced hardware is even more insecure, as hardware generally cannot be patched once it’s manufactured. Therefore any bugs or security issues found, which is much easier when the specs are open, will be harder to prevent and likely require replacement of hardware. A black box with no publicly available specs is much harder to exploit, as you don’t have a starting place for what’s in the box.
The123king,
Well, I’ve never said that open source is “inherently secure”, it still requires a lot of work. But I don’t think it’s unreasonable to expect every generation to become more secure over time.
This is called security through obscurity, and might be viable to the extent that you can keep the exploits secret. But obviously it would be better in the long run to do what it takes to keep exploits from existing in the first place.
Technically this can be done publicly or privately, but when it’s done in private trust becomes intrinsically centralized, which is problematic and I would argue our faith in black boxes is misplaced. Keep in mind that with spectre/meltdown both intel and AMD where initially in denial asserting things were fixed or not affected, meanwhile It was researchers who kept finding more variants once they were on the trail. These exploits required hardware, firmware, and software mitigations, often at the expense of performance and inducing high level software changes.
https://www.tomshardware.com/news/intel-disable-hyper-threading-spectre-attack,39333.html
Again it’s not to trivialize the issues, but the security for a lot of proprietary hardware (not just CPUs) has been kind of poor. Open architectures make public auditing possible, which is more ideal and could lead to more confidence over time.
http://www.osnews.com/story/30170/is-it-time-for-open-processors/
I can see valid reasons for both sides of the argument. But, despite legal protections, we know copyrighted/trademarked materials are stolen quite often. It happens enough in China to be meme-able. If I owned a business with lots of IP, I’d be leery of making it completely open unless I knew I had enough leverage to keep customers. Otherwise, I might as well fold up and go work for someone who DOES have such leverage.
cacheline,
Counterfeiting is a big problem that hurts both manufacturers and consumer, but sometimes US corporations use the same IP theft umbrella for legitimate Chinese clones making it extremely difficult to determine whether products are factually being misappropriated in any given instance or it’s just an opportunity for companies to slander their competition.. Anyways, this is just a semantic gripe that does not have much bearing on the topic, haha.
To directly address your point, you bring up a real stumbling block: our companies may be unwilling to buy into the fully open computer concept. Such a change could pose a risk to their already profitable businesses. So it’s possible that no incumbent company would be willing to try, however for a new entrant open computers could actually be a valuable selling point in and of itself. Additionally a new entrant could have first mover advantages. Realistically they will get duplicated though (not necessarily a bad thing for consumers). The bigger problem is really investors who don’t want to invest without exclusive ownership. Ironically, it might make more sense to build this in china/taiwan/etc since our western companies would just outsource the hardware work to them anyways, haha.
In the end, I really don’t know whether a fully open CPU would be viable. But back to my point I still think that having well defined microcode could lead to innovation in the area of hardware security proofs. Conversely, so long as we don’t have well defined microcode, that limits our ability to make software that is safe from hardware sidechannel leaks.
It’s not really anti-*consumer* though, even taking into account the comments above – it’s anti-*geek*. /Consumers/ just want to buy something that works, is reliable, and get a knowledgeable person – whether that’s their geek daughter or nephew or an Apple Genius – to fix it if and when it breaks (hopefully not often). Most of the people who are old enough to remember when you had to carry a toolkit in your car in case you broke down on the freeway didn’t *want* to have to do that, but cars were so unreliable that it was a necessity. Presumably breakdown services weren’t as readily available then, either, or perhaps, because of cars’ unreliability, it was not financially feasible to call them each and every time you broke down.
I’ve been running Linux twenty-some years, most of the time I run the “too configurable/complicated” KDE, I dabble in other DE’s and the BSDs and Haiku and RISC OS, and even I would rather not go back to the old days of flipping DIP switches instead of getting the PCIe bus to figure out what IRQ settings an expansion card should use. Some things just aren’t worth the trouble, and everybody has a different idea of what those somethings are.
You can argue that people pay a premium to Apple to be able to get an easy-to-use, friendly system, and you can argue that they dropped the ball – or a whole set of golf clubs – by allowing the butterfly keyboard to blight the ecosystem for so long, but unless and until other avenues – such as running Wintel or Lintel PCs – are closed to you, (or conversely, if, G-d forbid, Apple go out of business or stop making Macs, or Google shifting to Fuchsia somehow makes the Linux desktop nonviable) you can’t really complain that there’s not a choice.
Thom,
I would like to propose a question to you.
Say you were the CEO of a company. Maybe it is barely worth anything or maybe it is work 2 Trillion dollars. That company’s existence, your job, and maybe 10’s of thousands of peoples’ jobs depends on your decisions.
You can make everything open source. And just so this is PERFECTLY clear. The VAST majority of what Google makes their money with is proprietary and secret. Their open source versions are VERY generic representations of their “secret sauce”. If not, then any company could come along and copy their open source software and modify that code and out do them.
Making every open source would lead to you being terminated as CEO unless you could figure out a way to keep the company’s cost of innovation and security low enough that other companies could not compete.
Take a look at HP and Dell and Lenovo. I don’t see you writing articles about how they hide their work on their motherboards to make it hard for other companies to copy them. And there would DEFINITELY be companies copying them if they could figure things out fast enough and the laws about copyrights weren’t as tough as they are.
So you run a company and you don’t want to just be another HP, Dell, Lenovo etc that is making what is mostly, basically similar designs that ultimately rely on them making motherboards off of mostly the same chips but just using a different layout due to decades of going down their own paths.
So you want your company to be different and you don’t want people copying you. After all, they have copied you before and because of that you have copied lots of their stuff too in what could be considered retaliation or whatever you want to call it.
But you want to be DIFFERENT. You don’t want people copying you over and over and over again. You don’t want these other companies to have any idea what is up your sleeve or behind that curtain. If you use what is basically the same parts as everyone else there just can’t be that much that is that different.
Unless of course they only build engines and chassis and you do that but also build the bodies on top of them and nobody else builds mostly everything about the car that shows and is important.
Keeping the car theme, so you start building your own alternator using different ideas which include better bearings and less friction which is less heat and wasted energy. And you are doing this with all the parts that connect to your engine and the engine of course, well of course you build that off your own designs. And ultimately your reductions in friction and heat cause your computer to get 30% better gas mileage along with better acceleration and handling at low, medium and fast speeds.
You would be an IDIOT not to do your best to protect your investment. Because your investment cost you a LOT of money and because of your advantages you can charge more and of course you make more because people that appreciate your cars are willing to pay more.
Meanwhile people who don’t want to pay the “better car” tax continue to spend money on the other cars where they are all battling to keep the price as low as possible and therefore the profit margin is a lot smaller than your company’s is.
Would you open source this? Would you make it easy for people to copy your company? Would you want them to have easy access to parts that they could tear apart and figure out how they work soon enough that they could replicate a good enough copy which could lower your sales?
Would you? If yes, you would be an absolute idiot and a fool and you wouldn’t keep your job very long.
You think they are doing you wrong? Fine! Don’t buy their product. You ALWAYS have the choice of not buying their product just like everyone else does. Stop whining. You obviously want your cake and you want to eat it too. But it doesn’t work that way.
If they did what you “wish” that they did, everything would change and pretty soon that tasty cake wouldn’t be so enticing and tasty anymore. Instead if would be ruined because every other cake maker would find out your recipe and be able to copy it at far lower prices since they haven’t had to figure it out, just copy it.
Sabon,
Having the formula for coke doesn’t mean you can beat coke at their game, so to speak. You could have all of google’s code and still not be able to make a dent in google’s market share. Trade secrets might matter some times, but more often than not there’s no secret code that’s responsible for their success, the real success story is more mundane: scales of economy and access to markets. In google’s case they have billions of billboards across the web and the lion’s share of advertisers. They’re not doing anything so special that outside developers haven’t thought of doing it too. Most of the real, novel, innovation already happened years ago when the market was young. But by the time the market has matured and most of the competition has fallen, winning becomes less about innovation or merit and more about using momentum to crush competitors or just using a few days of profits to buy them out.
I do agree with your point that most companies don’t see any incentive to open source their software or open their hardware. Why would they do it? The largest most successful companies are doing very well profiting from proprietary restrictive technology.
However this discussion is part of a broader debate over how much power we as a society should allow these corporations to have over us. To what end do we accept these power imbalances as a healthy biproduct of capitalism? We are seriously headed towards a modern era of Carnegie, Rockefeller-style oligopolies. Do we really want to revisit that and become completely dependent on the privileged few at the top?
RE: Google
1) They don’t share their future plans with the public or their competitors.
2) Actually there IS a lot of proprietary code that Google has that they don’t share with the world.
3) Reverse engineering takes time. That’s the point of making things proprietary. By the time you catch up, they’ve moved on. In Google’s case, how they make the internet show what it shows when you search with Google. Look up how much you find out about Bing when searching Google’s search then try again searching with Bing.
PS: I don’t use either 99% of the time.
My whole point with Thom is that he wouldn’t be stupid enough to share all his code in open source if he expected to make any money with his company. Not unless he had more and better resources that he felt you could never compete with.
However, if there IS a possibility company B could compete with you if you shared your IP and they don’t share theirs, well it would be suicide for your company.
Sabon,
That’s not a good reason not to be critical of corporations. It’s the media’s job to be critical.
Some business models might depend on trade secrets, but for most of our billionare tech corporations that is not the case. Microsoft, facebook, google, amazon, apple, even twitter’s power doesn’t come from trade secrets, they come from network effects, brand recognition, scales of economy, global data mining and advertiser buy in. Even if you ran the same code and hired the same developers, you’d still be 100% irrelevant. It can take billions to break into these global markets. You are still right these corporations may not have much incentive to share the source, but you are exaggerating the extent to which it would bring them down if they did. The source code for windows was leaked, yet microsoft’s market advantages didn’t disappear and it actually had very little effect on the market. Both Microsoft’s IE and edge browsers were proprietary, this did very little to increase microsoft’s ranking against google’s browser, which has some FOSS underpinnings. The point is, treating this as a one sided issue is unlikely to capture the whole picture.