   Direct Compute Image Processing
  I am seeing examples where they hard code the [numthreads()] attribute in the compute shader.  But what if you are image processing a render target that is proportional to the window size.  Then you do not know the number of threads you will need to process.  So what do you do?   
  Those thread counts you specify there runs per thread-group. But how many groups to run - that you specify in ID3D11DeviceContext::Dispatch function.So you can simply put [numthreads(32,32,1)], and then dispatch ((width+31)/32, (height+31)/32, 1) groups.You can even specify [numthreads(1,1,1)], and then dispatch (width, height, 1) groups - but this will have worst performance.To get best performance, you should specify as high numthreads number as you can (x*y*z must be <= 1024) - up to total compute unit count in your card. So try various numbers (like 32,32,1 or 32,16,1 or 16,16,1) to see what gives you best performance.   ;  This is also something that I noticed - since the number of threads in the thread group is hard coded, it makes it difficult to have a general solution.  However, I think the rationality makes sense if you step back and think about it.  Since the shader must use its addressing scheme to determine where to load resources from, then it must be configured for a specific thread group size.  If the size were to be adjustable, then the shader could easily be used in an unintended resource size and mess everything up...This actually isn't a problem for resources which only make use of relative addresses, but if you use a global address (such as the dispatch thread ID) in some calculations then it could be tricky to make 100% generalized.   