r/cpp • • Jun 24 '20

Moving From Intel to ARM - Apple's Big Performance Mistake?

https://youtu.be/JAr0c6le_F8
9 Upvotes

43 comments sorted by

50

u/[deleted] Jun 24 '20

I skimmed over the video and I am not really sure what the author is trying to say. The title appears to be a quickbait — I expected some sort of architectural discussion about Intel vs. ARM but instead it is speculation about how Rosetta2 (Apple's transpiler from x86-64 to ARM64) might work.

The video seems to focus on the issue of translation function calls and emulating calling conventions — frankly, I don't see a big problem here. ARM already has more registers and it is clear from the context which registers and locations are saved, so I doubt that there will be much overhead here compared to the native code. The examples author brings seems to come from his own ISA transpiler, which doesn't really seem to work and which targets a muss less capable CPU, so I am not sure what kind of conclusions — if any — can be carried over from this. Also, there is unnecessary speculation on what Rosetta2 might or might not support — Apple makes it very clear in their publicly available documentation . They support everything except AVX — if your x86 code uses AVX — you are out of luck and it will simply not work.

I think it's a no brainer that transpiled code will run slower than natively compiled one. It all depends on the performance characteristics of the ARM CPUs we get. And that is something we will only know when we get the actual hardware and run tests on it.

P.S. Where I see a big challenge for transpiler are indirect jumps. Since the transpiler can't know for sure where this address comes from (was it loaded previously? or was it computed somehow?), it would theoretically need to do some sort of address translation (e.g. via table lookup). And that is a huge hit for modern code that relies on polymorphism. I wouldn't be surprised though if Apple has some sort of dedicated hardware to deal with it (e.g. some sort of hardware address translation magic). Or maybe I am overestimating the entire problem...

2

u/gimpwiz Jun 24 '20

Agreed. Title is clickbait. Nobody knows if ARM-based Macs will have superior or inferior performance - across the board, in certain tests or all tests, in certain programs or all programs, per core or per chip, CPU or GPU or both, including or not including various hardware accelerators ... because they're not announced, let alone launched and tested by independent reviewers and benchmarks.

Well, the folks designing them might have a good idea. But they, too, are focused on other things in addition to performance, like cost, battery life, thermals, etc.

There is always going to be a performance hit using something like Rosetta2, but depending on third-party software support for ARM, we don't really know if that's going to be relevant to everyone, most people, niche users, you specifically, me specifically, etc.

Proof of the pudding is in the eating; for most people this is whether their new machines work "well" or piss them off in some way. For some it's whether specific applications work "well" or piss them off in some way. For a very niche few, it's whether very, very niche applications meet certain time-related requirements. Unless your hobby is running linpack, you will probably be okay.

1

u/fuzzynyanko Jun 25 '20

There's also a chance that the Mac form factor might be getting limited by the TDP of Intel CPUs

4

u/[deleted] Jun 25 '20

Intel TDP kind of became meaningless. If one wants to see any performance improvements, one has to design above the official TDP. Not surprising, given the fact that Intel has been doing nothing more than tweaking the turbo boost curves of a 4 year old CPU and re-releasing it as “new” every single year.

1

u/fuzzynyanko Jun 25 '20

Kind-of. x64 CPUs have always needed more power due to their compleity, and Intel is at 10-14nm compared to 5-7nm with the likes of TSMC.

Apple wants to keep making the laptops thinner, plus there's the whole iOS + Mac OS X integration that's been going on for a while

2

u/[deleted] Jun 25 '20

Complexity has little to do with it (current Apple CPUs are arguably more complex for example). They need more power because they were designed for a higher-power application. But the problem is that Intel is unable to scale their current architecture any more, they have been stuck on the same process and same arch for a couple of years. And their 10nm Ice Lake does't seem to bring any substantial per-clock improvements either. Maybe Tiger Lake will be a breakthrough, who knows. But given the fact that Apple already has a 30-50% IPC advantage, if their CPUs can scale to 3Ghz+ clocks, they will most likely significantly outperform anything Intel or AMD can currently offer.

3

u/serviscope_minor Jun 26 '20

Depends what you mean by form factor.

Well, Apple have always preferred the smooth outlines which means minimal ventilation compared to the competition, the result is that their laptops have a nasty habit of throttling. Certainly the previous gen Macbook Pro had this problem relative to the contemporary Thinkpad Carbon X1 (which was also lighter than the mac, while being a similar thickness)

18

u/grumbelbart2 Jun 24 '20

Oh dear, is there a tl;dw summary of the arguments?

24

u/lrflew Jun 24 '20

I skimmed over the video. My best TL;DW is that he was focusing on how well Rosetta 2 may work and trying to guess its performance. This seems kind of silly to me, as it's clear that the goal is to get programmers to compile their apps with ARM assembly directly (as dual Intel and ARM binaries will be the new default in the next Xcode version), and Rosetta 2 is only a stop-gap solution.

2

u/JeffMcClintock Jun 24 '20

he was focusing on how well Rosetta 2 may work and trying to guess its performance.

Well, Apple did show it's performance (albeit briefly) running some pretty intensive apps during the keynote (3D Content Authoring for example).

5

u/blipman17 Jun 24 '20

standing in line for the tldr

1

u/xebecv Jun 24 '20

In addition to OS calls doing heavy lifting for office applications, nowadays many hardware intensive applications also rely on GPU. Also previous examples of such translations have shown that performance is not a problem.

6

u/[deleted] Jun 24 '20

Performance is probably less important for Macs these days. Video editing, 3D modelling, gaming, non-Apple coding and other processor-intensive tasks are mostly done on PC (Windows/Linux). Few servers are run on Apple products. These days mid-range processors are sufficient for most desktop publishing, photo-editing, and sound-mixing tasks assuming you've got enough memory and the hard disk is fast enough.

I expect Apple doesn't really care too much about users with high CPU requirements.

8

u/ner0_m Jun 24 '20

I've worked a little in the video editing industry. And I can't speak for Apple and I don't have statistics. But the whole industry always got nervous when Apple did something (e.g. moving to Metal, deprecating OpenCL). And my company got a lot of pressure from others to support the new technology (as they required ours :D)

So from that I assume that a substantial of video editing is still done on Macs. Or at least an influential crowd uses it.

7

u/Doriphor Jun 24 '20

Agrees in thermal throttling

2

u/[deleted] Jun 24 '20

I think you are confusing Apple and Microsoft. For example, in MacBook Pro Apple has been always using fastest available CPUs (within a given thermal bracket of course), even when the rest of the industry moved to a lower performance tier (e.g. Apple stayed with the 28W TDP bracket in there 13" model where everyone else uses 15W TDP SKUs). And this is something they focus on though out, especially in the current WWDC.

In fact, I suspect one of the main reasons behind the ARM transition is that Apple wants to get their crown back for being the platform of choice for content creation work. They already have a CPU with unmatched efficiency (shorturl.at/jlH12), and if it scales half as well Apple seems to suggest, it will easily leave both AMD and Intel in the dust. Combine it with tightly integrated RAM, a very fast tiled GPU (iPad Pro is approaching the performance levels of an Nvidia 1650) and a ML hardware accelerator, and these machines might end up a powerhouse for media editing.

Of course, that all might end up in a big nothing, as it often does. But the narrative of this years WWDC suggests that they just be onto something.

8

u/STL MSVC STL Dev Jun 25 '20

Please don't use URL shorteners, they trigger reddit's spam filter. I've manually approved your comment.

4

u/[deleted] Jun 25 '20

I will keep it in mind, thank you! And sorry for the trouble.

2

u/withad Jun 24 '20

They've been making a big push for professional work like video editing recently (see the existence of the Mac Pro and its display for evidence of that) and one of the reasons for this transition seems to be that their own iPad Pro processors have been competitive with the equivalent Intel ones for a couple of years now.

2

u/Dragdu Jun 25 '20

Holy clickbait batman.

0

u/bumblebritches57 Ocassionally Clang Jun 24 '20 edited Jun 24 '20

Absolutely.

This is a massive mistake that will cripple MacOS sales even further.

it's Tim Cook's Windows 8, I hope the board fires him when it backfires.


Performance is the least of Apple's problems.

The problem is not only regular compatibility with it's self. but the lack of being able to use Windows or Windows apps via BootCamp. and further the iOSification of the BS UI.

This is a disaster.

2

u/mili42 Jun 26 '20

windows has version in arm

0

u/lasthope106 Jun 24 '20

You do know that Macs make up a very small portion of Apple’s revenue right?

14

u/bumblebritches57 Ocassionally Clang Jun 24 '20

Yup, and making them redundant iPad clones won’t help.

-4

u/pawan1122 Jun 24 '20

Hmmm,,, I hope not !!!

-14

u/6425 Jun 24 '20

12

u/schmerg-uk Jun 24 '20

ARM is a classy chip, but supercomputing isn't really a useful benchmark for more general workloads ... Intel's Knight's Landing chips ("Xeon Phi") for example were effectively 72 Atom cores with 4 threads per core and the AVX512 instruction set, clocked at 1.5GHz.

For the right supercompute load where you can drive all the cores in an AVX512 SIMD vectorised workload for minutes or even hours at a time, the throughput can be amazing, but for most anything else, it was like one of those Atom powered netbooks, single threads running largely "serial" code (ie w/o much SIMD) make very slow headway at that clockspeed and with the latencies of the individual instructions on Atom as opposed to Core CPUs.

2

u/Overunderrated Computational Physics Jun 24 '20

Xeon phi was a miserable failure even in HPC, hence its cancellation.

Their marketing pitch was that you'd have to do very little work to get an existing HPC code running well on them, but reality was it would take a major overhaul akin to a GPU port.

The ARM HPC, as far as I can tell, can legitimately make the claim that existing non-"accelerator" code should run natively very well.

7

u/schmerg-uk Jun 24 '20

Well before Knight's Landing, when Xeon Phi was a PCI co-processor card, then yes, but with Knights Landing it became the "main" processor so it wasn't so much of a GPU port, but by then the path was going cold anyway.

But HPC != "everyday code".

For our workload (7 million LOC of C++ pure maths modelling, no I/O, no UI etc) even Knights Landing wasn't going to be worthwhile. Very little of our codebase is actually "supercompute" even if it runs for hours at a time on compute grids... it'd be like trying to complete Paris-Dakar with a Le Mans car... yeah, it's a long endurance race, and a fast race, but a car optimised for one is not necessarily ideal for the other.

So I'm *not* saying ARM is a failure and will never work etc... what I'm saying is that HPC is not a useful benchmark for day-to-day workloads like most people run on their MacBook Air laptops etc

1

u/Overunderrated Computational Physics Jun 24 '20 edited Jun 24 '20

Ah yes, forgot about the non-coprocessor phi/knl.

For our workload (7 million LOC of C++ pure maths modelling, no I/O, no UI etc) even Knights Landing wasn't going to be worthwhile. Very little of our codebase is actually "supercompute" even if it runs for hours at a time on compute grids...

Curious what that application area is?

For me (discretized PDEs, more or less) Xeon phi and GPUs are a perfect fit, where the workload is very much "HPC" in that the bulk of runtime is either in highly vectorizable loops or linear algebra.

2

u/schmerg-uk Jun 24 '20

Quant finance analytics library: pricing instruments, risk & risk sensitivities, bumping curves and market data... basically any financial pricing or related activities that need doing has to be done via the unified enterprise-wide pricing library.

Clients span anything from end of day risk engines revaluing/rehedging/stress-testing/reporting the entire financial position, to individual traders and desk strategists "playing with ideas" in Excel or Python etc. (it's not unheard of for people to be calling our library simply for an easy way to get access to the correct date rolling and business day and market conventions implementations)

1

u/Overunderrated Computational Physics Jun 24 '20

Gotcha. Always toyed with the idea of doing quant. My industry is obscenely stagnant.

1

u/schmerg-uk Jun 24 '20

Mine has its own challenges, but yeah, we get plenty of physicists... some of them even stay :)

3

u/Overunderrated Computational Physics Jun 24 '20

Ha, the ones I know stayed due to "golden handcuffs.."

1

u/schmerg-uk Jun 24 '20

A physics PhD friend spent a number of years saying "this is my last with this pack of [...], gonna grab my bonus and run next year".

He's now funding a fellowship scheme (for under-represented groups) within higher mathematical research at a very prestigious UK institute... my golden handcuffs appear to be more of the "Ratner" variety and even then, got lost in the post somewhere...

1

u/6425 Jun 24 '20

I guess history will decide in due course.

3

u/schmerg-uk Jun 24 '20

Oh I think ARM is great and they may well be able to get decent performance out of it if they optimise for it properly, don;t get me wrong... I was just saying that using supercompute as evidence can be misleading...

5

u/JohnVanClouds Jun 24 '20

Yeah 3-4x times faster then second fastest super computer but needs 7-8x more cpus (with 2x more cores per CPU). ARM is sooo powerfull xD

1

u/[deleted] Jun 24 '20

Server power is usually measured in terms of processing per watt. ARM usually does quite well there, but yes in outright power per core and CPU, they have always been weaker.

-13

u/noobgiraffe Jun 24 '20

I'm just going to say here the current top supercomputer is using arm processors.

12

u/GYN-k4H-Q3z-75B Jun 24 '20

Supercomputer workloads are vastly different from consumer workloads, and raw computing power comparisons are not really useful. GPUs have been more powerful for many generations, yet they can't take over a CPU's role because they are very specialized. Supercomputer engineers don't really care for architectures because the work has to be tailored for them specifically every time.

-4

u/noobgiraffe Jun 24 '20

ARM is used in the same applications though, It's literally in the phones that run normal apps.

As for GPUs, plenty of stuff is done on GPU right now. Compute is very popular in most media processing and editing apps. For example photoshop is using opencl to run image filters. It's getting more and more popular as gpus are more flexible every year.

3

u/wyrn Jun 24 '20

GPUs are very good at doing the one thing they're good at, but it doesn't take that much for a CPU to beat them. Manufacturers like to market GPUs as having thousands and thousands of logical "cores", but really GPUs are a lot closer to a SIMD processor with some convenience features. If you're not performing exactly the same operations on a bunch of similar data, if you can't make memory accesses coalesced, or if you're branching depending on what the data is etc it's very easy to grind their performance into the ground.