Although Apple has been tight lipped about the internal details of M1 series custom processors, the Asahi Linux distribution development team, which creates open source drivers for M1 MAC hardware, is still trying to reverse engineer them It can be seen that during the hard reverse work, they also found some quite strange and cool places. Taking the M1 open source graphics driver as an example, Alyssa Rosenzweig recently found a key point to resolve errors in the M1 GPU rendering pipeline.
It is reported that the problem begins with the poor memory access of GPU. As a GPU with super performance, it is similar to iPhone Like the A-Series mobile SOC on, we need to take some shortcuts to maintain high efficiency.
It can be seen that compared with the single display, M1 does not directly render to the frame buffer, but passes the frame twice - first find the vertex, and then deal with other more intensive transactions.
To this end, apple uses special hardware to divide the frame into small blocks (basically mini frames) and take one small block at a time for processing during the second pass.
The tiling scheme solves the problem of insufficient cache resources, but in order to make it into a complete frame later, the GPU needs to keep the buffer of each vertex data.
As a result, Rosenzweig found that whenever this buffer overflowed, rendering could not proceed normally.
Apple explained in a presentation that when the buffer is full, the GPU will only output part of the rendering (in this case, half a rabbit).
In first-party applications, apple calls it a parameter buffer, and the term seems to be taken from the powervr document of imaging.
As a UK based chip design company similar to arm, imagination signed an extensive intellectual property license agreement with apple in early 2020.
The M1 customized SOC listed in the second half of 2020 takes the company's powervr GPU architecture as the basis of its graphics hardware.
To get back to business, as you may have guessed, the software can complete the rendering of the whole rabbit by superimposing the rendering of various parts together (of course, there are more than a dozen additional steps in the middle).
Unfortunately, this rendering method is still not very accurate (pay close attention to the rabbit's feet). Rosenzweig points out that this is because different parts of the frame are divided between color / depth buffers, which have abnormal behavior when loading partial rendering.
The good news is that thanks to the reverse engineering reference configuration of Apple driver, the Asahi Linux development team finally solved this problem, and the final rendered output rabbit is shown in the figure.
TechSpot In conclusion, Rosenzweig's M1 open source graphics driver not only skipped the relevant links to render images, but the GPU did not consider such 3D rendering application scenarios at the beginning of architecture design.
Even so, Apple has cleverly made powervr graphics IP a software and hardware solution comparable to the unique display. Even if it has not achieved complete transcendence in many aspects, its performance is still quite cool.
Finally, for an in-depth understanding of M1 GPU rendering and other exploration of M1 reverse engineering, please move to Rosenzweig's personal technology blog And Asahi Linux distribution website View.