title: Why Dispatches started consecutively take different time?
body: <p>I have this program :</p>
  
  <pre><code>        for (int i = 0; i &lt; STEPS; ++i)
          {
              context-&gt;CSSetShader(computeShader, NULL, 0);
  
              ID3D11UnorderedAccessView *aUAViews[1] = {bufferOut_UAV};
              context-&gt;CSSetUnorderedAccessViews(0, 1, aUAViews, NULL);
  
              context-&gt;Dispatch(32, 32, 1);
              in[i] = t.GetTime();
  
              if (i == STEPS / 2)
              {
  context-&gt;End(pEventQuery);
  while( context-&gt;GetData( pEventQuery, NULL, 0, 0 ) == S_FALSE ) {}
              }
          }
  
          double out = t.GetTime();
  
  context-&gt;End(pEventQuery);
  while( context-&gt;GetData( pEventQuery, NULL, 0, 0 ) == S_FALSE ) {}
  </code></pre>
  
  <p>First while iteration last only 26 ms, while second 46 ms?</p>
  
  <p>Just in case the shader:</p>
  
  <pre><code>RWStructuredBuffer&lt;float&gt; Output : register(u0);
  
  [numthreads(GROUP_SIZE_X, GROUP_SIZE_Y, 1)]
  void arrayTest(uint3 DTid : SV_DispatchThreadID)
  {
      float i = DTid.x * 32 + DTid.y;
      Output[i] = 0;
      for (int k = 0; k &lt; 100; ++k)
      {
          Output[i] += sqrt(i + k);
      }
  }
  </code></pre>
  
  <p>but i don't think it should take different time at every start.</p>
  
  <p><strong>interesting</strong> what if I comment out line ''if (i == STEPS / 2)'' both halves take nearly the same time.</p>
  
  <p>EDIT: as far as i can see for now, it is decause of cashing</p>