   , int timesteps_x_channels
   , int img_dim
   ) {
-  for(int bl = 0; bl < baselines; bl++) {
-    // Always use (sorted) permutations vector
-    bl = permutations[bl].bl;
-    int gcf_dim = get_supp(permutations[bl].wp);
-    // No mirrored GCF yet
-    if (gcf_dim <= 16) {
-       degrid_kernel_small_gcf<over>
-         <<<timesteps_x_channels/32,dim3(32,32)>>>(
-             out_vis
-           , uvw+bl*timesteps_x_channels, timesteps_x_channels
-           , img+degridPadder<max_gcf_dim>::bare_offset(img_dim), img_dim
-           , gcf[permutations[bl].wp], gcf_dim
-           );
-    } else {
-       degrid_kernel<over>
-         <<<timesteps_x_channels/32,dim3(32,8)>>>(
-             out_vis
-           , uvw+bl*timesteps_x_channels, timesteps_x_channels
-           , img+degridPadder<max_gcf_dim>::bare_offset(img_dim), img_dim
-           , gcf[permutations[bl].wp], gcf_dim
-          );
-    }
-  }
-}
-
-// Test instantiation
-extern "C" void testtest(
+  int bl;
+  for(bl = 0; bl < baselines; bl++) {
+    if(get_supp(permutations[bl].wp) > 16) break;
+  }
+  dim3 griddims_small = dim3(timesteps_x_channels/32, bl);
+  degridGPU<max_gcf_dim, over, false><<<griddims_small, dim3(32,32)>>>(permutations, out_vis, uvw, gcf, img, timesteps_x_channels, img_dim, 0);
+  if (bl != baselines - 1) {
+    dim3 griddims_big = dim3(timesteps_x_channels/32, baselines - bl);
+    degridGPU<max_gcf_dim, over, true><<<griddims_big, dim3(32,8)>>>(permutations, out_vis, uvw, gcf, img, timesteps_x_channels, img_dim, bl);
+  }
+}
+
+extern "C" void test(
     const BlWMap permutations[/* baselines */]
   , complexd* out_vis
   // Padded, points to the beginning

  , int baselines
  , int timesteps_x_channels
  , int img_dim
){
  degridGPU<512, 8>(permutations, out_vis, uvw, gcf, img, baselines, timesteps_x_channels, img_dim);
}

#include "metrix.h"
#include "OskarBinReader.h"

template <int over, bool isbig> struct degridder {};

template <int over> struct degridder<over, true>{

static __device__ __inline__
//__launch_bounds__(256, 6)
// double2 is enough for 'in'
void degrid_kernel(complexd* out, const double3* in, size_t npts, const complexd* img, 
                              size_t img_dim, const complexd* gcf, int gcf_dim) {
   
   //TODO remove hard-coded 32
