         boundB -= BLK_K;
         
         #pragma unroll
-        for (n = 0; n < BLK_K / DIM_YA; n++)
-            #pragma unroll
-            for (m = 0; m < BLK_M / DIM_XA; m++)
+        for (n = 0; n < BLK_K / DIM_YA; n++) {
+            #pragma unroll
+            for (m = 0; m < BLK_M / DIM_XA; m++) {
                 ra[n][m] = offs_dA[n * DIM_YA * M + m * DIM_XA];
-
-        #pragma unroll
-        for (n = 0; n < BLK_N / DIM_YB; n++)
-            #pragma unroll
-            for (m = 0; m < BLK_K / DIM_XB; m++)
+            }
+        }
+
+        #pragma unroll
+        for (n = 0; n < BLK_N / DIM_YB; n++) {
+            #pragma unroll
+            for (m = 0; m < BLK_K / DIM_XB; m++) {
                 rb[n][m] = offs_dB[n * DIM_YB * K + m * DIM_XB];
+            }
+        }
 
         // multiply
         #pragma unroll
         for (k = 0; k < BLK_K; k++)
         {
             #pragma unroll
-            for (m = 0; m < THR_M; m++)
+            for (m = 0; m < THR_M; m++) {
                 rA[m] = sA[k][m * DIM_X + idx];
+            }
             
             #pragma unroll
-            for (n = 0; n < THR_N; n++)
+            for (n = 0; n < THR_N; n++) {
                 rB[n] = sB[n * DIM_Y + idy][k];
+            }
 
             #pragma unroll
             for (n = 0; n < THR_N; n++) {

        // store A regs->smem
        #pragma unroll
        for (n = 0; n < BLK_K / DIM_YA; n++)
            #pragma unroll
            for (m = 0; m < BLK_M / DIM_XA; m++)
                sA[n * DIM_YA + idyA][m * DIM_XA + idxA] = ra[n][m];

        #pragma unroll
        for (n = 0; n < BLK_N / DIM_YB; n++)
            #pragma unroll
            for (m = 0; m < BLK_K / DIM_XB; m++)
                sB[n * DIM_YB + idyB][m * DIM_XB + idxB] = rb[n][m];
        __syncthreads();
    }


    for (k = 0; k < kk; k++)
    {
        #pragma unroll
        for (m = 0; m < THR_M; m++) {
            rA[m] = sA[k][m * DIM_X + idx];
        }

        #pragma unroll
        for (n = 0; n < THR_N; n++) {
            rB[n] = sB[n * DIM_Y + idy][k];
        }
        
        #pragma unroll
        for (n = 0; n < THR_N; n++) {
            #pragma unroll
            for (m = 0; m < THR_M; m++) {
                rC[n][m] += rA[m] * rB[n];
            }
        }
