       float* so = out + j * cols;
 
       extern __shared__ float _share[];
-      float* _max = _share + blockDim.x;
+      float* _max = _share;
 
       _max[threadIdx.x] = sp[threadIdx.x];
       for(int tid = 1; tid < cols; tid += blockDim.x) {

      const float* stateRow = state + ((j / (b * t)) * b + j % b) * cols;

      extern __shared__ float _share[];
      float* _sum = _share + blockDim.x;

      _sum[threadIdx.x] = 0.0;
      for(int tid = 0; tid < cols; tid += blockDim.x) {

      const float* sp = in + j * cols;

      extern __shared__ float _share[];
      float* _max = _share;

      _max[threadIdx.x] = sp[threadIdx.x];
      for(int tid = 1; tid < cols; tid += blockDim.x) {
