```python
import torch
import torch.nn as nn
from torch.utils.cpp_extension import load_inline


_cpp_source = r"""
#include <torch/extension.h>

torch::Tensor split_gemv_cuda(torch::Tensor A, torch::Tensor B);
"""

_cuda_source = r"""
#include <torch/extension.h>
#include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDAGuard.h>
#include <c10/cuda/CUDAException.h>
#include <cuda_runtime.h>

constexpr int THREADS = 256;
constexpr int CHUNK = 16384;

__device__ __forceinline__ float warp_sum(float value) {
    #pragma unroll
    for (int offset = 16; offset > 0; offset >>= 1) {
        value += __shfl_down_sync(0xffffffff, value, offset);
    }
    return value;
}

__global__ __launch_bounds__(THREADS)
void partial_gemv_kernel(
    const float* __restrict__ A,
    const float* __restrict__ B,
    float* __restrict__ partial,
    int64_t K,
    int splits
) {
    const int64_t row = static_cast<int64_t>(blockIdx.x) / splits;
    const int split = blockIdx.x % splits;
    const int tid = threadIdx.x;
    const int64_t start = static_cast<int64_t>(split) * CHUNK;

    const float4* a4 = reinterpret_cast<const float4*>(A + row * K);
    const float4* b4 = reinterpret_cast<const float4*>(B);

    float s0 = 0.0f;
    float s1 = 0.0f;
    float s2 = 0.0f;
    float s3 = 0.0f;

    #pragma unroll
    for (int i = 0; i < CHUNK / (THREADS * 4); ++i) {
        const int64_t k = start + 4LL * (tid + i * THREADS);
        if (k < K) {
            const float4 a = a4[k / 4];
            const float4 b = b4[k / 4];
            s0 = fmaf(a.x, b.x, s0);
            s1 = fmaf(a.y, b.y, s1);
            s2 = fmaf(a.z, b.z, s2);
            s3 = fmaf(a.w, b.w, s3);
        }
    }

    float sum = warp_sum((s0 + s1) + (s2 + s3));

    __shared__ float warp_sums[THREADS / 32];
    const int lane = tid & 31;
    const int warp = tid >> 5;

    if (lane == 0) {
        warp_sums[warp] = sum;
    }
    __syncthreads();

    if (warp == 0) {
        sum = lane < THREADS / 32 ? warp_sums[lane] : 0.0f;
        sum = warp_sum(sum);
        if (lane == 0) {
            partial[row * splits + split] = sum;
        }
    }
}

__global__ void finish_gemv_kernel(
    const float* __restrict__ partial,
    float* __restrict__ output,
    int64_t M,
    int splits
) {
    const int lane = threadIdx.x & 31;
    const int warp = threadIdx.x >> 5;
    const int64_t row =
        static_cast<int64_t>(blockIdx.x) * (THREADS / 32) + warp;

    if (row >= M) {
        return;
    }

    float sum = 0.0f;
    for (int split = lane; split < splits; split += 32) {
        sum += partial[row * splits + split];
    }

    sum = warp_sum(sum);
    if (lane == 0) {
        output[row] = sum;
    }
}

torch::Tensor split_gemv_cuda(torch::Tensor A, torch::Tensor B) {
    const c10::cuda::CUDAGuard device_guard(A.device());

    const int64_t M = A.size(0);
    const int64_t K = A.size(1);
    const int splits = static_cast<int>((K + CHUNK - 1) / CHUNK);

    auto partial = torch::empty({M, splits}, A.options());
    auto output = torch::empty({M, 1}, A.options());

    cudaStream_t stream = at::cuda::getCurrentCUDAStream();

    partial_gemv_kernel<<<
        static_cast<unsigned int>(M * splits), THREADS, 0, stream
    >>>(
        A.data_ptr<float>(),
        B.data_ptr<float>(),
        partial.data_ptr<float>(),
        K,
        splits
    );
    C10_CUDA_KERNEL_LAUNCH_CHECK();

    finish_gemv_kernel<<<
        static_cast<unsigned int>((M + 7) / 8), THREADS, 0, stream
    >>>(
        partial.data_ptr<float>(),
        output.data_ptr<float>(),
        M,
        splits
    );
    C10_CUDA_KERNEL_LAUNCH_CHECK();

    return output;
}
"""

_gemv = load_inline(
    name="split_gemv_vec4_cuda",
    cpp_sources=_cpp_source,
    cuda_sources=_cuda_source,
    functions=["split_gemv_cuda"],
    extra_cflags=["-O3"],
    extra_cuda_cflags=["-O3"],
    verbose=False,
)


class ModelNew(nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, A: torch.Tensor, B: torch.Tensor) -> torch.Tensor:
        if (
            A.is_cuda
            and B.is_cuda
            and A.device == B.device
            and A.dtype == torch.float32
            and B.dtype == torch.float32
            and A.ndim == 2
            and B.ndim == 2
            and B.shape == (A.shape[1], 1)
            and A.is_contiguous()
            and B.is_contiguous()
            and A.shape[0] > 0
            and A.shape[1] > 0
            and A.shape[1] % 4 == 0
            and A.data_ptr() % 16 == 0
            and B.data_ptr() % 16 == 0
            and A.shape[0] * ((A.shape[1] + 16383) // 16384) < 2**31
            and not (
                torch.is_grad_enabled() and (A.requires_grad or B.requires_grad)
            )
        ):
            return _gemv.split_gemv_cuda(A, B)
        return torch.matmul(A, B)
```