5 ms·
It’s important to note that most of the things mentioned here are just “tricks”: they’re fun to discover and talk about, but they really only end up being minor
by saagarjha 6y ago
It’s important to note that most of the things mentioned here are just “tricks”: they’re fun to discover and talk about, but they really only end up being minor wins in practice. TSO is great…if you are trying to make a simpler Rosetta (it’s not even necessary on the M1, although I think Apple is still using it for convenience; I’m still trying to find out where). The JavaScript instruction speeds up…one specific rounding in JavaScript. Fast atomics help…if you’re that one specific part of Apple’s runtime that has taken advantage of it yet. They are all cool, important little optimizations, and I’m sure that few other companies could do what Apple is doing in this space.
However, it’s very much not true that Apple is “cheating” their way to performance with a bunch of these tricks for their own software (as much as you can call this cheating). Their processors are optimized for general-purpose workloads, and blow everything else out of the water even if you’re doing something profoundly “un-specialized” like run Photoshop or a Linux VM.
It’s easy to come up with takes like these that point at buzzwords that you’ve seen being thrown around in the last couple weeks in an attempt to explain this chips. The reality is that the reasons these chips are fast are either unknown or boring. I suspect that these will one out as we play around with them more, but we don’t have the details right now.
- _kbh_ 6y agoI believe with regards to TSO, it is actually a huge benefit performance wise. Without you would need to effectively have a barrier after every memory operation ARM, reducing performance drastically.
- saagarjha 6y agoImplementing the memory ordering in hardware is a huge performance benefit, but they didn’t have to do it with a switch like they have right now. ARMv8.4-RCpc would be enough, and I believe M1 supports these too. (FWIW, Rosetta itself does “cheat”: the translated code and the runtime shares an address space, and memory accesses are not checked, so it’s possible to write an “Intel” binary that is aware of the runtime and can read emulator state.)
- _kbh_ 6y agoIsn't it a switch because the weak memory model, whilst providing less guarantees is more performant?. So they are trying to have both the x86 mode which isn't as performant, but works a lot faster in hardware than the software implementation and the faster weaker ARM model.
- saagarjha 6y agoThe thing I mentioned should be better in that case since it’d enforce the right memory ordering on a per-instruction basis.
- neerajsi 6y agoThe ls/st instructions take a large amount of encoding space for all the addrmodes. I don't think the rcpc instructions and other acq/rel instructions were given the same encoding space.
- jorvi 6y agoPeople won’t believe it’s not Apple its magic sauce and ARM is really just that good until ARM processors start being a mainstream thing in Windows laptops. ARM its ARM-X already looks pretty juicy and the follow-ups are sure to get better and better.
- saagarjha 6y agoIt’s Apple, not ARM.
- simonh 6y agoIf Apple is free riding on how great ARM is, how come everybody else’s mobile ARM chips are such pants in comparison?
- jorvi 6y agoYou (and apparently most of HN) is misunderstanding me: I’m not saying Apple isn’t doing great stuff or that they’re just coasting on ARMs tech, but it is the ARM ISA that enables them to make the M1 so ridiculously good. But people won’t believe that and will attribute it to Apple’s vertical integration until they are holding a Windows laptop with an ARM CPU and crazy battery life, thermals etc. And again: ARM already has the X in the pipeline which is going to close part of the ARM-Apple A-series gap.
- saagarjha 6y agoNo, we understand fine; we disagree with the claim that M1 is good because of the ARM ISA. Had Apple picked something else a decade ago we’d probably see them pulling ahead with that, too.
- jorvi 6y agoThen you don’t really understand, because Apple couldn’t have pushed x86 this far, even if they had gotten a license. Also go pick a bone somewhere else man, how sad do you have to be to multi-downvote on HN? This isn’t Reddit.
- Jasper_ 6y agoThe JS rounding mode instruction wasn't even Apple's invention, it's standard ARMv8. But yes, Apple spends a lot on CPU design and it shows; ARM's Cortex performance for things like NEON is way, way worse.
- saagarjha 6y agoYes, that’s true. But Apple heavily influences the standard, and they’re usually the first to actually implement new revisions; plus they pick and choose which extensions they want too. That being said, the “Apple added JavaScript instructions and that’s why their processors are fast at web browser benchmarks” meme needs to die. From my impressions of seeing how these get implemented, it seems like some hardware features end getting added to the chip by the hardware team and then the software engineers get told that it now exists. So that’s another reason why I doubt that they are “cheating” on benchmarks.
- nickysielicki 6y ago> The reality is that the reasons these chips are fast are either unknown or boring. I suspect that these will one out as we play around with them more, but we don’t have the details right now. I disagree, I think we have plenty of information. This is what happens when a huge proportion of your die isn't doing instruction decoding. x86/amd64 are old and crufty. Lessons have been learned, and had been learned for some time, but people (AMD/Intel) were not brave enough to fix them because they didn't have adequate control of their software ecosystem to say, "Your software from your old computer will not run/will not run as well on your new computer." (For emphasis, let me just put it clearly what I'm claiming: x86 was designed in the 1970s. This is what happens when you use an ISA that was not designed in the 1970s.) Apple, however, does have control of their ecosystem, and they're allowed to be brave, provided they can support their ecosystem. Here's my hot take: Intel tried to be brave with Itanium, but failed because compilers weren't up to the job at the time. That's changed. First things first, we're going to see mainstream desktop-class/laptop-class ARM being extended to linux and Windows. But I also believe that sometime in the next ten years, after all this newfangled high-performance ARM stuff is sorted out, we're also going to see someone give VLIW another shot, and they're going to succeed this time.
- atq2119 6y agoThis is what happens when a huge proportion of your die isn't doing instruction decoding. That's a misconception. Yes, decoding x86 is somewhat more complicated, as far as I'm aware that's mostly because instruction length differs at a byte granularity. Still, the area dedicated to it simply isn't that large on those huge out of order designs. I'm sure the instruction encoding plays some role, but I suspect what we're seeing is rather down to consistently good micro-architecture execution over the years and Apple being ahead of everybody else on manufacturing process. Compared to the x86 processors that exist today, M1 also benefits from having the memory in-package. Intel tried to be brave with Itanium, but failed because compilers weren't up to the job at the time. Compilers "failed" because VLIW is fundamentally not a particularly useful idea. The main problem for general purpose single-thread performance is memory latency, and VLIW just doesn't help there.
- 6y ago
- Slartie 6y agoI disagree regarding the importance of this kind of "tricks". You are right in pointing to all the "boring" stuff that is considered state of the art in chip design being the main reason why these chips are impressive. Apple seems to have pulled all the right strings in that regard. But there is a point at which you can't execute the known optimizations any more perfect than you already do - when you're already using the best available lithography, implementing all the well-known architectural benefits like big/little, big caches, wide decoders etc., you eventually hit a brick wall and the only thing that will get you further are new and creative tricks like the ones discussed in the linked tweets. Each may just add a little, but together they add up to a noticeable improvement with regard to a competitor who also executed all the standard stuff well, but maybe did not think about these particular new optimizations, or might not even be able to implement them due to not being in control of the entire vertical ecosystem. That "competitor" btw is not Intel - they already fail at the basics - but AMD.
- saagarjha 6y agoThe point is that in benchmarks these things don’t really show up at all and Apple still leads. The things I mentioned are only useful because of specific usecases, and saying that Apple is ahead because of those is inaccurate. The point is that the tricks are extremely important for Apple, but not in an argument of “why is Apple making fast processors”. Regarding a comparison with AMD: I think we’ll have to see what Apple’s professional chips can do. My guess is they’re pulling ahead already.
- Slartie 6y agoSo JavaScript is not benchmarked, fast ref counting does not improve native application benchmark results, and the memory model trick does nothing to improve benchmark results of x86 applications? Yeah, you can of course say that each of these is a "specific use case". But which use cases other than running native MacOS apps built on Apple's frameworks, x86 MacOS apps and web applications do you have in mind? I see those covering a lot of what people tend to do with their MacBooks.
- acqq 6y agoThe most informative post at the moment for me, with more detailed technical information for those who are interested in what's actually making Apple's M1 CPU fast, based on the article by Anandtech, is much lower on this page, by GeekyBear: https://news.ycombinator.com/item?id=25235214 https://news.ycombinator.com/item?id=25235214
- saagarjha 6y agoThe AnandTech article is not bad, but I have heard that their tests misrepresent some microarchitectural details that they didn’t manage to guess the underlying design of correctly.
- pritovido 6y ago"Tricks" makes great difference in life. I can jump over a meter high with my bicycle because someone who knew did teach me the "bunnyhop trick". That and other "tricks" give you the ability to do things save on a bicycle that most people consider impossible or too risky. Knowing the tricks of a trade, like software development, means the difference between starving or success. In the same way there are "tricks" that you know about relationships and money and work that can change your life radically. Trick in English have different meanings. It can be something intended for deception or illusion, but it could also be a habit or mannerism. In Apple case, those tricks are not really tricks, but strategic informed decisions. Apple has lots of knowledge about what the market needs and is willing to pay for, they have access to the purchase data of tens of millions of people. If you have no access to real information, some decisions of the companies that do will look comical or nonsensical.
- saagarjha 6y agoI know exactly why these things exist: it’s because they serve specific strategic interests that Apple has. They aren’t how the processor is getting great single-core scores on Geekbench.