                                                            stride_y, 
                                                            table_data, 
                                                            fanin);
-    else if ((nKernelCols == 5) && (nKernelRows == 5))
-      conv2mapgeneric <false, 5, 5> <<<blocks, threads>>> (input_data, 
+  else if ((nKernelCols == 13) && (nKernelRows == 13))
+    conv2mapgeneric <false, 13, 13> <<<blocks, threads>>> (input_data, 
+                                                           kernel_data, 
+                                                           output_data,
+                                                           nInputPlane, 
+                                                           nInputRows, 
+                                                           nInputCols,
+                                                           nOutputPlane*fanin, 
+                                                           nKernelRows, nKernelCols,
+                                                           stride_x, 
+                                                           stride_y, 
+                                                           table_data, 
+                                                           fanin);
+  else if ((nKernelCols == 2) && (nKernelRows == 2))
+    conv2mapgeneric <false, 2, 2> <<<blocks, threads>>> (input_data, 
+                                                         kernel_data, 
+                                                         output_data,
+                                                         nInputPlane, 
+                                                         nInputRows, 
+                                                         nInputCols,
+                                                         nOutputPlane*fanin, 
+                                                         nKernelRows, 
+                                                         nKernelCols,
+                                                         stride_x, 
+                                                         stride_y, 
+                                                         table_data, 
+                                                         fanin);
+  else if ((nKernelCols == 4) && (nKernelRows == 4))
+    conv2mapgeneric <false, 4, 4> <<<blocks, threads>>> (input_data, 
+                                                         kernel_data, 
+                                                         output_data,
+                                                         nInputPlane, 
+                                                         nInputRows, 
+                                                         nInputCols,
+                                                         nOutputPlane*fanin, 
+                                                         nKernelRows, 
+                                                         nKernelCols,
+                                                         stride_x, 
+                                                         stride_y, 
+                                                         table_data, 
+                                                         fanin);
+  else if ((nKernelCols == 6) && (nKernelRows == 6))
+    conv2mapgeneric <false, 6, 6> <<<blocks, threads>>> (input_data, 
+                                                         kernel_data, 
+                                                         output_data,
+                                                         nInputPlane, 
+                                                         nInputRows, 
+                                                         nInputCols,
+                                                         nOutputPlane*fanin, 
+                                                         nKernelRows, 
+                                                         nKernelCols,
+                                                         stride_x, 
+                                                         stride_y, 
+                                                         table_data, 
+                                                         fanin);
+  else if ((nKernelCols == 8) && (nKernelRows == 8))
+    conv2mapgeneric <false, 8, 8> <<<blocks, threads>>> (input_data, 
+                                                         kernel_data, 
+                                                         output_data,
+                                                         nInputPlane, 
+                                                         nInputRows, 
+                                                         nInputCols,
+                                                         nOutputPlane*fanin, 
+                                                         nKernelRows, 
+                                                         nKernelCols,
+                                                         stride_x, 
+                                                         stride_y, 
+                                                         table_data, 
+                                                         fanin);
+  else if ((nKernelCols == 10) && (nKernelRows == 10))
+    conv2mapgeneric <false, 10, 10> <<<blocks, threads>>> (input_data, 
                                                            kernel_data, 
                                                            output_data,
                                                            nInputPlane, 

                                                           stride_y, 
                                                           table_data, 
                                                           fanin);
    else if ((nKernelCols == 7) && (nKernelRows == 7))
      conv2mapgeneric <false, 7, 7> <<<blocks, threads>>> (input_data, 
                                                           kernel_data, 
                                                           output_data,
                                                           nInputPlane, 

        }
      }
    }

  } else { // not enough shared mem for kernels, simply stream them

    // convolution loop
    for(oo = oo_start; oo < oo_end; oo++) {
      for (ii = table_start; ii < table_end; ii = ii + 2) {
        for(yy = yy_start; yy < yy_end; yy+=yy_step) {
          for(xx = xx_start; xx < xx_end; xx+=xx_step) {
            // Dot product in two dimensions... (between input image and the mask)
            float *input_p = input + ((long)table[ii]-1)*input_h*input_w 
              + yy*stride_h*input_w + xx*stride_w;
            float *output_p = output + oo*output_h*output_w + yy*output_w + xx;
            float *kernel_p = kernel + ((long)table[ii + 1]-1) *kernel_w*kernel_h + koffset;
            float sum = 0;
            if (swapkernel) {
              for(ky = 0; ky < kernel_h; ky++) {
#pragma unroll 5
                for(kx = 0; kx < kernel_w; kx++) {
                  sum += input_p[kx]*(*kernel_p--);
                }
                input_p += input_w;
              }
            } else {
              for(ky = 0; ky < kernel_h; ky++) {
#pragma unroll 5
                for(kx = 0; kx < kernel_w; kx++) {
                  sum += input_p[kx]*(*kernel_p++);
                }
                input_p += input_w;
              }
            }
            *output_p += sum;
          }
        }
      }
    }
  }
}


/*
