Search Unity

Question Why occur frame drop when different size texture into worker.Exeucte?

Discussion in 'Barracuda' started by vlfkdydtk, Oct 12, 2021.

  1. vlfkdydtk

    vlfkdydtk

    Joined:
    Aug 7, 2020
    Posts:
    2
    I'm trying to use barracuda to translate style. when I use alway same size texture, alway can see same (or average) performance. but if I put an different size texture (like 512*512 -> 256*256), I can still see result no problem, but that time occur serious frame drop. (about under 10%) why occur frame drop when different size texture into worker.Exeucte?
     
  2. alexandreribard_unity

    alexandreribard_unity

    Unity Technologies

    Joined:
    Sep 18, 2019
    Posts:
    53
    Hello @vlfkdydtk yes, some performance drop when changing input sizes would be expected.

    There are a few things going on under the hood:
    * First off: when you change input, the intermediate layers will change size. So they require more memory.
    What we do is that during the first time the input changes, we re-allocate all of the model needed internal memory. So we don't need to allocate things during runtime, saving perf on successive runs.
    * Secondly, and I'm assuming you are using a ComputePrecompiled worker for this. Depending on your input size, we might select different optimal shaders, this might trigger some re-computations of different things. Imply a hiccup on the first frame.

    You could try using a Compute worker to avoid the potential pre-computations when your input changes to see if it helps

    Let me know
     
    vlfkdydtk likes this.
  3. vlfkdydtk

    vlfkdydtk

    Joined:
    Aug 7, 2020
    Posts:
    2
    yes. I have use a ComputePrecompiled worker. after change worker type to Compute, I can get a better performance when change texture size. but because still there's frame drop problem, I have to find out another way to increasing performane. anyway, thanks for your answer!
     
  4. alexandreribard_unity

    alexandreribard_unity

    Unity Technologies

    Joined:
    Sep 18, 2019
    Posts:
    53
    One way you could do is to have two workers. One for each input size, were you would do a dry run at the start of your application to cache and allocate everything correctly.