1 Reply Latest reply on Aug 20, 2010 10:11 AM by Kevin Goldsmith



      I am using Pixel Bender in an AIR 2.1 application developed in Flash Builder 4.


      1. When creating 4 Shaders, do the ShaderJobs for each of them run on a seperate CPU core if the given system has 4 or more cores?


      2. Will 4 Shaders executing at the same time perform slower on a 2 core system than a 2 Shader setup?


      3. Can I determine the amount of threads available to my AIR application?





        • 1. Re: Multithreading
          Kevin Goldsmith Level 3

          The player uses a constant size thread pool (based on the number of cores) to distribute the work to. If you launch 4 asynchronous shader jobs in sequence, I'm pretty sure that the first job will use all cores, but the subsequent jobs may split the cores between them. It would be simple to verify the expected behaviour by launching a couple heavyweight kernels followed by a couple identity kernels. If the identity kernels finish before the heavyweight ones, then you know that they are splitting the cores. If the heavyweight ones finish first, then the jobs are being launched sequentially with each utilizing all cores.


          As far as performance goes, there is a lot more that is part of the calculation than # of shader jobs vs # of cores. The amount of data is critical since it determines how efficiently the threads work. The kernels themselves are significant. Are you combining 4 kernels into 2 and then running them? The best thing to do is to experiment with your kernels and AS to figure out the best performance for what you are trying to do.


          The number of threads available is 100% dependant on the number of cores. I believe that it is something like (# of cores)+1.