Apple GPU reverse engineering

By: Chester (lamchester.delete@this.gmail.com), February 14, 2021 2:26 pm
Room: Moderated Discussions
David Kanter (dkanter.delete@this.realworldtech.com) on February 14, 2021 10:50 am wrote:
> Someone has started doing some good RE work on Apple's GPUs, I thought I'd share it here:
>
> https://dougallj.github.io/applegpu/docs.html
>
>
> A few comments on things I find interesting:
>
> 1. Unusual control flow mechanism compared to other GPUs

How's it unusual? AMD GCN/RDNA also use execution masks to handle conditional execution and divergence. Looks like Apple requires an explicit jmp_exec_none instruction to skip a zero exec mask while GCN/RDNA do that in hardware, but the idea's pretty similar.

>
> 2. Register cache is interesting, I wonder how much is SW hinted or controlled?

Sounds like Nvidia's register reuse cache. From your link, Apple's is SW controlled with a "cache" hint to tell HW to save a register value for reuse, and a "discard" hint to invalidate a cache register value.

Nvidia also uses software hints in control flow information on Maxwell and newer GPUs to indicate when to cache a register value for reuse. They don't have a discard hint though.

> 3. Unsure if they have int8 support, I don't know if the author tested for it. I'd be
> a bit surprised by that though, since GPU shaders operating on 8b ints seem useful.

Could be the same as 16-bit support, since it can hit the low or high 16 bits of a 32-bit reg separately (like partial register addressing in x86).

I think INT8 is used mainly for machine learning stuff. Apple has a separate NPU you're supposed to use for that. I wouldn't be surprised if they skipped int8.

> Anyway, happy reading!
>
> David

< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
Apple GPU reverse engineeringDavid Kanter2021/02/14 10:50 AM
  Apple GPU reverse engineeringChester2021/02/14 02:26 PM
    Apple GPU reverse engineeringJeff S.2021/02/16 11:19 AM
      Apple GPU reverse engineeringK.K.2021/02/16 11:48 PM
        Apple GPU reverse engineeringPocak2021/02/17 06:54 AM
          Apple GPU reverse engineeringK.K.2021/02/18 12:40 AM
            Apple GPU reverse engineeringAnon2021/02/18 03:23 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell avocado?