Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. We are looking for feedback on the naming of a new user research platform that we are working on.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Has the GPU Usage profiler for Android ever worked? (Vulkan)

Discussion in '2018.3 Beta' started by Prodigga, Oct 13, 2018.

  1. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    933
    I posted about the GPU Usage profiler being broken a while ago and since then haven't used it at all.

    Today I tried it again in the new beta and I can say that it no longer crashes like it used to when you start recording!

    The GPU Usage inspector shows the correct number of drawcalls, however there is no information about how long anything took at all. Everything just says 0ms. I enabled 'Frame Timing Stats' and it didn't work. The closest I've come to making it work is turning on Multithreaded Rendering, Rendering API to Vulkan and frame timing stats to true.

    That gives me...something.. I have a scene with a high vertex count cube that turns on and off. Here is what the GPU usage looks like:

    upload_2018-10-13_15-1-8.png

    Each spike is...around 1800ms. Which is incorrect. My scene doesn't run that slow, infact there is so much time left over that we perform VSync aswell (All that yellow in CPU Usage is VSync). Also, the spike is listed under 'other'. It doesn't actually provide any information.

    The breakdown looks correct. I see the correct number of drag calls and such..

    upload_2018-10-13_15-2-58.png

    But there is no time associated with any of it.

    When I sort by GPU ms the supposed 1807.05ms frame time cost doesn't even come up anywhere.

    upload_2018-10-13_15-4-17.png
     
  2. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    933
    Seems like the timing aspect of the profiler is completely busted
    upload_2018-10-13_15-18-29.png

    I just can't get anything reasonable from it no matter what I do.
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,312
    The "GPU Usage" tile contains an warning icon in the lower-right corner. Does it show a tooltip and what does it say?
     
  4. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    933
    Yep, it is just a warning stating that gathering timing statistics may impact performance.

    upload_2018-10-13_16-11-47.png
     
    Last edited: Oct 13, 2018
    Peter77 likes this.
  5. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    727
    Where do you turn on frame timing stats? I will try this on some devices, too, to see if it works anywhere.
     
  6. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    933
    Hey there

    Player stats, near where you turn on dynamic batching, multithreaded rendering, etc.

    My test device was a Pixel XL.
     
  7. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    933
  8. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    727
    I assume you mean Player Settings (that's where multithreaded rendering is) and I see no such option there:


    But I'm trying some dev builds on a few devices anyway...
     
    Last edited: Oct 25, 2018
  9. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    933
    Bump..
     
  10. strandborg

    strandborg

    Unity Technologies

    Joined:
    Dec 8, 2014
    Posts:
    32
    Hi,

    Yes, the GPU profiler is broken on Vulkan, mostly due to the fact Vulkan is designed.

    When the GPU profiler was implemented back in the day, it was based on the assumption that we could measure how long each draw call takes. This was and is a valid assumption on normal forward-rendering GPUs, such as desktop GPUs. However, on a tile-based GPU (as most mobiles are), the work required to perform single draw call gets spread out to wider time, typically over multiple frames, so asking how long a single draw call takes doesn't quite make sense there.

    As Vulkan API was designed to target both forward-rendering desktop GPUs and tile-based mobile GPUs, it sets some limitations on what you can do when you're "inside a renderpass", which means while you're rendering geometry and not switching rendertargets. In Vulkan, it is only possible to measure the time each renderpass takes, so what you're seeing is a result of that.

    There is very little we can do to fix that (other than disable GPU profiling on Vulkan completely) at least on the current GPU profiler design.
     
    Prodigga likes this.
  11. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    933
    Bummer .. so there is no way to profile shader performance on Android, then? When I use OpenGL3 the profiler says that GPU profiler is not supported, which is why I have been trying with Vulkan since thats the only way I can get the GPU profiler to show anything at all.

    We've been having a lot of issues profiling shaders. We can never get a clear read on how performant one version of a shader is to another. On iOS you can just capture the frame and xcode will tell you exactly how many Ms each drawcall took, but I don't have easy access to an iOS development environment not to mention that it still doesn't tell me exactly how well/badly my shaders are running on an Android device. (Some operation that is fast on Metal/Apple hardware might be slower on Android). There is just no way to know.
     
    Claytonious and Sylmerria like this.
  12. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    727
    @Prodigga , I still never found that option mentioned above. Would still be happy to try on a few more devices to see if any of them will work (so at least we could profile on *some* Android devices). (See my screenshot and message above).
     
  13. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    933
    ...hello? @strandborg

    @Claytonious I'm not sure my dude. I didn't do anything to make that option visible, it was just there. I am on the beta, though?
     
  14. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    2,302
    Fibonaccov and Feelnside like this.
  15. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    727
    This is a little difficult to use, though: you can profile GPU Clock Cycles for each draw call, from which you can back into figuring out which shader was involved in that draw call, but it's a *lot* work, and turning GPU Clock Cycles into time is not trivial at all. You can force the device into "non throttled" mode temporarily to make this a little easier, but it's still manual conversion.

    It would be FAR preferred to simply have Unity's time profiling for draw calls work on these devices.
     
    M_R and Prodigga like this.
unityunity