5 ms·
Interestingly, M1 doesn't have that much secret sauce in it - it's extremely wide and benefits immensely from avoiding the x86 tax on the decoder, with a few tr
by mhh__ 6y ago
Interestingly, M1 doesn't have that much secret sauce in it - it's extremely wide and benefits immensely from avoiding the x86 tax on the decoder, with a few tricks up its sleeve. Apple have shown it's possible, so - although starting now isn't ideal - if Samsung have the wherewithal to do it they absolutely could.
More difficult, however, would probably be selling it - I would imagine some HPC clusters would love it, for example, but for consumer products Apple can charge through the roof because their customers are used to paying pretty high prices for (sometimes better, sometimes worse) hardware. Apple's vertical integration also means they basically don't have to bother building an acceptable ecosystem around their new chipset - there's basically no documentation or vTune-style performance tools. It's also partly a question of priorities, but AMD still lag behind Intel even after decades in the game.
- vlovich123 6y agoWhat’s interesting is that even when emulating x86 they outperform AMD/Intel. That means the decoder improvements of doing a bunch of decodes in parallel (which x86 can’t do due to being CISC) aren’t the whole story. It could be that Apple just translates x86 code into fixed width to work around this or it could be other architectural improvements.
- mhh__ 6y agoThe vast majority of instructions by a computer are executed in loops, if you perform the translation once it's an O(1) overhead in the ideal case. Intel and AMD both perform decodes in parallel, but not as wide as M1, but having such a large and complex decoder costs silicon and power. Taking RISC-V as an example, a fixed width frontend is a project for a student, a modern x86 decoder is probably millions to write and verify. I bet both Intel and AMD aren't exactly in love with x86 at the moment
- dragontamer 6y ago> a modern x86 decoder is probably millions to write and verify I must be missing something, because it looks pretty simple as a segmented sum problem to me. A good example of parallel segmented sum is bishop / rook (aka sliding pieces) movement. https://www.chessprogramming.org/Kogge-Stone_Algorithm https://www.chessprogramming.org/Kogge-Stone_Algorithm This segmented sum / prefix sum / Kogge Stone is taught in carry sum adder class at the undergrad level. Sure, it's non obvious that it applies to parallel decoding but id expect this sort of thing to be a student exercise at the masters level.
- mhh__ 6y agoIs it simple? Variable length encoding doesn't have to be overly difficult, but x86 is a weird ISA. I'm not entirely familiar with what you cite so I can't really comment, but x86's semi-unbounded prefixes and sheer volume of extensions make things difficult. A master's project might be to write a decoder, possibly to verify (prove - everything in a CPU has to be formally verified or generated from some other formally verified tool) it. As proof I raise that many disassemblers, which run as software and are therefore much easier to write, still disagree and struggle with x86
- dragontamer 6y agoKogge-Stone proved that ANY associative function can be parallelized with a prefix-sum arrangement. Associative defined as in f(f(x, y), z) == f(x, f(y, z)... or more commonly (A+B) + C == A + (B+C), where + is any associative operator) https://en.wikipedia.org/wiki/Prefix_sum https://en.wikipedia.org/wiki/Prefix_sum In particular, this arrangement: https://en.wikipedia.org/wiki/Prefix_sum#/media/File:Hillis-Steele_Prefix_Sum.svg https://en.wikipedia.org/wiki/Prefix_sum#/media/File:Hillis-... Now "add" (or +) is associative. But it also works for *, min, max, and even weird stuff like "Can the Bishop move here" or "Can the Rook move here". So the goal is to find an associative operator that you apply byte-per-byte. ------ Okay, a brief detour. It seems obvious to me that a finite-state machine can decode x86 byte-by-byte. FSM is the "obvious" sequential algorithm that determines whether the byte is the start-of-instruction, or the middle-of-instruction, as well as what instruction it is by the end. Remember: we're just trying to make a FSM decode ONE instruction right now. That's pretty obvious how to do that. (Alternatively, imagine a RegEx that can parse an instruction from the bytestream when given the start-of-instruction. All Regular-expressions have a finite-state-machine representation). Hillis / Steele proved that finite-state machines are associative operators (!!!), and therefore can be used in parallel-prefix sum arrangements. (http://uenics.evansville.edu/~mr56/ece757/DataParallelAlgorithms.pdf http://uenics.evansville.edu/~mr56/ece757/DataParallelAlgori...) The page number is 1176: > Since this composition operation is associative, we may compute the automaton state after every character in a string as follows: > 1. Replace every character in the string with the array representation of its state-to-state function. > 2. Perform a parallel-prefix operation. The combining function is the composition of arrays as described above. The net effect is that, after this step, every character c of the original string has been replaced by an array representing the state- to-state function for that prefix of the original string that ends at (and includes) c. > 3. Use the initial automaton state (N in our example) to index into all these arrays. Now every character has been replaced by the state the automaton would have after that character. In short: computing the "state" of a sequential FSM applied across its inputs can be EASILY performed in parallel through the prefix-sum model. Any finite state machine can be converted into parallel prefix form through this mechanism. "Work Efficient" Parallel Prefix arrangement is O(log(n)) depth and O(n) total elements, which means that parallel decoding to any width (ie: 8-way decoder, 16-way decoder, or even 1024-way decoder) is LINEAR in terms of power-consumption and O(log(n)) with respect to time. The layout for work-efficient Parallel Prefix is: https://en.wikipedia.org/wiki/Prefix_sum#/media/File:Prefix_sum_16.svg https://en.wikipedia.org/wiki/Prefix_sum#/media/File:Prefix_...
- spijdar 6y ago> I bet both Intel and AMD aren't exactly in love with x86 at the moment This has been the case for, eh, decades now? To me it's almost a joke how many times Intel has tried to replace ia32 with a modernized replacement and miserably failed to make any headway. I suppose Intel doesn't want to try competing with the legion of architecturally similar RISC cores and would rather "go big" with ideas like Itanium/i860/i960/iAPX. It's funny to imagine, but maybe one day they'd release a RISC-V implementing processor. Can't imagine them licensing the rights to ARM, and going with Power or MIPS also seems out of character.
- dragontamer 6y agoIntel / AMD have a 4-wide decoder, of which can be a 6-wide decoder if executing out of the uOp cache. Apple just went with an 8-wide decoder, surprising a bunch of people. There's not much difference between 4-wide and 8-wide, aside from Apple deciding that such a wide single-core unit was worthwhile.
- mhh__ 6y agoThat depends on how many execution units it has to play with, although I guess the bottleneck at that point could end up being the length of a predictable flow. Not that Apple will tell us how many units it has
- dragontamer 6y agohttps://www.anandtech.com/show/16226/apple-silicon-m1-a14-deep-dive/2 https://www.anandtech.com/show/16226/apple-silicon-m1-a14-de... It's actually well known how wide the M1 is.
- baybal2 6y ago> Intel / AMD have a 4-wide decoder, of which can be a 6-wide decoder if executing out of the uOp cache. uOps are already decoded by definition
- adrian_b 6y agoWhen emulating x86 Apple translates the x86 code into ARM code, so it is executed later at almost native speeds. Only for programs that depend heavily on just-in-time compilation for Java, JavaScript etc. Apple must fall-back to interpretation of the x86 instructions, being then much slower. Also the outperforming of AMD/Intel has been somewhat exaggerated. Apple M1 is faster in single-thread than any old Intel or AMD, but it is slower than any new Zen 3 CPU and it will be slower than the top models of Intel Tiger Lake H and Intel Rocket Lake. In multi-thread M1 is easily beaten by many processors. On Christmas I have upgraded the CPU in one of my computers with a Ryzen 9 5900X, so I could verify that in the single-thread benchmarks that I could run on my computer, the values matched those published elsewhere for Zen 3 and they also exceeded the highest of the values published for Apple M1, by e.g. from 3% to 4% in Geekbench 5, until 24% in gmpbench.
- teruakohatu 6y agoI agree that the advantage has been exaggerated, but to be fair the M1 is a laptop class processor that is performing just slightly less than a gaming CPU. Your CPU cooler is probably close to half the size of a mac mini alone, and the CPU alone probably draws a lot more power than an entire mac mini. When the M2 comes out with a big heatsink and fan, it is going to be extremely competitive. Although AMD might be on 5nm by then.
- sudosysgen 6y agoThe per-core power consumption of an M1 and a (edit:)5990X is actually almost identical.
- teruakohatu 6y agoThe TDP of the 5900 is 105w with 12 cores. So let's say 8.75w/core. A 5950X is slightly higher per core wattage. The M1 has a maximum power consumption of 15.1w (13.8w + 1.3w) so for the high powered cores that is 3.45w/core and a miniscule amount for the low power cores. A mac mini tops out at around 20w during 8-core CPU benchmarks. While a 5950X PC will draw around 96w at the wall when idle. I know a Ryzen desktop CPU probably won't necessarily draw its entire TDP but it is not in the same league as an low powered CPU such as the M1 or the latest Ryzen mobile CPUs in terms of power consumption.
- pezezin 6y agoNo need to wait for Apple or Samsung, if you really want to go the ARM route for HPC, Fujitsu will happily sell you the A64FX: https://www.fujitsu.com/global/products/computing/servers/supercomputer/a64fx/ https://www.fujitsu.com/global/products/computing/servers/su...
- mhh__ 6y agoI'm aware. The documentation is depressingly more detailed that what Apple bless you with. I always get the feeling that Apple create for the same reason a pretentious chef cooks, you're merely proof of my greatness.
- sliken 6y agoAgreed, nothing magic, no tricks, just solid engineering. Larger caches, lower latency caches, wider issue, larger re-order buffer, lower memory latency (30ns without TLB misses), etc. The impressive part is that much engineering resulted in a low power chip that apple can afford to put into $700 desktops and $1000 laptops and competes with the per core performance (and wins on perf/watt) against Intel and AMD.
- mhh__ 6y agoYes, but keep in mind if you spec those laptops out to have 16Gb and decent storage they're suddenly double the price. If M1 is anything it almost definitely isn't cheap