antiagainst / antiagainst.github.io

Generated website for my personal blog
https://lei.chat/
6 stars 0 forks source link

Sampling Performance Counters from Mobile GPU Drivers | Lei.Chat() #6

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Sampling Performance Counters from Mobile GPU Drivers | Lei.Chat()

Hardware performance counter details in Adreno/Mali kernel mode drivers and how to query them from user mode application

https://www.lei.chat/posts/sampling-performance-counters-from-gpu-drivers/

antiagainst commented 3 years ago

Hello there, Thanks for reading! If you'd like to leave a comment, you can do it directly here (which will require authorizing utterances), or you can directly comment on the backing GitHub issue.

Kleptine commented 3 years ago

Is there a way to follow along with this project? It's something I'm definitely interested in, and would love to try it out when you have something functional!

antiagainst commented 3 years ago

Hey @Kleptine, thanks for the interest! I'm glad that you think this might be useful to you. I haven't released it yet, but the fundamental work is done. It right now supports querying arbitrary counters from both Adreno and Mali GPUs. I haven't come to the point to have a set of unified counters that can map to either Adreno/Mali right now. That can be worked on later. I'll clean it up and release it soon so that you can take a look then. :)

Kleptine commented 3 years ago

Wonderful, thanks!

anilWu commented 2 years ago

I looked up a lot of information and finally found a useful article。 thanks!

reubenscratton commented 2 years ago

Hiya, just a heads-up that Android 13 kills the ability for ordinary Android apps to read GPU counters. You now need shell to do it, at least for Adreno but I imagine Mali etc will follow suit if they haven't already. See this kernel commit for details: https://android.googlesource.com/kernel/msm/+/574550760fec9ce098b5b80e996715763231b8cb%5E%21/

antiagainst commented 2 years ago

@Kleptine: Sorry about the delay (both for releasing and notification). But finally here it is: https://github.com/google/hardware-perfcounter. Right now only provides low-level counter access so half baked; I'm hoping to find sometime later to build up some nicer higher level APIs.

antiagainst commented 2 years ago

Hiya, just a heads-up that Android 13 kills the ability for ordinary Android apps to read GPU counters. You now need shell to do it, at least for Adreno but I imagine Mali etc will follow suit if they haven't already. See this kernel commit for details: https://android.googlesource.com/kernel/msm/+/574550760fec9ce098b5b80e996715763231b8cb%5E%21/

@reubenscratton: Ah! Thanks for the heads up! I didn't know about that..

I guess it makes sense to have such changes for security/privacy purposes, but it would make it hard for normal apps to have embedded counter reading functionalities. Though I guess if you have a rooted phone then there is still a way to proceed as always. I'd assume we typically want this reading for development, so maybe it's still fine.

For my immediate use case (Vulkan compute for ML) we are developing a library that our daily workflow involves running binaries under adb shell. Typically adb environment receives special treatments too.

Kleptine commented 2 years ago

This looks great, thanks! Its a pity they're turning this off. I suppose I can see the security risks, but it's a bit of a pain to root all of our development phones and add the extra setup. :\

zgamedog commented 1 year ago

I follow your repo readme , when build-android on Windows 10, it came up : "fatal error: sys/ioctl.h: No such file or directory" , could you tell me how to go on? Very New to this. Thanks .

antiagainst commented 1 year ago

I follow your repo readme , when build-android on Windows 10, it came up : "fatal error: sys/ioctl.h: No such file or directory" , could you tell me how to go on? Very New to this. Thanks .

Let's discuss issues specific to the hardware-perfcounter project in its own repo.