 template <typename T>
 __global__ void axpy_kernel_flat(size_t n, T alpha, const T* x, T* y) {
     auto index  = threadIdx.x + blockIdx.x * blockDim.x;
-    const auto stride = blockDim.x * gridDim.x;
-
-    for (; index < n; index += stride) {
+
+    if (index < n) {
         y[index] += alpha * x[index];
     }
 }


    if (!blockSize) {
        cudaOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, axpy_kernel1<T>, 0, 0);
    }

    int gridSize = ((n / incy) + blockSize - 1) / blockSize;
    axpy_kernel1<T><<<gridSize, blockSize>>>(n, x, incx, y, incy);

#ifdef EGBLAS_SYNCHRONIZE


    if (!blockSize) {
        cudaOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, axpy_kernel0<T>, 0, 0);
        blockSize = blockSize > 256 ? 256 : blockSize;
    }

    const int gridSize = (n + blockSize - 1) / blockSize;

    axpy_kernel0<T><<<gridSize, blockSize>>>(n, y, incy);

#ifdef EGBLAS_SYNCHRONIZE
