33 ms·
Dissecting the Apple M1 GPU, Part II
- captain_price7 6y agoI know enough about GPU to know how interesting this is, but not enough to fully get it. I wish there were some "Dissecting the Apple M1 GPU for Dummies".
- war1025 6y agoI imagine the "for graphics engineers" version has to get figured out before they can do the "for Dummies" version.
- supernova87a 6y ago[*Sure I get it, it's not interesting to talk meta about whether a post is interesting. I'm already downvoted off the planet. Fine.] I'm sure it's a good blog post for the right reader, but for something to land on HN front page, I generally look for either: 1) a story that, while specialized, reveals something accessibly technical and interesting to a semi-expert crowd, or 2) explains something at a sufficient level of expertise/detail that people not in the middle of it can grasp and apply to their own knowledge. This story seems not accessible to the general reader. Or it reads like someone's private notes. I think it needs a level of abstraction or summary to be accessible to the readership here.
- epistasis 6y agoI've never worked on GPUs, will likely never work on drivers even, yet was able to follow along and find it interesting. I'm going to upvote pretty much any reverse engineering monologue, especially one as accessible as this.
- NikolaeVarius 6y agoThen hide it and don't read it
- cbozeman 6y agoYeah, well, you know, that's just like... your opinion, man.
- faitswulff 6y ago...well, this is Hacker News, after all.
- perardi 6y agoYou’re complaining this is too technical…on a site called “Hacker News”…which is run by a firm named after an abstract mathematical concept. OK, kiddo. Upworthy is over that-away.
- jandrese 6y agoAre you saying this post is too nerdy for Hacker News? Stories come all the time, if you don't like it don't read it. I didn't understand everything the author said, but I was able to get the gist of it. There GPU has a list of valid addresses and it's stored in a C style array with a terminator instead of a 1 indexed array with an object count in the Apple API style. The mismatch caused the author some confusion even after he discovered the existence of the buffer due to his code failing. It's one of the many details that has to be understood in order to write an open source driver for the hardware. The open source driver will be necessary for people who want to install Linux on this Apple hardware.
- rowanG077 6y agoAmazing!! This is progresssing literally 10 times faster then I expected.
- Someone 6y agoIndeed. That single triangle likely is way closer to a million triangles than to zero triangles. https://rampantgames.com/blog/?p=7745 https://rampantgames.com/blog/?p=7745: “Afterwards, we came to refer to certain types of accomplishments as “black triangles.” These are important accomplishments that take a lot of effort to achieve, but upon completion you don’t have much to show for it only that more work can now proceed. It takes someone who really knows the guts of what you are doing to appreciate a black triangle.”
- jdashg 6y agoRoughly equidistant milestones for ports: 1. It crashes 2. Black screen 3. Any drawing at all 4. The rest of the friggin' engine
- gpderetta 6y agoI remember when the DXVK prototype was reported to beable to render a single triangle. Cool, but far away from completion. A few months later it was running Witcher3.
- cambalache 6y agoOK I love this, but I am pretty sure my chances of getting a mac in the future are zero. From which side should I expect the PC response? Intel? AMD? Microsoft? ARM? Samsung? I think Apple willingly or not has just obliterated the whole consumer pc market.
- flatiron 6y agoThe new Ryzen mobile processors should be interesting. Their GPU drivers (while not of the best code quality) are in the mainline Linux kernel. So it all should just “work”
- gnarbarian 6y agoCurrently using a Renoir laptop. It's smoking fast but I had to install a bleeding edge kernel to get the display driver to work at all. That should be fixed in the next ubuntu release though.
- threentaway 6y agoWeird, I had no issues with the built in display on Ubuntu 20.04, but I had to update the kernel to 5.8 to get display out over USB-C to work. Now that Ubuntu 20.10 is out and uses 5.8, I'm just using that so I don't have to mess with custom, unsigned kernels.
- pedrocr 6y agoI just installed 20.04.1 on a 4750U Lenovo T14s and everything just works as far as I can tell.
- imhoguy 6y ago5.10.x kernels are very stable and feature complete with AMD Ryzen Renoir - I update one almost weekly once new patch version is out on Ubuntu Kernel PPA. Here is nice script which makes the update trivial: https://github.com/pimlie/ubuntu-mainline-kernel.sh https://github.com/pimlie/ubuntu-mainline-kernel.sh
- __mp 6y agoThe published code on Github looks very nice! It is easy to read and understand. Kudos to Alyssa!
- ogre_codes 6y agoWhile this is a long way from being a proper graphics driver, it is a good indication that we're going to see a functional driver for Linux before too long. I was concerned this bit would take years to work out, this suggests it'll be months to get a working driver. Chuffed.
- wg0 6y agoThis might be a stupid question but if someone wants to start with some basic GPU to get an an understanding of how these things work, what that GPU would be that's wide spread, not that archaic?
- astrange 6y agoAnything that supports shaders is fine, but M1 is a mobile-style GPU so it doesn’t behave exactly like a desktop GPU.
- remexre 6y agoIntel's GPUs are fairly well-documented at https://01.org/linuxgraphics/documentation/hardware-specification-prms https://01.org/linuxgraphics/documentation/hardware-specific... IMO, writing some Vulkan (it being a thin layer over what a modern GPU's "actually" doing) would be good to get fundamentals down first, not the least of which because you'll have the validation layers to yell at you for incorrect usage instead of getting mysterious GPU behavior.
- Jhsto 6y agoThis blog series is quite good: https://hoj-senna.github.io/ashen-aetna/ https://hoj-senna.github.io/ashen-aetna/
- varispeed 6y agoSo Apple strategy seems to be to commit as little resources as possible to their products knowing that "open source" developers will do their work for free thus Apple will not have to pay extra salaries and taxes? I don't understand why people bother working for free to e.g. run Linux or even write a GPU driver? I get this is a nice developer challenge, and being involved with Apple stuff is still being seen as "cool", but why don't those developers actually support some truly open source projects instead of helping filthy rich company for nothing?
- tenebrisalietum 6y agoMaybe because ... those developers want to use Linux on hardware they bought and own instead of the built-in operating system? The developers are helping themselves, not Apple. Apple could save some money by selling bare metal M1's without an OS installed, but then it might get into the hands of people who want a "cheaper Mac but your hacker friend can get it working" and it would damage their brand, so I see why they don't do it.
- varispeed 6y agoWell, is this M1 really _that_ good to commit considerable amount of time into it instead of working on something more meaningful or benefitting ones personal life more? Are they able to make a commercial product out of it? Unless it gives the person the same kick as fishing or building Lego - but these hobbies don't have a side effect of filling the pockets of a big co. The idea about "cheaper Mac" is weak, because you can already buy a cheap Mac - it's not going to be the latest gen, but let's take into account that Intel has not made big progress in the last couple of years and then M1 is actually on the affordable side. Isn't actually more damaging to their brand that they don't support their products that will benefit professional users and that they rely on people doing work for free and thus Apple is avoiding paying fair share?
- tenebrisalietum 6y ago> Well, is this M1 really _that_ good to commit considerable amount of time into it instead of working on something more meaningful or benefitting ones personal life more? M1 is an ARM chip that's up there with Intel desktop PCs. That's awesome. It's possibly the real beginning of the end of the effective Wintel monopoly on personal computing and if we are going to continue to have Linux on hardware that's not locked-down phones it needs to happen. I'd certainly put my effort there if I had the skill. > Isn't actually more damaging to their brand that they don't support their products that will benefit professional users and that they rely on people doing work for free and thus Apple is avoiding paying fair share? Apple has $100 billion in cash. Whatever they are doing now, is working.
- gjsman-1000 6y agoEveryone, remember that in 2019 Alyssa was in _High School_. Where do people get this knowledge? It's astounding. She was literally reverse-engineering Mali for Panfrost starting in her Sophomore year.
- chucky_z 6y agoWhere did you get your knowledge? With places like HackerNews along with folks like yourself and myself writing posts about this kind of stuff it becomes trivial to walk down a rabbit hole for anyone of any age. Think back to how much you accomplished when you were younger because you were walking in the footsteps of others. :)
- noizejoy 6y ago> anyone of any age and intelligence and education and intellectual curiosity and non-working time and energy/stamina ... That Venn diagram ends up with a pretty small number of humans ...
- noch 6y ago> With [...] folks like yourself and myself writing posts about this kind of stuff Please could you link to some of the reverse engineering writing by you guys to which you're referring?
- war1025 6y agoA magical thing about high school / college that people fail to appreciate is how few actual responsibilities you have at that age. It's why kids are able to devote so many hours to video games and other time waster stuff. Only difference is this person managed due to luck / skill / timing to end up on a more productive path. Time commitment is the big impediment for most open-source projects. Late adolescence / young adulthood is one of the few periods of life where you both are competent enough to do useful things and have enough free time to actually commit to that work.
- pjmlp 6y agoAt the age of 10 I was coding for the Timex 2068, using books like these ones, https://www.atariarchives.org/ https://www.atariarchives.org/ Yes, they are for the Atari, just trying to make a point here. So any smart kid in the age of Internet, instead of having what is available at the local library, is quite capable to build up the skills to achieve this kind of work at the high school level.
- deleted 6y ago[deleted]
- chrisbrandow 6y agoquestion from ignorance - Why not use Metal? Is that too embedded in the macOS system to be useful for something like Linux? Or is this for the sake of understanding the bare metal?
- lunixbochs 6y agoIf you used metal as the graphics api on Linux, literally no existing Linux software would work with it unless you also used a layer like MoltenGL or MoltenVK (which have been written for a Mac system and would likely need modification). Linux graphics drivers also tend to have extra APIs for buffer management for X11/Wayland, which a molten compat layer probably doesn't do as molten is meant to run in-process with each app I believe. Some of the Metal APIs are also a little intertwined with swift and objc.
- chrisbrandow 6y agoof course. thanks!
- pantalaimon 6y agoThe goal is to write a driver for Linux, this is from scratch.
- randyrand 6y agothe metal driver would not work on linux. It was written for OSX. It's also closed source.
- fulafel 6y agoThere are no Metal implementations to use outside of Apple's proprietary software. But even if you had one, it would be useless on Linux for the existing software stack.
- person_of_color 6y agoWow, child prodigy found
- deleted 6y ago[deleted]
- AdamSignups 6y agoWow, this is impressive. Would like to be updated on this.
- avipars 6y agoPart I https://rosenzweig.io/blog/asahi-gpu-part-1.html https://rosenzweig.io/blog/asahi-gpu-part-1.html
- neycoda 6y agoIf she gets hired by Apple, I hope they don't ruin her too fast.
- Topgamer7 6y agoRead her other blog posts. She's super open source/libre software oriented. I find it a hard sell she would consider working for Apple. My guess would be she bought the Mac specifically to tackle this project.