Live data from Hacker News

Ask HN: Resources for general purpose GPU development on Apple's M* chips?

news.ycombinator.com

51–60 of 86 posts

Re: Ask HN: Resources for general purpose GPU development on Apple's M* chips?

#51
post #7

You can help with the reverse engineering of Apple Silicon done by a dozen people worldwide, that is how we find out the GPU and NPU instructions[1-4]. There is over 43 trillion float operations per second to unlock at 8 terabit per second 'unified' memory bandwidth and 270 gigabits per second networking (less on the smaller chips).... [1] https://github.com/AsahiLinux/gpu [2] https://github.com/dougallj/applegpu [3]…

any place you have your current progress written up on? Any methodology I could help contribute on? I've read each one of the four links you've given over the years and it seems vague with how far people have currently gotten and exact issues.

>Any methodology I could help contribute on?

Several people have already contacted me today with this request. This is how I give out details and share current progress with you.

Yes, you can help, most people on HN could. It is not that difficult work and it is not just low level debugging, coding and FPGA hardware. It is also organizing and even simple sales, talking to funders. With patience, you could even get paid to help.

>any place you have your current progress written up on?

Not any place in public, because of its value for zero-day exploits. This knowledge is worth millions.

I'm in the process of rewriting my three scientific papers on reverse engineering Apple Silicon low level instructions.

>it seems vague with how far people have currently gotten and exact issues.

Yes, I'm afraid you're right, my apologies. It's very much detailed and technical stuff, some of it under patent and NDA, some even sensitive for winning economic wars and ongoing wars (you can guess those are exiting stories). It even plays a role in the $52.7 billion US, €43 billion EU and $150 billion (unconfirmed) Chinese Chips Acts. Apple Silicon is the main reason TSMC opened a US factory [1], keeping its instruction set details secret is deemed important.

If you want more information, you should join our offline video discussions for more info. Maybe sometimes sign an NDA for the juicy bits.

[1] https://www.cnbc.com/2024/12/13/inside-tsmcs-new-chip-fab-wh...

Re: Ask HN: Resources for general purpose GPU development on Apple's M* chips?

#52
post #47

Earlier quoted context omitted.

Yes, knowing the exact CPU and ANE assembly instructions (or the underlying microcode!!) allows for general purpose software to adaptively compile processes on all the core types, not just the CPU ones. Its won't always be faster, you get more cache misses (some cores don't have cache) and different DMA and thread scheduling, some registers can't fit the floats or large integers, etc etc. But yes, it will be possible…

What would a "llvm compilable" hello world look like that matches the libc GPU example for "AGX" (Apple Graphics)? It's not possible from MacOS, right? It'd have to be done from Linux?

No, I don't think it is impossible for MacOS. I might be missing a detail here, not sure. I have to think it over.

I have seen [1] you can patch ANECompilerService, so you can even speed up existing code, because Apple compiles your code just in time (at runtime) on each machine. We could do that for MacOS libc too.

[1] Some how-to hints in https://discussions.apple.com/thread/254758525?sortBy=rank

Re: Ask HN: Resources for general purpose GPU development on Apple's M* chips?

#53
post #30

Earlier quoted context omitted.

Apple wants total freedom to rework lower levels of the stack down to the hardware, without worrying about application compatibility, hence their answer will continue to be Metal.

I agree that it allows Apple to redefine Apple Silicon instruction sets without having do explain it to 3rd party software developers, but it is certainly not the main reason they hide the technical documentation of the chips.

I imagine it’s just efficient allocation of engineering resources.

Re: Ask HN: Resources for general purpose GPU development on Apple's M* chips?

#54

People have already mentioned Metal, but if you want cross platform, https://github.com/gfx-rs/wgpu has a vulkan-like API and cross compiles to all the various GPU frameworks. I believe it uses https://github.com/KhronosGroup/MoltenVK to run on Macs. You can also see the metal shader transpilation results for debugging.

With what the OP asked for, I don't think wgpu is the right choice. They want to push the limits of Apple Silicon, or do Apple platform specific work, so an abstraction layer like wgpu is going in the opposite direction in my opinion. Metal, and Apple's docs are the place to start.

Indeed. I'm curious how much overhead there is in practice given the fact that the hardware wasn't designed to provide vulkan support. I honestly have no clue what to expect.

Re: Ask HN: Resources for general purpose GPU development on Apple's M* chips?

#55
post #25

If you're looking for a high level introduction to GPU development on Apple silicon I would recommend learning Metal. It's Apple's GPU acceleration language similar to CUDA for Nvidia hardware. I ported a set of puzzles for CUDA called GPU-Puzzles (a collection of exercises designed to teach GPU programming fundamentals)[1] to Metal [2]. I think it's a very accessible introduction to Metal and writing GPU kernels. [1…

Can anyone recommend a CUDA equivalent of (2)? That’s a spectacular learning resource and I’d like to use a similar one to upskill for CUDA

Re: Ask HN: Resources for general purpose GPU development on Apple's M* chips?

#56
post #25

If you're looking for a high level introduction to GPU development on Apple silicon I would recommend learning Metal. It's Apple's GPU acceleration language similar to CUDA for Nvidia hardware. I ported a set of puzzles for CUDA called GPU-Puzzles (a collection of exercises designed to teach GPU programming fundamentals)[1] to Metal [2]. I think it's a very accessible introduction to Metal and writing GPU kernels. [1…

Can anyone recommend a CUDA equivalent of (2)? That’s a spectacular learning resource and I’d like to use a similar one to upskill for CUDA

Isn’t the link right before it exactly what you’re asking for? Since 2 is a port of 1

Re: Ask HN: Resources for general purpose GPU development on Apple's M* chips?

#58
post #51

Earlier quoted context omitted.

any place you have your current progress written up on? Any methodology I could help contribute on? I've read each one of the four links you've given over the years and it seems vague with how far people have currently gotten and exact issues.

>Any methodology I could help contribute on? Several people have already contacted me today with this request. This is how I give out details and share current progress with you. Yes, you can help, most people on HN could. It is not that difficult work and it is not just low level debugging, coding and FPGA hardware. It is also organizing and even simple sales, talking to funders. With patience, you could even get pa…

While understanding the GPU’s microarchitecture might be useful for exploits it’s definitely not worth “millions”.

Re: Ask HN: Resources for general purpose GPU development on Apple's M* chips?

#59
post #51

Earlier quoted context omitted.

>Any methodology I could help contribute on? Several people have already contacted me today with this request. This is how I give out details and share current progress with you. Yes, you can help, most people on HN could. It is not that difficult work and it is not just low level debugging, coding and FPGA hardware. It is also organizing and even simple sales, talking to funders. With patience, you could even get pa…

While understanding the GPU’s microarchitecture might be useful for exploits it’s definitely not worth “millions”.

You are right. The zero-day exploits might be worth roughly a million each, but not the family tree of native GPU's, ANE, CPU instruction sets and microarchitecture on which they would be based.

My apology for writing unclearly, English is not my native language. I'm surprised it is yours.

Saving on energy, programming effort and purchase cost of a supercomputer in case of M4 instruction sets and microarchitecture knowledge would also save millions.

Re: Ask HN: Resources for general purpose GPU development on Apple's M* chips?

#60
post #36

Earlier quoted context omitted.

> I aggregate all the M4 Mac mini ports into a M4 cluster by mesh networking all its Serdes/PCIe with FPGAs into a very cheap low power supercomputer with exaflop performance. Cheaper than NVDIA. I'm sure Apple does the same in their data centers. That sounds super interesting, do you happen to have some further information on that? Is it just a bunch of FPGAs issuing DMA TLPs?

It is not the first time they built super computers from off the shelf Apple machines [1]. M4 supercomputers are cheaper and it also will be lower Capex and Apex for most datacenter hardware. >do you happen to have some further information on that? Yes, the information is in my highly detailed custom documentation for the programmers and buyers of 'my' Apple Silicon super computer, Squeak and Ometa DSL programming la…

I forgot to add links to talk [5] by IBM Research on massively parallel Squeak Smalltalk and why it might be relevant for Apple Silicon reverse engineering and M4 clusters.

Talk [6] on free space optical interconnects without SerDes some day showing up on low power Apple Silicon (around M6-M8 models).

[5] https://www.youtube.com/watch?v=GBtqQwcJoN0

[6] https://www.youtube.com/watch?v=-dQoImLNgWs

Post reply on HN