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

_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 <algorithm>
#include <cstdint>
#include <climits>

__device__ __forceinline__ float fast_gelu(float x) {
    const float u = 0.7978845608028654f *
                    fmaf(0.044715f * x, x * x, x);
    float t;
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 750
    asm("tanh.approx.f32 %0, %1;" : "=f"(t) : "f"(u));
#else
    t = tanhf(u);
#endif
    return (0.5f * x) * (1.0f + t);
}

__device__ __forceinline__ float4 transform(float4 v) {
    v.x = fast_gelu(v.x);
    v.y = fast_gelu(v.y);
    v.z = fast_gelu(v.z);
    v.w = fast_gelu(v.w);
    return v;
}

template <typename Index>
__global__ void gelu_vector_kernel(
    const float* __restrict__ x,
    float* __restrict__ y,
    Index n
) {
    const Index tid = static_cast<Index>(blockIdx.x) * blockDim.x
                    + threadIdx.x;
    const Index stride = static_cast<Index>(blockDim.x) * gridDim.x;
    const Index vectors = n / 4;
    const float4* __restrict__ xv =
        reinterpret_cast<const float4*>(x);
    float4* __restrict__ yv = reinterpret_cast<float4*>(y);

    for (Index i = tid; i < vectors; i += stride) {
        yv[i] = transform(xv[i]);
    }

    const Index tail = vectors * 4 + tid;
    if (tail < n) {
        y[tail] = fast_gelu(x[tail]);
    }
}

template <typename Index>
__global__ void gelu_scalar_kernel(
    const float* __restrict__ x,
    float* __restrict__ y,
    Index n
) {
    const Index tid = static_cast<Index>(blockIdx.x) * blockDim.x
                    + threadIdx.x;
    const Index stride = static_cast<Index>(blockDim.x) * gridDim.x;

    for (Index i = tid; i < n; i += stride) {
        y[i] = fast_gelu(x[i]);
    }
}

template <typename Index>
void launch_gelu(
    const float* x, float* y, int64_t n, cudaStream_t stream
) {
    constexpr int threads = 256;
    const bool aligned = (reinterpret_cast<uintptr_t>(x) & 15) == 0;
    const int64_t work = aligned ? (n + 3) / 4 : n;
    const int blocks = static_cast<int>(
        std::min<int64_t>((work + threads - 1) / threads, 4096));

    if (aligned) {
        gelu_vector_kernel<Index><<<blocks, threads, 0, stream>>>(
            x, y, static_cast<Index>(n));
    } else {
        gelu_scalar_kernel<Index><<<blocks, threads, 0, stream>>>(
            x, y, static_cast<Index>(n));
    }
}

torch::Tensor gelu_cuda(torch::Tensor input) {
    TORCH_CHECK(input.is_cuda(), "Expected a CUDA tensor");
    TORCH_CHECK(input.scalar_type() == at::kFloat, "Expected float32");

    const c10::cuda::CUDAGuard guard(input.device());
    auto x = input.contiguous();
    auto y = torch::empty_like(x);
    const int64_t n = x.numel();
    if (n == 0) return y;

    const cudaStream_t stream = at::cuda::getCurrentCUDAStream();
    if (n <= static_cast<int64_t>(INT_MAX) - 1048576) {
        launch_gelu<int>(x.data_ptr<float>(), y.data_ptr<float>(), n, stream);
    } else {
        launch_gelu<int64_t>(
            x.data_ptr<float>(), y.data_ptr<float>(), n, stream);
    }

    C10_CUDA_KERNEL_LAUNCH_CHECK();
    return y;
}
"""

_gelu_extension = load_inline(
    name="fused_gelu_native_tanh_v2",
    cpp_sources="torch::Tensor gelu_cuda(torch::Tensor input);",
    cuda_sources=_cuda_source,
    functions=["gelu_cuda"],
    extra_cflags=["-O3"],
    extra_cuda_cflags=["-O3", "--use_fast_math"],
    verbose=False,
)


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

    def forward(self, x):
        return _gelu_extension.gelu_cuda(x)
```