News for hackers. Stuff that matters.
Re:Apple’s new M1 Pro and M1 Max processors by lowbloodsugar on Monday October 18, 2021 @02:22PM (#28909201)
Really curious if the memory bandwidth is entirely available to the CPU if the GPU is idle. An nvidia RTX3090 has nearly 1TB/s bandwidth, so the GPU is clearly going to use as much of the 400GB/s as possible. Other unified architectures have multiple channels or synchronization to memory, such that no one part of the system can access the full bandwidth. But if the CPU can access all 400GB/s, that is an absolute game changer for anything memory bound. Like 10x faster than an i9 I think?
Re:Apple’s new M1 Pro and M1 Max processors by znwu on Monday October 18, 2021 @03:51PM (#28910698)
Not sure if it will be available, but 400GB/s is way too much for 8 cores to take up. You would need some sort of avx512 to hog up that much bandwidth.

Moreover, it's not clear how much of a bandwidth/width does M1 max CPU interconnect/bus provide.

--------

Edit: Add common sense about HPC workloads.

There is a fundamental idea called memory-access-to-computation ratio. We can't assume a 1:0 ratio since it was doing literally nothing except copying.

Typically your program needs serious fixing if it can't achieve 1:4. (This figure comes from a CUDA course. But I think it should be similar for SIMD)

Edit: also a lot of that bandwidth is fed through cache. Locality will eliminate some orders of magnitudes of memory access, depending on the code.

Re:Apple’s new M1 Pro and M1 Max processors by GeekyBear on Monday October 18, 2021 @04:13PM (#28911004)
A single big core in the M1 could pretty much saturate the memory bandwidth available.

https://www.anandtech.com/show/16252/mac-mini-apple-m1-teste...

Re:Apple’s new M1 Pro and M1 Max processors by terafo on Monday October 18, 2021 @04:53PM (#28911574)
> Not sure if it will be available, but 400GB/s is way too much for 8 cores to take up. You would need some sort of avx512 to hog up that much bandwidth.

If we assume that frequency is 3.2Ghz and IPC of 3 with well optimized code(which is conservative for performance cores since they are extremely wide) and count only performance cores we get 5 bytes for instruction. M1 supports 128-bit Arm Neon, so peak bandwidth usage per instruction(if I didn't miss anything) is 32 bytes.

Re:Apple’s new M1 Pro and M1 Max processors by lowbloodsugar on Monday October 18, 2021 @04:21PM (#28911150)
Don't know the clock speed but 8 cores at 3Ghz working on 128bit SIMD is 8316 = 384GB/s so we are in the right ball park. Not that I personally have a use for that =) Oh, wait, bloody Java GC might be a use for that. (LOL, FML or both).
Re:Apple’s new M1 Pro and M1 Max processors by dragontamer on Monday October 18, 2021 @04:29PM (#28911262)
But the classic SIMD problem is matrix-multiplication, which doesn't need full memory bandwidth (because a lot of the calculations are happening inside of cache).

The question is: what kind of problems are people needing that want 400GB/s bandwidth on a CPU? Well, probably none frankly. The bandwidth is for the iGPU really.

The CPU just "might as well" have it, since its a system-on-a-chip. CPUs usually don't care too much about main-memory bandwidth, because its like 50ns+ away latency (or ~200 clock ticks). So to get a CPU going in any typical capacity, you'll basically want to operate out of L1 / L2 cache.

> Oh, wait, bloody Java GC might be a use for that. (LOL, FML or both).

For example, I know you meant the GC as a joke. But if you think of it, a GC is mostly following pointer->next kind of operations, which means its mostly latency bound, not bandwidth bound. It doesn't matter that you can read 400GB/s, your CPU is going to read an 8-byte pointer, wait 50-nanoseconds for the RAM to respond, get the new value, and then read a new 8-byte pointer.

Unless you can fix memory latency (and hint, no one seems to be able to do so), you'll be only able to hit 160MB/s or so, no matter how high your theoretical bandwidth is, you get latency locked at a much lower value.

Re:Apple’s new M1 Pro and M1 Max processors by znwu on Monday October 18, 2021 @05:14PM (#28911850)
Yeah the marking phase cannot be efficiently vectorized. But I wonder if it can help with compacting/copying phase.

Also for me the process sounds oddly familiar to vmem table walking. There is currently a RISC-V J extension drafting group. I wonder what they can come up with.

Re:Apple’s new M1 Pro and M1 Max processors by zX41ZdbW on Monday October 18, 2021 @07:42PM (#28913262)
> The question is: what kind of problems are people needing that want 400GB/s bandwidth on a CPU? Well, probably none frankly.

It is needed for analytic databases, e.g. ClickHouse: https://presentations.clickhouse.com/meetup53/optimizations/

Re:Apple’s new M1 Pro and M1 Max processors by znwu on Monday October 18, 2021 @09:55PM (#28914037)
This is some seriously interesting stuff.

But they are demonstrating with 16 cores + 30 GB/s & 128 cores + 190 GB/s. And to my understanding they did not really mention what type of computational load did they perform. So this does not sound too ridiculous. M1 max is pairing 8 cores + 400GB/s.

Re:Apple’s new M1 Pro and M1 Max processors by carlhjerpe on Monday October 18, 2021 @04:46PM (#28911490)
Doesn't prefetching data into the cache more quickly assist in execution speed here?
Re:Apple’s new M1 Pro and M1 Max processors by dragontamer on Monday October 18, 2021 @04:47PM (#28911498)
How do you prefetch "node->next" where "node" is in a linked list?

Answer: you literally can't. And that's why this kind of coding style will forever be latency bound.

EDIT: Prefetching works when the address can be predicted ahead of time. For example, when your CPU-core is reading "array", then "array+8", then "array+16", you can be pretty damn sure the next thing it wants to read is "array+24", so you prefetch that. There's no need to wait for the CPU to actually issue the command for "array+24", you fetch it even before the code executes.

Now if you have "0x8009230", which points to "0x81105534", which points to "0x92FB220", good luck prefetching that sequence.

--------

Which is why servers use SMT / hyperthreading, so that the core can "switch" to another thread while waiting those 50-nanoseconds / 200-cycles or so.

Re:Apple’s new M1 Pro and M1 Max processors by carlhjerpe on Monday October 18, 2021 @05:04PM (#28911715)
I don't really know how the implementation of a tracing GC works but I was thinking they could do some smart memory ordering to land in the same cache-line as often as possible.

Thanks for the clarifications :)

Re:Apple’s new M1 Pro and M1 Max processors by monocasa on Monday October 18, 2021 @06:08PM (#28912437)
Interestingly earlyish smalltalk VMs used to keep the object headers in a separate contiguous table.

Part of the problem though, is that the object graph walk pretty quickly is non contiguous, regardless of how it's laid out in memory.

Re:Apple’s new M1 Pro and M1 Max processors by kaba0 on Tuesday October 19, 2021 @04:23AM (#28915983)
But that’s just the marking phase, isn’t it? And most of it can be done fully in parallel, so while not all CPU cores can be maxed out with that, more often than not the original problem itself can be hard to parallelize to that level, so “wasting” a single core may very well be worth it.
Re:Apple’s new M1 Pro and M1 Max processors by rocqua on Tuesday October 19, 2021 @02:52AM (#28915495)
You prefetch by having node->next as close as possible to node. You do that by using an allocator that tries very hard to ensure this.

Doesn't work that well for GC but for specific workloads it can work very nicely.

Re:Apple’s new M1 Pro and M1 Max processors by dragontamer on Tuesday October 19, 2021 @12:36PM (#28920121)
Yeah, that's a fine point.

I always like pointing out Knuth's dancing links algorithm for Exact-covering problems. All "links" in that algorithm are of the form "1 -> 2 -> 3 -> 4 -> 5" at algorithm start.

Then, as the algorithm "guesses" particular coverings, it turns into "1->3->4->5", or "1->4", that is, always monotonically increasing.

As such, no dynamic memory is needed ever. The linked-list is "statically" allocated at the start of the program, and always traversed in memory order.

Indeed, Knuth designed the scheme as "imagine doing malloc/free" to remove each link, but then later, "free/malloc" to undo the previous steps (because in Exact-covering backtracking, you'll try something, realize its a dead end, and need to backtrack). Instead of a malloc followed up by a later free, you "just" drop the node out of the linked list, and later reinsert it. So the malloc/free is completely redundant.

In particular: a given "guess" into an exact-covering problem can only "undo" its backtracking to the full problem scope. From there, each "guess" only removes possibilities. So you use the "maximum" amount of memory at program start, you "free" (but not really) nodes each time you try a guess, and then you "reinsert" those nodes to backtrack to the original scope of the problem.

Finally, when you realize that, you might as well put them all into order for not only simplicity, but also for speed on modern computers (prefetching and all that jazz).

Its a very specific situation but... it does happen sometimes.

Re:Apple’s new M1 Pro and M1 Max processors by hajile on Monday October 18, 2021 @04:42PM (#28911439)
AMD showed with their Infinity Cache that you can get away with much less bandwidth if you have large caches. It has the side effect of radically reducing power consumption.

Apple put 32MB of cache in their latest iPhone. 128 or even 256MB of L3 cache wouldn't surprise me at all given the power benefits.

Re:Apple’s new M1 Pro and M1 Max processors by londons_explore on Monday October 18, 2021 @02:30PM (#28909378)
I suspect the GPU is never really idle.

Even simple screen refresh blending say 5 layers and outputting it to a 4k screen is 190Gbits at 144 Hz.

Re:Apple’s new M1 Pro and M1 Max processors by modulusshift on Monday October 18, 2021 @04:26PM (#28911220)
Apple put ProMotion in the built in display, so while it can ramp up to 120Hz, it'll idle at more like 24 Hz when showing static content. (the iPad Pro goes all the way down to 10Hz, but some early sources seem to say 24Hz for these MacBook Pros.) There may also be panel self refresh involved, in which case a static image won't even need that much. I bet the display coprocessors will expose the adaptive refresh functionality over the external display connectors as well.
Re:Apple’s new M1 Pro and M1 Max processors by londons_explore on Tuesday October 19, 2021 @04:03AM (#28915874)
It only takes a tiny animation (eg. a spinner, pulsing glowing background, animated clock, advert somewhere, etc), and suddenly the whole screen is back to 120 Hz refresh.
Re:Apple’s new M1 Pro and M1 Max processors by simonh on Tuesday October 19, 2021 @04:55AM (#28916139)
That's a useful tip for saving some battery actually, thanks.
Re:Apple’s new M1 Pro and M1 Max processors by lowbloodsugar on Monday October 18, 2021 @02:42PM (#28909599)
Don't know much about the graphics on an M1. Does it not render to a framebuffer? Is that framebuffer spread over all 4 memory banks? Can't wait to read all about it.
Re:Apple’s new M1 Pro and M1 Max processors by simonh on Tuesday October 19, 2021 @04:58AM (#28916156)
The updates from the Asahi Linux team are fantastic for getting insights into the M1 architecture. They've not really dug deep into the GPU yet, but that's coming soon.
Re:Apple’s new M1 Pro and M1 Max processors by floatboth on Monday October 18, 2021 @09:13PM (#28913824)
When nothing is changing, you do not have to touch the GPU. Yes, without Panel Self Refresh there would be this many bits going to the panel at that rate, but the display engine would keep resubmitting the same buffer. No need to rerender when there's no damage. (And when there is, you don't have to rerender the whole screen, only the combined damage of the previous and current frames.)
Re:Apple’s new M1 Pro and M1 Max processors by snek_case on Monday October 18, 2021 @03:00PM (#28909951)
Don't Apple iPhones use an adaptive refresh rate nowadays?
Re:Apple’s new M1 Pro and M1 Max processors by andy_ppp on Monday October 18, 2021 @03:25PM (#28910327)
Indeed ProMotion is coming to these new MacBooks too.
Re:Apple’s new M1 Pro and M1 Max processors by tkrsh on Monday October 18, 2021 @03:43PM (#28910581)
More memory bandwith = 10x faster than an i9 ? this makes no sense to me doesn't clock speed and cores determine the major part of the performance of a cpu ?
Re:Apple’s new M1 Pro and M1 Max processors by tcmart14 on Monday October 18, 2021 @11:54PM (#28914690)
Yes and no. There are many variables to take into account. An example from the early days of the PPC architecture was their ability to pre-empt instructions. This gave performance boasts even in the absence of a higher clock speed. I can't speak specifically on the M1, but there are other things outside of clock speed and cores that determine speed.