Hacker News new | past | comments | ask | show | jobs | submit login
Dissecting the Apple M1 GPU, part I (rosenzweig.io)
548 points by caution 9 days ago | hide | past | favorite | 141 comments





>Some speculate it might descend from PowerVR GPUs, as used in older iPhones, while others believe the GPU to be completely custom. But rumours and speculations are no fun when we can peek under the hood ourselves!

As per IMG CEO, Apple has never not been an IMG customer. ( Referring to period between 2015 and 2019.) Unfortunately that quote, along with that article has simply vanished. It was said during an Interview on a British newspaper / web site if I remember correctly.

"On 2 January 2020, Imagination Technologies announced a new multi-year license agreement with Apple including access to a wider range of Imagination's IP in exchange for license fees. This deal replaced the prior deal signed on 6 February 2014." [1]

The Apple official Metal Feature set document [2], All Apple A Series SoC including the latest A14 supports PVRTC, which stands for PowerVR Texture Compression[3].

It could be a Custom GPU, but it still has plenty of PowerVR tech in it. Just like Apple Custom CPU, it is still an ARM.

Note: I am still bitter at what Apple has done to IMG / PowerVR.

[1] https://www.imaginationtech.com/news/press-release/imaginati...

[2] https://developer.apple.com/metal/Metal-Feature-Set-Tables.p...

[3] https://en.wikipedia.org/wiki/PVRTC


> Note: I am still bitter at what Apple has done to IMG / PowerVR.

I'm unfamiliar with this; are you bitter about a lack of attribution that they produced lots of the IP their GPUs are built on?


Apple stated they will go Custom GPU, depending on how you define Custom, it has plenty of PowerVR tech in it. ( IMG even deleted that Press Release, which you could still find a copy here [1] )

"Apple expects that they will no longer be using Imagination’s IP for new products in 15 to 24 months."

But at no point in time did Apple announced they stop supporting PVRTC. Nor did they make any depreciation notice.

That announcement caused IMG's stock price fall by nearly 80%. IMG was later sold to a Chinese VC. ( Which somehow had some tiny connection linking to Apple, but that is in the conspiracy field so I wont go into it )

And if you look back now, Apple were not telling truth or lying by omission.

Which is what got me to scrutinise every details when they had a battle with Qualcomm. And it was a very different view to what mainstream media tells you.

[1] https://www.displaydaily.com/article/press-releases/discussi...


>And if you look back now, Apple were not telling truth or lying by omission.

From reading this, I'd be mad at the bogus/flimsy stock market (and the restrictions on behavior it imposes on companies to satisfy ever more greedy stockholders) rather than Apple here.


When apple is your customer, they can make or break your company. Of course, you can say that it's a shoddy business practice to lay all your eggs in one basket, but I think it's more complex than that. It's rather difficult to provide services or products to Apple given that they often want their own bespoke everything without investing significant amounts of money into your business, they're just that big of a customer. And not pursuing Apple's business might be a deathwish as that's exactly what all the shareholders would want, it often looks like a strike-the-metal-whilst-it's-hot kind of a situation.

Tangentially, it's far easier to be an ethical underdog than it is to be an ethical winner. But Apple isn't even trying.


Mostly it's a sign that companies nowadays - not apple specifically, but apple included - are too large, breaking the market in all kinds of bad ways. There should be much simpler and harder caps on business size (and/or other large-size discouragements such as tax rates on revenue or some other hard-to-fake metric for size). The extremely wimpy trust-busting rules currently assume no harm until proven otherwise, which is much too high a bar, and much too slow, and much to reliant on the inefficient judicial system to be able to steer a market economy.

Size should not matter. Just don't step in and bail them when they break under their own weight.

Of course, when companies are large enough, shareholder's interests spin off into the regulator's domain, allowing interesting turn of events in the form of bailouts


> Just don't step in and bail them when they break under their own weight

But there's a significant economic cost to society when large companies fail catastrophically like this. Which is why size matters. Large companies mean putting all of our economic eggs in one basket, which is exactly what systems like capitalism are supposed to avoid.


There is a cost to society either way.

Reviving a corrupted entity to allow it to continue must have a cost that needs to be weight against the perceived loss of its benefits.


Yes, anything in economics is a tradeoff. But IMO preventing companies from getting so big in the first place is by far the lesser evil in this case.

What's the Qualcomm story?

Tl;dr : Apple decided to attack the Qualcomm business model and planned a 5-10 years strategy against Qualcomm. Shown by Apple Internal document in court. And later lost ( or settled ).

Apple took Qualcomm to court due to 4G/5G patents dispute. And made number of claims which were false, possibly inaccurate or lying by omission.

I initially sided with Apple, quoting Tim Cook

“Despite being just one of over a dozen companies who contributed to basic cellular standards, Qualcomm insists on charging Apple at least five times more in payments than all the other cellular patent licensors we have agreements with combined,”

Fives Times More than others Combined. That is ridiculous. We knew Qualcomm were expensive, but we never had an actual number or up to date figure. This allegation was repeated in all mainstream newspaper and website. There were at least Six other major companies ( Nokia, Samsung, Huawei, ZTE, Ericsson Intel/LG ) with broad wireless patent portfolio. That is Qualcomm = 5x where other companies = x/6. Or 30x difference if x were divided equally between all companies.

This got people furious. And I did too. Despite knowing Qualcomm have the best, this kind of multiple were unheard of.

That is until you sit down and start to run some numbers. It doesn't make any sense. You can add up the low end, high end estimate of all there other six companies patent licensing cost in their investor notes and rounding to the nearest number and it would still be an order of magnitude off the figure Apple were trying to paint.

Apple argued Qualcomm made double dipping because they were earning profits from Qualcomm Modem itself, and they are still charging for patents. As if the design of the Modem itself doesn't cost anything?

And numerous other claims.

At the end instead of going to PR battle with Apple, Qualcomm has shown immense restrain. I guess they knew they would win. And since then I have tremendous respect for their CEO, Steve Mollenkopf's professionalism.

The only person who bother to report all the fact from both side was Shara Tibken from Cnet. Who actually sit in every Apple Qualcomm trial ( There were multiple ) and tweet as well as post update. You can read about it here [1] to make up your own mind.

[1] https://www.cnet.com/news/apple-and-qualcomm-settle-heres-wh...


Well, if you read about Apple and their relation with suppliers, they're borderline abusive and have been for decades.

I know it's business but they seem a pretty bad customer by most standards.

People don't have to interact with that side plus the public image is super polished.

TL;DR: What you're saying seems perfectly in character.


The other side of the story is equally problematic. QCOM got into hot water for engaging in a pretty abusive licensing model. Here are a couple of examples:

If you wanted to use one QCOM patent, you'd have to pay for a suite of patents that includes IP you have no interest in using.

If you want to use a particular technology, the pricing would depend on the total price of your handset -- even if the difference in handset price has nothing to do with the Qualcomm technology.

Their business is tough because they basically spend years inventing technologies and then more years licensing them and defending their IP in court. Still, if you have to draw a moral/ethical conclusion I'd suggest that (at least in part) Qualcomm brought its 2016 Apple woes upon itself.


Note that Apple set up a large office next to Imagination's in the UK and recruited lots of IMG staff. Probably right to be bitter.

> Apple's has already been recruiting Imagination workers for months, its most prominent get being COO John Metcalfe. Until now, hires were being sent to Apple's main offices in London, or overseas to California.

> The company now has over a dozen listings for graphics-related jobs in South Hertfordshire, the region in which St. Albans and Kings Langley are based.

https://appleinsider.com/articles/17/07/10/apple-sets-up-off...

Edit to add quotes.


They're probably talking about Apple suddenly announcing they'd be dropping Imagination out of the blue in 2017.

But in the end it seems they didn't drop? Or are they just licensing a basic IP and building on top?

I remember the IMG stuff being full of bugs


It's really not clear. A licensing agreement was signed between the two early 2020 but the interim hurt IMG a lot, they lost a number of engineers, had to sell off their MIPS business, and the board ultimately put the company up for sale.

> The Apple official Metal Feature set document, All Apple A Series SoC including the latest A14 supports PVRTC, which stands for PowerVR Texture Compression.

I'm a little confused about why Apple can't support PVRTC after they stopped using PowerVR GPUs in their devices?

PVRTC is a texture format. Its latest incarnation (PVRTC2) was introduced in 2013. Being able to load and render the texture format (whether efficiently or not) doesn't appear to require a licence. I used to use PVRTC assets when developing for the original iPod touch. I can imagine Apple retaining support for the format on new hardware for backwards compatibility reasons, such as being able to load and run apps with PVRTC resources

It could very well be the case that PVRTC resources are no longer rendered using the same tech on modern Apple GPUs, and general performance improvements since 2013 make it a non-issue

I don't think support for the PVRTC format implies that a PowerVR GPU design is in use or that "plenty of PowerVR tech" is present in modern Apple GPUs


Yeah, one of the issues here seems to be the lack of clarity as to how IMG is defining their IP.

We could be at the point where the PVRTC patents are still valid, and Apple is paying those royalties, but there's no IMG RTL left in the GPU.

We could also be at the place where Apple somehow got a perpetual license to IMG's RTL, and the bones of the Apple GPUs are still very very clearly IMG GPUs, but they feel like they can essientially write the company off.


Apple had to keep PVRTC support. Apps were shipping with PVRTC compressed textures and no fallbacks.

What I find interesting is that PVRTC is the very last proprietary IMG format that Apple GPUs support.

IMG introduced an improved PVRTC2 texture compression format in 2012. Yet no Apple device has ever exposed support for it.

It looks like Apple was already thinking ahead back then and wanting to avoid supporting features that would require extra royalties.


Why would IMGT rely on a single customer?

Dodgy business practices.


Whether or not the majority of your company’s revenue comes from a single customer is not in your control. Imagine you are a small company selling 500 widgets a year then Apple calls and orders 50 million widgets. You have two choices: don’t take the deal or make your company 100% reliant on Apple.

100%. While diversifying is ideal many small businesses operate like this. That 50 million widget order might be the difference between scaling into a company that has budget to grow more consistently in the future or whether you continue in scarcity mode.

I understand it's just an example, but going from 500 to 50 million is enough to break your business if you're not paying attention to cash flow and invest too soon in production means.

IMG is an IP only company, so scaling the number of their widgets doesn't really scale their business requirements except maybe some (not all) support metrics.

Most people do the same, work for one entity. It's not that uncommon for companies as well. Thinking about aviation for example.

B2B is not B2C. It's easy for Google to have multiple equivalent customers with their mass market software. When you're making specialized hardware, not so much.

They used to be somewhat popular in Mediatek SoCs, but not so much recently. I don't know why they're not getting as many design wins recently - maybe they're too expensive or too power hungry.

In the end you can't just get new customers on demand - you have to earn them.


ARM gives a huge discount if you buy their CPU and GPU together. Hard to compete with that on price, so cheap Chinese SoC use ARM.

Qualcomm bought adreno from AMD (interestingly an anagram for radeon).

Samsung struck a deal to buy from AMD.

Intel moved from PowerVR to their own designs.

And just like that we're out of major chip makers other than Apple or the occasional specialized SoC that probably doesn't sell in huge volume or rake in the cash.

Making things worse, their really cool patents related to early geometry culling expire soon.


> ARM gives a huge discount if you buy their CPU and GPU together.

Yeah, I've heard rumors that ARM+Mali is cheaper than just ARM for the licensing fees.


It looks like Mali is now the "default" GPU in ARM SoCs; it's probably bundled with the CPU cores.

Or their IP simply isn’t very competitive, with Apple doing most of the heavy lifting. After all, the designs Apple used were custom.

> This suggests the hardware is superscalar, with more 16-bit ALUs than 32-bit ALUs

To me, it sounds like it might mean 32-bit ALUs can be used as two 16-bit ones; that's how I would approach it, unless I'm missing something? The vectorization can also happen at the superscalar level, if borrowing the instruction queue concept from out-of-order designs: buffer operations for a while until you've filled a vector unit's worth, align input data in the pipeline, execute. A smart compiler could rearrange opcodes to avoid dependency issues, and insert "flushes" or filling operations at the right time.


I recently added half floats to my 3D MMO engine, and I was very dissappointed when I discovered that very few GPUs support it in hardware!

Desktop Nvidia simply converts them to 32-bit floats up front so the performance is kept but memory is wasted, but raspberry does the 16 -> 32 bit calculations every time resulting in horrible performance.

I still have to test the engine on Jetson Nano with half floats, but I'm pretty sure I will be dissapointed again, and since raspberry doesn't support it I need to backtrack the code anyway!

After some further research I heard snapdragon has 16-bit support in the hardware and hopefully this is where we are heading! 32-bit is completely overkill for model data, it wastes memory and cycles! 16-bit for model data: vertex, normal, texture and index and 8-bit for bone-index and weights! Back to the 80-90s!

This is the last memory & performance increase we can grab now at "5"nm without adding too much complexity!

You can try the engine without half float here: http://talk.binarytask.com/task?id=5959519327505901449


> Desktop Nvidia simply converts them to 32-bit floats up front so the performance is kept but memory is wasted

Pascal has native FP16 operations and can execute 2 FP16's at once ( https://docs.nvidia.com/cuda/pascal-tuning-guide/index.html#... )

BUT, and this is where things get fucked up, Nvidia then neutered that in the GeForce lineup because market segmentation. In fact, it's slower than FP32 operations: "GTX 1080’s FP16 instruction rate is 1/128th its FP32 instruction rate" https://www.anandtech.com/show/10325/the-nvidia-geforce-gtx-...


TU102 and GA102 are back up to double-rate FP16.

GA102 is 1:1 FP16/FP32 rate, but with a ton of FP32 (30 Tflops for the RTX 3080).

Why would you even use floats when dealing with geometric data? With floats, coordinates near the origin have more precision than other coordinates, and this usually doesn't make sense because the choice of the origin is just a convention. Better to use fixed-point numbers for geometric data, so all coordinates have the same precision.

Geometry is only a part of the problem; much more compute goes into lighting and textures. Also scenes rarely span enough orders of magnitude of physical scale that the differences in precision matter (except may when using FP16). Finally, you probably can accept reduced precision for faraway objects (usually the camera is at the origin).

This is true, but nobody likes working in fixed-point because it's inconvenient and languages don't have good support for it. (I think this is a language problem, not an argument for floats.)

You can workaround this by doing most of your math in local coordinate spaces though, so it's fine for games.


Is this where I post the code I wrote twenty-five years ago to do 16-bit fixed-point 3D rendering? https://github.com/pjc50/ancient-3d-for-turboc

The target architecture was a 33MHz 486 PC running in "real" (ie sixteen-bit) mode. While hardware floating point was sometimes available (DX systems) it was quite slow.


> Why would you even use floats when dealing with geometric data?

Perf? Which hardware does have support for math on fixed-integers? (e.g. sqrt, inverse sqrt, ray triangle intersection accelerations, etc.)


Didnt Quake 1 use fixed-point 256x256 vertex meshes for all the 3d models? with morphing instead of skeletal animations on top of that resulting in funky wobbly artefacts.

IIRC the vertex coordinates were single precision floats (at least that's what my 24 year old pascal code uses :-) ) that were then additionally scaled and translated (so the center point was at the floor). What made it wobbly was the animation technique used. It had several animation sequences (walking, running, dying, etc..), each with multiple frame specifying the coordinates of a fixed number of 3D vertices. The indices of those vertices corresponded to the indices in a list of 2D vertices giving coordinated into a single 2D texture. IIRC Animation between frames used linear interpolation.

The Raspberry Pi 4 3D hardware has pretty extensive support for 16-bit floats. eg All 32-bit FP ops support "free" conversion from/to 16-bit float on input/output, and there are a few 16-bit float ops (eg multiply) which work on 16-bit vec2s (effectively giving double the throughput if they can be used). I don't know how well the Mesa driver supports any of that stuff though. Do you know if there was something specific that was slow?

Aha, interesting, where did you read about that? I just modified my vertex and normal arrays to half floats and the performance went down 80%!!!

Maybe the vc4-dri.so driver hasen't implemented it properly yet one year later? But does it still save the RAM?

So the texture uvs could be accelerated? But most of the data is in vec3... (vertex and normal)


While I do not believe Broadcom has released any documentation on the 3D hardware in the Raspberry Pi 4, you can figure out a fair amount by looking at the Mesa driver. In particular see the shader processor instruction packing code (https://github.com/mesa3d/mesa/blob/master/src/broadcom/qpu/...).

For vertex arrays, while in theory the driver could load vec2/vec4 F16 attributes into the vertex shader as-is, AFAICT the Mesa driver does not attempt to do this; they get converted to F32 as they are loaded from main memory. There would be downsides to getting rid of this conversion... in particular the hardware does not support F32->F16 conversions when loading attributes, so the driver would have to recompile the shader if you switched the vertex arrays to F32 (or perhaps more likely recompile the shader when it realises you are using F16 vertex arrays rather than F32).

In any case, the hardware does support zero overhead F16->F32 conversions when loading attributes, so you should not see a performance drop when switching vertex arrays to F16! The performance should go up slightly as less data needs to be loaded from main memory. If you're seeing an 80% performance drop something has gone terribly wrong!


> Yet Metal optimization resources imply 16-bit arithmetic should be significantly faster, in addition to a reduction of register usage leading to higher thread count (occupancy).

I believe this is a difference between the A14 GPU and the M1 GPU; the former's 32 bit throughput is half its 16 bit throughput, whereas on the latter they are equal.


There is the implication upthread that the M1 GPU is similar to or derived from the IMGTEC PowerVR GPUs, anyone know if that is the case?

Also, I noticed that IMGTEC are going to write an open source mesa driver, I wonder how much code the two drivers will be able to share.

https://riscv.org/blog/2020/11/picorio-the-raspberry-pi-like...


They pay multi-millions to license Imagination Tech patents and poached most of their best designers.

Even with a custom design, those designers are likely to think along the same lines (and Imagination Tech IP is pretty good in it's own right).

In any case, I doubt Apple would pay that much money if they didn't need rights to the IP.

The only real question is why they didn't acquire the company outright.


Apple deliberately designed their custom GPU to have the same performance characteristics as the PowerVR gpus that early iphones used.

Apple GPUs support the proprietary IMGTEC compressed texture format that nobody else uses and they use the same deferred rendering method.

Apple's deception was good that nobody realised they were shipping custom GPUs. Even with hindsight, nobody can really tell when apple shipped their first custom GPU. Apple may have even shipped GPUs which were a mixture of IMG and Apple RTL.

But at this point the internals are far enough appart that I doubt much code can be shared.


Exciting! I can't believe the incredible rate at which progress is being made on this front. And by a sophomore(?!) undergraduate student no less!

Alyssa was one of the primary developers behind the Panfrost open source drivers for a subset of Mali GPUs - she's a brilliant engineer and great to work with.

She also wrote panfrost while still in high school.

Is there an interview / write up with her somewhere? That's incredible for most people let alone a high schooler.


XDC 2018 - Lyude Paul & Alyssa Rosenzweig - Introducing Panfrost

https://www.youtube.com/watch?v=qtt2Y7XZS3k


I guess both presenters are trans? Interesting how many notable trans* programmers/engineers the field attracts.

You would be surprised by the amount of high-schoolers doing incredible work in open source software.

Like George Hotz, who at 17 removed the SIM lock on the iPhone and a few years later got sued by Sony for breaking security on the PlayStation 3.

As someone who has seen both of them work (and who got sued on the same lawsuit)... I wish people would stop putting geohot up on a pedestal. His entire career has been about self-promotion (something which he is very good at), but he got his start taking credit for other people's work (that SIM lock stuff was largely just implementing stuff other people told him about). He even took credit from my/our (fail0verflow's) work when he did the thing that got him sued (published some PS3 private keys), which was just him implementing the ECDSA attack we had detailed in a presentation a week prior, without a single mention until I emailed him to ask him to do so.

Alyssa's Panfrost work is leaps and bounds ahead of anything geohot has ever personally done.

Pretty much everyone of our profile gets started at around that age (I was porting Linux to a weirdo ISP router at 14 and working on Wii hardware and homebrew, the first "well known" thing I did, starting at 16-17), but somehow geohot has marketed himself to be some kind of genius when he's one of the more mediocre hackers I've known. He's not bad these days, but he has always represented his skills as being way better than they actually are, and taken solo credit for work that involved other people, his entire career.


Addendum: if you want someone I would consider an outstanding teenage hacker... look at comex.

I've seen that guy work in person and sometimes it felt like he was just streaming keystrokes into the keyboard buffer without regard for any visual feedback. That time at CCC, he was working on exploiting the Wii U. A bit later he called me over, and I was staring at a blank assembly file. He had just completed a full stack Wii U exploit, from WebKit to the kernel to the security CPU to its kernel, and expected me to dictate some assembly to him to dump the eFuses where the keys are held. I stumbled something like "Uuuuh.... I guess we need to deal with banks.... well how much memory can you dump? Uh.... yeah let's just treat it at linear.... errrr.... make a loop? I guess load a register with 0 and loop until, uhh... 0x1000? Yeah and you need to set the top bit and store that into, er.... 0xd8000...dc? I think? Let me check... uhh yeah and then read the data word from e0. I think. And put that somewhere you can dump."

Made me feel like a complete idiot :)


I think part of the fascination with wunderkind programmers, is that it reinforces the idea that people have innate talent, something that can be comforting to those who lack it. It’s similar to the fascination with lottery winners. Most people understand that building wealth tends to happen over decades from reasonable learned habits, but the fantasy of sudden, unearned wealth is more fun. Child geniuses are the fantasy of being good at something without putting in the work.

To put it very simplistic, there will always be the Wozniak's and the Jobs types in any scene/company/etc. (among others of course). The geo"hot"s of the world, with big egos, who like the publicity, make a rap video and promote "the cause" aggressively. That won't ever change but at least they are going into (and also bringing in) more mainstream media and folks. So there's that.

Something along the line of "there's no bad publicity", because out of the millions of tv watchers and his yt rap video watchers, these brings in a lot of people (at least teens) interested in the scene with a higher percentage of those who remain and go deeper into the technical parts of hacks, then learning about fail0verflow & co.

Many only then realized what the big picture actually is (insert podium meme)

So, for what it's worth, never underestimate how many people REALLY know and appreciate a lot more fail0verflow's work. Thanks again!

p.s. hopefully PS4 will catch up to the good old days of PS3. Pepperidge Farm remembers. Also that last year there was a pseudo-consensus that held-back PS4 hacks will be released only after the PS5 appears. (pretty please)


Geohot regularly streams programming on twitch. He's the real deal, you can go check out his streams on YouTube to see what he's doing now. What's especially impressive about him is how he can perform at a high level for hours and hours. Some of those streams are 10 hours long. I can't do that.

But many other people can. I'm not saying geohot is a completely unremarkable fraud, I'm saying he doesn't deserve the level of recognition he gets. There are plenty of people pulling 10-hour programming marathons today.

There's more than enough recognition to go around.

[Original comment: “How did you manage to make this about you?”]

Someone mentioned the person that stole his work as someone to look up to. It seems like a pretty justifiable personal grudge.


I just wish he weren't the default "genius teenage hacker" that people keep bringing up in completely unrelated threads. Let that honor go to any of the many humbler folks more skilled than him and who can actually work in teams with others :) (there's a reason why he's never been able been able to hold a job more than briefly as an intern...)

I don’t follow the above stuff close enough to have an opinion on the matter, mostly just hijacking this thread to say I’ve been following you on Twitter for a couple yrs now and have tons of respect for the work you do.

A rare talent that from what I’ve seen. Who also gets respect from people way smarter than myself. That’s always a signal I look for when I’m in out of my scope.

I hope this project works out for you. Always so much BS on the people side in OSS, something I learned the hard-way long ago. But talent is talent, work speaks for itself, etc.

You’ve certainly chosen a general enough topic/niche to draw lots of generic opinions and the whole peanut gallery stuff. So I predict this road will require quite of bit of blinders to operate without the constant distractions from the non contributing opinionated mediocrity. The only way to stay productive in such an environment IMO.


> there's a reason why he's never been able been able to hold a job more than briefly as an intern...

Guess that's why he decided to start his own company :)


Pretty much. My own personal interactions aside, I wouldn't want to work for him, given what I've heard from people who have.

Well, if the allegations here are true, he'll probably do very well getting a revolving door of VCs to give him money even if he/his company doesn't produce anything worthwhile.

Obligatory George Hotz (geohot) PS3 rap from back then: https://www.youtube.com/watch?v=9iUvuaChDEg

First time he appeared in the PS3 jailbreak scene I was like "wait, is this a Romanian?! Some boy-genius expat?!" because George is a common first name here and (fun fact) Hotz means "thief". Actually it is written hoț but Romanian teens sometimes write tz instead of ț. He was meant to be a key thief, I guess.

I still wonder if they got to examine the video in the courtroom...


Dissecting something without a single graph or illustration or image. For shame....

Why start with the shader compiler rather than simply whatever commands are necessary to get the screen turned on and a simple memory mapped framebuffer?

It would seem easier to get Linux booting (by just sending the same commands apples software does) before worrying about 3d acceleration and shaders...


Alyssa Rosenzweig specializes in writing GPU compilers/drivers. Other people, like marcan, specialize on the low level hardware and firmware stuff required to get the SoC to boot, including the display controller. The DC and GPU are almost entirely unrelated. She's working ahead here so that GPU acceleration, which is predicted to be the single hardest feature to enable, can be developed more quickly once the easy part of booting linux is done.

Precisely this :)

I'm not nearly as experienced as the blog post author, but I suspect the M1's GPU does not have any way of blitting to the screen other than driving it 'fully' - ie. using the standard command queue and shader units to even get the simplest 2D output.

In embedded SoCs the GPU is typically "render only", and display is handled by a different hardware block ("display engine" etc), and of course both CPU and GPU can write to it. Well that's even true in desktop GPUs but it's just tightly coupled there, both blocks are on the same PCIe device so the support is in one driver.

From the iPhone 7 Linux port we know that Apple is nothing special in terms of this (they have framebuffer working there)


So would the bootloader also include a rudimentary GPU driver to, for example, display the Apple logo, the boot device selection screen, the internet recovery UI and so on? One would think that they would've provided a simple framebuffer interface in the hardware for this kind of use case.

(I'm more of a software kind of guy, I might be entirely wrong here tho)


IIRC the firmware turns the screen on for you so it's already there when Linux boots.

Yes, this is a standard UEFI feature. The firmware basically hands off a structure indicating horizontal/vert resolution, pixel depth and a buffer.

Which is fine until you need to change the mode, or start doing heavy BLT/etc operations. At which point your machine will feel like something from the early 1990s.

So yes, you can get a full linux DE running with mesa and CPU GLES emulation, but its not really particularly usable.


It's worth noting that the M1 does not use EFI like Intel Macs do, so the kernel would still need to boot on this proprietary new mechanism. Apple previously indicated that the M1 Macs boot using a derivative of the iPhone/iPad boot procedure. There's a reasonable chance it'll still have something like the EFI buffer allocation mechanism, but it'll not be using a mainline standard. While it sucks that Apple ditched EFI, the good news is that it's probably reasonably well understood since Linux has already been booted on an iPhone 7 using Checkra1n [1] (and apparently with framebuffer support too!).

[1]: https://tuxphones.com/iphone-7-now-boots-postmarketos-linux/


How many FPS does it achieve on … is there an FPS standard (FPS) game for Mac GPU benchmarking?

It's about equivalent to an RX560 or NVIDIA 1030 I believe

I wonder whether this work could eventually enable a native Vulkan port for MacOS on this GPU.

hopefully, Apple M1(ARM) and AMD Zen(x86) can push Intel, Intel stuck at 14nm is what happened when there is no viable competitor.

Competition is great but it's not like Intel has been resting on their laurels; they've invested heavily in iterating on process nodes beyond 14nm.

Intel has simply failed.


??? You should learn about ASML - https://www.asml.com/en

Can someone explain why they would buy a Mac and install linux?

I used to dual boot windows for school and when I first switched to windows I had an old laptop's backup in bootcamp. Cross-platform software is much more ubiquitous than 5-10 years ago. For linux I always used another box or just run a VM. Nowadays my laptop can ssh or Remote Desktop into a more powerful machine. I have a custom built widows box, a custom built NAS running FreeNas (FreeBSD), 2 RPi's running Raspbian, and a not always linux box based on old hardware. There is a machine big or small to do things or play with. My VPN allows me to connect from anywhere.

What are you guys doing that you have to install linux instead of running a VM or remotely connecting to a linux box? If it's just for the sake of knowledge I can understand it.

Apple's touch pad experience in MacOS is the best in the market and it is always very different in Windows and Linux. The XPS, Lenovo and smaller vendors really make killer Linux/Windows laptops that have much more options than Macs.


>Can someone explain why they would buy a Mac and install linux?

One reason is to devote an older machine to Linux (M1 models are still new, but they wont be in 3-4 years. And in 6-7 years they might not be supported by new then MacOS releases at all (only security fixes). When someone gets the M4 or MX, they might want to retire the M1 models, or use them for server/supportive roles with Linux on them.

Others just prefer Mac hardware (Linus Torvalds himself was a big fan of the early Macbook Air, which we used with Linux, and has welcomed the M1 model as well) but Linux software for various reasons.

I, for one, ocassionally wish to boot to full native Linux for some stuff. I have several Linux computers I use too, but I usually use those headless, whereas a Mac laptop would be great with a good supported Linux.

>What are you guys doing that you have to install linux instead of running a VM or remotely connecting to a linux box? If it's just for the sake of knowledge I can understand it.

Besides repurposing an old Mac, even running a desktop environment as your primary or secondary driver is much faster and usable with bare metal (as opposed to a VM) and, of course, impossible with remote boxes (X forwarding aside, which is not workable as raw native desktop).


I use a 2008 MacBook and it still receives software updates (though a lot of modern software won’t run on it).

I have a 2012 Macbook Air that's still a great piece of hardware. Still great for light tasks and actually not too bad for heavier ones. It has very few moving/active parts - just a CPU fan and battery - so it doesn't require that much maintenance to keep chugging. Problem is, my official macOS security updates end end of next year. 10 years of support is alright I guess, but what do I do, throw it out and add it to the ewaste pile? I think not. I can give it a second life as a desktop or server (great idle power consumption) with Linux or any of the BSDs.

If I buy a 2022 Macbook Air, I'd like to repeat this process for it in 2032. Moore's law is dead, treasure your hardware.


Apple's hardware and build quality in superior then virtually anything else on the market, even at the same price point. You're talking about remote stationary machines, not single portable devices that can do everything you need. Most people don't have that. Linux isn't just a secondary OS you run on VM, many want to run it as a primary desktop OS with the best hardware available. A Dell XPS laptop may be more compatible with Linux out of the box, but it falls short on every other metric.

> Apple's hardware and build quality in superior then virtually anything else on the market, even at the same price point.

I don't see how it's superior. For that money you can buy Dell XPS or Thinkpad of same quality or better.

> but it falls short on every other metric

So far I didn't see any evidence of that. That may be true in 2011-2012 where not many laptops had hires screens with decent matrices, but definitely not relevant today.


I have a 2014 MacBook Pro and a Dell XPS 13 9370 Developer Edition. I like both very much.

I'm not sure I would say that the XPS is equal or better quality than the MBP though.

The trackpad isn't better than the Mac's and neither is the case construction. I prefer the aluminium unibody to the carbon fibre (rubberised plastic) stuck to aluminium plates of the XPS.

I really like the XPS though and would buy another if it broke. i.e. I wouldn't buy a Mac to run Linux but when Apple finally stop supporting my MBP I see no reason not to install Linux on it and extend its life. Especially as I like Linux as a desktop OS.


Statistical information from repair places suggests otherwise for build quality. For instance:

https://www.appleworld.today/blog/2020/6/1/apples-mac-get-a-...

It varies by year and place though.


Can’t take that seriously at all. MS ranks #1 and I actually know someone who works at a large customer and their surface devices last 12-18 months. They had over 500 of them. They don’t send them for repair because the warranty is a year so they are scrap then. No statistical contribution to that study. They are replacing them with Lenovo units with 3y NBD repair and support and they are cheaper.

As for Apple, you buy a 3 year warranty with AppleCare for less than the surface costs and that includes accidental damage for a small excess fee per event.


> As for Apple, you buy a 3 year warranty with AppleCare for less than the surface costs and that includes accidental damage for a small excess fee per event.

What? Maybe this is true for the M1-based MacBooks now, but I bought my Surface Book 3 with my Microsoft Business account (which was made for me for free when I bought my Surface Book 2 by a manager at the Dallas, TX Microsoft Store) and for $249 I got a three year warranty with three accidental damage incidents, also with no deductible. Yes, I had to pony up for a year of Office 365 for $69 to get the normally-$349 warranty for $100 off, but I already use Office 365 yearly sub anyway, so adding on an extra year of something I was going to buy anyway, for $100 off a 3-year, 3-incident, deductible-free warranty isn't exactly a "hard sell".

Although the only problem I've ever had with Microsoft's hardware products was my original Surface Book, and I'll admit, that was a miserable experience, but I had zero problems with my SB2 and none so far with my SB3.

Having said all that, I might actually switch over to Apple if they had a 15" 2-in-1 like my SB3. In order to functionally replace my Surface Book 3, I have to buy a $1499 12.9" iPad Pro, a $129 Apple Pencil 2nd gen, and a $2299 MacBook Pro M1. Adding Apple Care+ and tax brings the total up to $4670. But I also now have the problem of having to lug around two devices instead of just once as I do with the Surface Book 3. My totally pimped out Surface Book 3 + warranty + Office 365 1-year sub was $4350. That's the Quadro RTX 3000 MaxQ version also.

Right now, the Apple products have the performance advantage, I can't deny that. But they didn't have that when I bought my Surface Book 3, and Microsoft isn't going to sit on their ass. Their ARM-based Surface Pro X is following Microsoft trends perfectly. The first version of all their hardware ranges anywhere from a total joke to slightly underwhelming. But by the time 3rd and 4th iterations, Microsoft has their shit together. I fully expect that in 2-3 years, a Microsoft ARM-based Surface Book 5/6 will be a serious MacBook Pro contender, while also winning over users like me for the 2-in-1 aspect.


That's just some random help provider call stats though. Could just mean that the average Mac users are more prone to call such services, or that their sample might not be representative, or whatever.

Realistically how many people buy macbooks to run linux as a primary OS? And subject themselves to mac keyboards to boot.

Save the 2015-2019 MBP keyboard debacle, Apple's keyboards are among the best on the market.

As for how many people run Linux on bare metal on the Mac. That's hard to guess. Likely not a ton. But then... not a ton of anyone runs Linux as their primary desktop/ laptop so that's not surprising.


>And subject themselves to mac keyboards to boot.

The "fiasco keyboard" period aside (which is now 1.5+ years over, and which reliability aside, some do prefer its feel), Mac keyboards have been quite fine.

But one famous person that used to buy Macbooks to run Linux as a primary one (and used an Air as his daily driver for years) was a certain Linus Torvalds.

(Previously he also used an Apple G5 tower for his main desktop).


If the direction is closed hardware, soon we don't have any hardware to run Linux. And I, for one, prefer an open operating system always over a proprietary one. I'm a hacker and I want hacker's OS. I'd be interested about Apple's hardware, but their software support for other than their own is abysmal. The work done here is worth of praise, even if it means reverse-engineering the hardware.

Linus Torvalds worked on a MacBook Air for years.


I wish Apple released butterfly keyboards for desktop. I'd totally use one for my PC, even if it has a Mac layout.

Do you mean the very short travel, clicky ones (like a 2018 or 2019 MacBook)? If so the current magic keyboards have the same keys and you should buy one now because they will probably be updated soon. If you prefer the longer travel ones (like a 2015 MacBook or 2020 M1 MacBook) you have to find an older used one or wait a bit.

I have a 10 year old Bluetooth magic keyboard and a 10 year old USB magic keyboard and both work perfectly with windows.

Be warned, they are difficult to Bluetooth pair with windows for the first time, usually takes 10 tries for me.


Apple's hardware quality is the way it is because they control the software and hardware. Looking System76 I can see why people would want a Mac. Purism looks as decent as an XPS.

You also pay a hefty premium for MacOS if you are just running Linux.


That is not really the case in any meaningful way. I mean until just now they did not control the cpu or gpu on their laptops and desktops.

Well, I think it's fair to say that "among the Unix-derived OSes, macOS is the one with the best hardware support for the hardware it typically runs on." I've wasted months of my life futzing with Broadcom WLAN cards...

> You also pay a hefty premium for MacOS if you are just running Linux.

You can’t run Linux on the M1 yet, but will this still true when you can? How does price / performance of the M1 air compare to x86 laptops? (Or the Mac mini vs other small form factor PCs?)


Apple deprecates support for old Macs in new macOS releases after about 6 to 7 years, and Linux support on Macs released before 2016 is really good.

There are features that are unique to Linux, like cgroups and KVM, that are nice to use on my main OS. The kernel itself is incredibly configurable and extensible, whereas on macOS the kernel is locked away and Apple has deprecated foreign kext support.

Another example is Linux's native FUSE support. I can use an updated version of sshfs on Linux that isn't available on macOS and solves problems I had with sshfs on macOS. I have to use closed source software to even use FUSE on macOS.

Using Linux on a VM or over SSH to do things I couldn't do on macOS was frustrating, and it's a breath of fresh air to run Linux natively.

Also, I prefer Plasma Desktop to the macOS desktop shell. KWin is scriptable, and KDE is really nice.

> Apple's touch pad experience in MacOS is the best in the market and it is always very different in Windows and Linux.

I disagree with this. Libinput is configurable and its adaptive acceleration profile feels more natural to me.


Right now the draw is the M1 CPU...

If Linux had software support for it, it would probably be the best platform for Linux (server) software development.


> Can someone explain why they would buy a Mac and install linux?

Same reason you run Linux on a Dell or Other laptop. Because you prefer Linux. In Apple's case, the M1 is particularly appealing right now.

For me personally, this project is mostly interesting as insurance for if/ when Apple ships a version of MacOS I don't care for or stops supporting the M1. That's likely... 10 years out, but you never know.


Apple deprecates support for old Macs in new macOS releases after 6 to 7 years. In some cases it's even sooner, like with the Macs that were left behind in the jump from 32-bit to 64-bit Intel processors.

Apple has been increasing the length of support for devices over the past 10 years though. Many years they don't drop support for any Macs.

That said... it would be fantastic to have Linux as a backup.


For "why not macOS on M1," I'm one of those people who customizes their WM to reduce number of keystrokes / mouse usage to a minimum, and that's only really well-served by the free operating systems' WMs.

For "why not Linux on not-M1," I vastly prefer reading and writing AArch64 assembly to amd64... And the battery-life+performance claims of M1 are certainly extremely exciting, coming from a Pinebook Pro (which has the battery life, but pretty wimpy performance by comparison).


One niche iuse is that it lets you legally run macOS in a VM under Linux, I think. Which you might want to do if you have some stuff that only works under macOS, like iPhone app builds, but you otherwise need or prefer Linux. But they're often all around ok machines for general use too if you're not too price conscious and/or your employer just hands them out to everyone.

I would very much like the Mac hardware, but I do not like the Mac operating system, or the trend of making it harder and harder to install apps from the store.

Personally I think Apple's new hardware looks good (both inside and outside) but their software doesn't really impress me. I would rather run standard Linux software like I usually do. I certainly won't buy any Apple hardware until that is a viable option. I'm also not interested in running my daily driver OS as a VM client.

The result may be the fastest Linux machine available (by some metrics).

Single core performance, maybe. Not much else though. But the apple's do quite well on perf/$, perf/watt. The M1 mini is pretty competitive at $700 for a fast silent desktop.

You mentioned performance/watt - in user terms, battery life is a huge advantage of this hardware. The official specs of the 13" MBP are 17 hours of web browsing, 20 hours of video playback.

I assume it won't be as long in Linux but it'll still be longer than a lightweight and high performance x86 laptop.


> Can someone explain why they would buy a Mac and install linux?

Because OSX, besides being a user prison, is certainly far from being as good as their hardware.


Can we stop the "user prison" stuff?

I've got an iMac 2020 here, I log into iTerm2 and macports has every things I want, installed cleanly and co-operatively with the Apple frameworks and kernel.

I'm running Firefox and Thunderbird and Office 365, all native. I also have suppler supported clients for iMessage, Whatsapp, Telegram, Skype, Spotify (whether Electron or not).

I have developer utilities like Dash, which is one of the best documentation browsers ever, I have native UI neovim with VimR, I have menu bar utilities for monitoring, cloud sync with Google and Microsoft (and iCloud if I wanted).

How exactly am I in a user prison? I'm running the Beta Big Sur and the only bug so far is that the Karabiner kext doesn't load.


Have you tried the version that uses a system extension rather than a kext?

Still leagues better than Linux.

I have to agree. I’ve tried to be a desktop Linux user for 20 years unsuccessfully. It only ever gets to 80% done and then they go and break everything. At least Apple get to 95% :)

Quite some prison that allows you to install linux and whatever other software you'd like.

Really? Because my Mac by default nags the crap out of anything downloaded, and does this best to block applications that haven't paid various Apple Taxes.

I don’t have that experience.

How can you not? Unless you sign your app with your Dev cert, that you pay Apple for, Apple won't let your app run without going under the hood and fuck around with permissions.

Fact check: false.

https://www.wikihow.com/Install-Software-from-Unsigned-Devel...

Nope. fact check true. Unsigned software will not run on a Mac without having to jump through hoops to enable each app.

I predominantly use open source software, and a lot is not signed.


So do I, and I never have to sign any of it or jump through hoops.

I wonder how much time is left before Apple locks down macOS so hard that this type of analysis becomes impossible without a jailbreak. :/

Based on some similarities between this idea and a certain strand of thinking in nuclear engineering, I believe MacOS will be locked down at around the same time as fusion power becomes commercially viable, i. e. twenty years from now.

It's been Real Soon Now for at least 10 years...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: