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

_cpp_source = """
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>
#include <cstdint>

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;
}

template<bool VECTORIZED>
__global__ void gemv_partial_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 int64_t begin = static_cast<int64_t>(split) * CHUNK;
    const int64_t end = begin + CHUNK < K ? begin + CHUNK : K;
    const float* matrix_row = A + row * K;

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

    if (VECTORIZED) {
        const float4* a4 = reinterpret_cast<const float4*>(matrix_row);
        const float4* b4 = reinterpret_cast<const float4*>(B);

        for (int64_t j = begin / 4 + threadIdx.x;
             j < end / 4;
             j += THREADS) {
            const float4 a = a4[j];
            const float4 b = __ldg(b4 + j);
            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);
        }
    } else {
        for (int64_t j = begin + threadIdx.x;
             j < end;
             j += THREADS) {
            s0 = fmaf(matrix_row[j], __ldg(B + j), s0);
        }
    }

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

    __shared__ float warp_sums[THREADS / 32];
    const int lane = threadIdx.x & 31;
    const int warp = threadIdx.x >> 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[static_cast<int64_t>(blockIdx.x)] = sum;
    }
}

__global__ void gemv_finish_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) {
    TORCH_CHECK(A.is_cuda() && B.is_cuda(), "Inputs must be CUDA tensors");
    TORCH_CHECK(A.device() == B.device(), "Inputs must share a device");
    TORCH_CHECK(A.scalar_type() == torch::kFloat32 &&
                B.scalar_type() == torch::kFloat32,
                "Inputs must have dtype float32");
    TORCH_CHECK(A.is_contiguous() && B.is_contiguous(),
                "Inputs must be contiguous");
    TORCH_CHECK(A.dim() == 2 && B.dim() == 2 &&
                B.size(1) == 1 && A.size(1) == B.size(0),
                "Expected shapes (M, K) and (K, 1)");

    const c10::cuda::CUDAGuard guard(A.device());
    const int64_t M = A.size(0);
    const int64_t K = A.size(1);

    if (K == 0)
        return torch::zeros({M, 1}, A.options());

    auto output = torch::empty({M, 1}, A.options());
    if (M == 0)
        return output;

    const int64_t splits64 = (K + CHUNK - 1) / CHUNK;
    TORCH_CHECK(splits64 <= INT32_MAX &&
                M <= INT32_MAX / splits64,
                "Input exceeds supported CUDA grid size");
    const int splits = static_cast<int>(splits64);

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

    const float* a = A.data_ptr<float>();
    const float* b = B.data_ptr<float>();
    const bool vectorized =
        K % 4 == 0 &&
        reinterpret_cast<uintptr_t>(a) % 16 == 0 &&
        reinterpret_cast<uintptr_t>(b) % 16 == 0;

    const auto stream = at::cuda::getCurrentCUDAStream();
    const unsigned int blocks = static_cast<unsigned int>(M * splits64);

    if (vectorized) {
        gemv_partial_kernel<true><<<blocks, THREADS, 0, stream>>>(
            a, b, partial.data_ptr<float>(), K, splits);
    } else {
        gemv_partial_kernel<false><<<blocks, THREADS, 0, stream>>>(
            a, b, partial.data_ptr<float>(), K, splits);
    }
    C10_CUDA_KERNEL_LAUNCH_CHECK();

    if (splits > 1) {
        const unsigned int finish_blocks =
            static_cast<unsigned int>((M + THREADS / 32 - 1) /
                                      (THREADS / 32));
        gemv_finish_kernel<<<finish_blocks, 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_fp32_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[1] == 1
            and A.shape[1] == B.shape[0]
            and A.is_contiguous()
            and B.is_contiguous()
            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)
```