           saxpy(1.0f, (trans == CBlasNoTrans) ? b[ll] : &b[ll][tj], x);
         else if (ti < l)
           saxpy((trans == CBlasNoTrans) ? A[0] : a[ti][ll], (trans == CBlasNoTrans) ? b[ll] : &b[ll][tj], x);
-        A += lda;
+        if (trans == CBlasNoTrans)
+          A += lda;
         l++;
       }
     }
+
+    __syncthreads();
   }
 
   // Process non-diagonal blocks as for SGEMM
-  int k = (uplo == CBlasUpper) ? m - bi - mb : bi;
+  int k = (trans == CBlasNoTrans) ? ((uplo == CBlasUpper) ? m - bi - mb : bi)
+                                  : ((uplo == CBlasUpper) ? bi : m - bi - mb);
   while (k > 0) {
     if (trans != CBlasNoTrans) {
 #pragma unroll

        for (int ll = 0; ll < kb; ll++) {
          if (ti <= l++)
            saxpy((trans == CBlasNoTrans) ? A[0] : a[ti][ll], (trans == CBlasNoTrans) ? b[ll] : &b[ll][tj], x);
          A += lda;
        }
      }
      else {


    if (k < kb) break;

    if (trans == CBlasNoTrans) {
#pragma unroll
      for (int l = 0; l < kb; l++) {
        saxpy(A[0], b[l], x);
        A += lda;
      }
    }
    else {
#pragma unroll
      for (int l = 0; l < kb; l++)
        saxpy(a[ti][l], &b[l][tj], x);
    }

    __syncthreads();
