You write custom CUDA kernels to replace the pytorch operators in the given architecture to get speedups. 

    You have complete freedom to choose the set of operators you want to replace. You may make the decision to replace some operators with custom CUDA kernels and leave others unchanged. You may replace multiple operators with custom implementations, consider operator fusion opportunities (combining multiple operators into a single kernel, for example, combining matmul+relu), or algorithmic changes (such as online softmax). You are only limited by your imagination.


        Here's an example to show you the syntax of inline embedding custom CUDA operators in torch: The example given architecture is: 

        ``` 

        # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

import torch
import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):
    def __init__(self) -> None:
        super().__init__()

    def forward(self, a, b):
        return a + b


def get_inputs():
    # randomly generate input tensors based on the model architecture
    a = torch.randn(1, 128).cuda()
    b = torch.randn(1, 128).cuda()
    return [a, b]


def get_init_inputs():
    # randomly generate tensors required for initialization based on the model architecture
    return []

        ``` 

        The example new arch with custom CUDA kernels looks like this:
        ```
        # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.cpp_extension import load_inline

# Define the custom CUDA kernel for element-wise addition
elementwise_add_source = """
#include <torch/extension.h>
#include <cuda_runtime.h>

__global__ void elementwise_add_kernel(const float* a, const float* b, float* out, int size) {
    int idx = blockIdx.x * blockDim.x + threadIdx.x;
    if (idx < size) {
        out[idx] = a[idx] + b[idx];
    }
}

torch::Tensor elementwise_add_cuda(torch::Tensor a, torch::Tensor b) {
    auto size = a.numel();
    auto out = torch::zeros_like(a);

    const int block_size = 256;
    const int num_blocks = (size + block_size - 1) / block_size;

    elementwise_add_kernel<<<num_blocks, block_size>>>(a.data_ptr<float>(), b.data_ptr<float>(), out.data_ptr<float>(), size);

    return out;
}
"""

elementwise_add_cpp_source = (
    "torch::Tensor elementwise_add_cuda(torch::Tensor a, torch::Tensor b);"
)

# Compile the inline CUDA code for element-wise addition
elementwise_add = load_inline(
    name="elementwise_add",
    cpp_sources=elementwise_add_cpp_source,
    cuda_sources=elementwise_add_source,
    functions=["elementwise_add_cuda"],
    verbose=True,
    extra_cflags=[""],
    extra_ldflags=[""],
)


class ModelNew(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self.elementwise_add = elementwise_add

    def forward(self, a, b):
        return self.elementwise_add.elementwise_add_cuda(a, b)

        ``` 

        
    You are given the following architecture: 

    ```
    # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

import torch
import torch.nn as nn

class Model(nn.Module):
    """
    Model that performs a batch matrix multiplication, instance normalization, summation, residual addition, and multiplication.
    """
    def __init__(self, in_features, out_features, eps=1e-5, momentum=0.1):
        super(Model, self).__init__()
        self.bmm = nn.Linear(in_features, out_features)
        self.instance_norm = nn.InstanceNorm2d(out_features, eps=eps, momentum=momentum)

    def forward(self, x, y):
        """
        Args:
            x (torch.Tensor): Input tensor of shape (batch_size, in_features).
            y (torch.Tensor): Input tensor of shape (batch_size, out_features).

        Returns:
            torch.Tensor: Output tensor of shape (batch_size, out_features).
        """
        x = self.bmm(x)
        x = self.instance_norm(x.unsqueeze(1).unsqueeze(1)).squeeze(1).squeeze(1)
        x = x + y
        x = x * y
        return x

batch_size = 1024  # Increased batch size
in_features = 8192  # Increased input features
out_features = 8192  # Increased output features

def get_inputs():
    return [torch.rand(batch_size, in_features), torch.rand(batch_size, out_features)]

def get_init_inputs():
    return [in_features, out_features]
    ```
    
Optimize the architecture named Model with custom CUDA operators! Name your optimized output architecture ModelNew. Output the new code in codeblocks. Please generate real code, NOT pseudocode, make sure the code compiles and is fully functional. Just output the new model code, no other text, and NO testing code! 



This is turn 6 of 6 for this task. Your previous solution (turn 5) was:
```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 <ATen/cuda/CUDABlas.h>
#include <c10/cuda/CUDAGuard.h>
#include <c10/cuda/CUDAException.h>
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <cstdint>
#include <climits>

__device__ __forceinline__ float block_sum(float value) {
    __shared__ float partial[8];
    const int lane = threadIdx.x & 31;
    const int warp = threadIdx.x >> 5;

    #pragma unroll
    for (int offset = 16; offset > 0; offset >>= 1)
        value += __shfl_down_sync(0xffffffff, value, offset);

    if (lane == 0)
        partial[warp] = value;
    __syncthreads();

    if (warp == 0) {
        value = lane < 8 ? partial[lane] : 0.0f;
        #pragma unroll
        for (int offset = 16; offset > 0; offset >>= 1)
            value += __shfl_down_sync(0xffffffff, value, offset);
        if (lane == 0)
            partial[0] = value;
    }
    __syncthreads();
    const float result = partial[0];
    __syncthreads();
    return result;
}

__device__ __forceinline__ float finish(
    float centered, float inv_std, float residual
) {
    return __fmul_rn(
        __fadd_rn(__fmul_rn(centered, inv_std), residual),
        residual);
}

template<int ITEMS>
__global__ void epilogue_vectorized(
    const float4* __restrict__ linear,
    const float4* __restrict__ bias,
    const float4* __restrict__ residual,
    float4* __restrict__ output,
    int vectors,
    float epsilon
) {
    const int64_t base = int64_t(blockIdx.x) * vectors;
    float4 values[ITEMS];
    float sum = 0.0f;

    #pragma unroll
    for (int i = 0; i < ITEMS; ++i) {
        const int col = threadIdx.x + i * 256;
        float4 v = make_float4(0.f, 0.f, 0.f, 0.f);
        if (col < vectors) {
            v = linear[base + col];
            const float4 b = bias[col];
            v.x = __fadd_rn(v.x, b.x);
            v.y = __fadd_rn(v.y, b.y);
            v.z = __fadd_rn(v.z, b.z);
            v.w = __fadd_rn(v.w, b.w);
        }
        values[i] = v;
        sum += (v.x + v.y) + (v.z + v.w);
    }

    const float mean = block_sum(sum) / float(vectors * 4);
    float squared_sum = 0.0f;

    #pragma unroll
    for (int i = 0; i < ITEMS; ++i) {
        const int col = threadIdx.x + i * 256;
        if (col < vectors) {
            float4 v = values[i];
            v.x -= mean;
            v.y -= mean;
            v.z -= mean;
            v.w -= mean;
            values[i] = v;
            squared_sum = fmaf(v.x, v.x, squared_sum);
            squared_sum = fmaf(v.y, v.y, squared_sum);
            squared_sum = fmaf(v.z, v.z, squared_sum);
            squared_sum = fmaf(v.w, v.w, squared_sum);
        }
    }

    const float inv_std = rsqrtf(
        block_sum(squared_sum) / float(vectors * 4) + epsilon);

    #pragma unroll
    for (int i = 0; i < ITEMS; ++i) {
        const int col = threadIdx.x + i * 256;
        if (col < vectors) {
            const float4 v = values[i];
            const float4 y = residual[base + col];
            output[base + col] = make_float4(
                finish(v.x, inv_std, y.x),
                finish(v.y, inv_std, y.y),
                finish(v.z, inv_std, y.z),
                finish(v.w, inv_std, y.w));
        }
    }
}

__global__ void epilogue_scalar(
    const float* __restrict__ linear,
    const float* __restrict__ bias,
    const float* __restrict__ residual,
    float* __restrict__ output,
    int columns,
    float epsilon
) {
    const int64_t base = int64_t(blockIdx.x) * columns;
    float values[32];
    float sum = 0.0f;

    #pragma unroll
    for (int i = 0; i < 32; ++i) {
        const int col = threadIdx.x + i * 256;
        const float v = col < columns
            ? __fadd_rn(linear[base + col], bias[col])
            : 0.0f;
        values[i] = v;
        sum += v;
    }

    const float mean = block_sum(sum) / float(columns);
    float squared_sum = 0.0f;

    #pragma unroll
    for (int i = 0; i < 32; ++i) {
        const int col = threadIdx.x + i * 256;
        if (col < columns) {
            values[i] -= mean;
            squared_sum = fmaf(values[i], values[i], squared_sum);
        }
    }

    const float inv_std = rsqrtf(
        block_sum(squared_sum) / float(columns) + epsilon);

    #pragma unroll
    for (int i = 0; i < 32; ++i) {
        const int col = threadIdx.x + i * 256;
        if (col < columns)
            output[base + col] = finish(
                values[i], inv_std, residual[base + col]);
    }
}

torch::Tensor linear_norm_residual(
    torch::Tensor x,
    torch::Tensor weight,
    torch::Tensor bias,
    torch::Tensor residual,
    double epsilon
) {
    TORCH_CHECK(
        x.is_cuda() && weight.is_cuda() &&
        bias.is_cuda() && residual.is_cuda(),
        "Expected CUDA tensors");
    TORCH_CHECK(
        x.device() == weight.device() &&
        x.device() == bias.device() &&
        x.device() == residual.device(),
        "Devices must match");
    TORCH_CHECK(
        x.scalar_type() == at::kFloat &&
        weight.scalar_type() == at::kFloat &&
        bias.scalar_type() == at::kFloat &&
        residual.scalar_type() == at::kFloat,
        "Expected float32 tensors");
    TORCH_CHECK(
        x.is_contiguous() && weight.is_contiguous() &&
        bias.is_contiguous() && residual.is_contiguous(),
        "Expected contiguous tensors");
    TORCH_CHECK(
        x.dim() == 2 && weight.dim() == 2 &&
        bias.dim() == 1 && residual.dim() == 2,
        "Invalid tensor ranks");
    TORCH_CHECK(
        x.size(1) == weight.size(1) &&
        bias.size(0) == weight.size(0) &&
        residual.size(0) == x.size(0) &&
        residual.size(1) == weight.size(0),
        "Incompatible shapes");
    TORCH_CHECK(
        x.size(0) <= INT_MAX &&
        x.size(1) > 0 && x.size(1) <= INT_MAX &&
        weight.size(0) > 1 && weight.size(0) <= 8192,
        "Unsupported dimensions");

    const c10::cuda::CUDAGuard guard(x.device());
    const int rows = int(x.size(0));
    const int columns = int(weight.size(0));
    const int inner = int(x.size(1));
    auto output = torch::empty({rows, columns}, x.options());

    if (rows == 0)
        return output;

    auto linear = torch::empty_like(output);
    const auto stream = at::cuda::getCurrentCUDAStream();
    cublasHandle_t handle = at::cuda::getCurrentCUDABlasHandle();

    cublasMath_t previous_mode;
    TORCH_CHECK(
        cublasGetMathMode(handle, &previous_mode) == CUBLAS_STATUS_SUCCESS,
        "Cannot query cuBLAS math mode");
    TORCH_CHECK(
        cublasSetMathMode(handle, CUBLAS_TF32_TENSOR_OP_MATH)
            == CUBLAS_STATUS_SUCCESS,
        "Cannot enable TF32 tensor cores");

    const float alpha = 1.0f;
    const float beta = 0.0f;
    const cublasStatus_t gemm_status = cublasGemmEx(
        handle,
        CUBLAS_OP_T, CUBLAS_OP_N,
        columns, rows, inner,
        &alpha,
        weight.data_ptr<float>(), CUDA_R_32F, inner,
        x.data_ptr<float>(), CUDA_R_32F, inner,
        &beta,
        linear.data_ptr<float>(), CUDA_R_32F, columns,
        CUBLAS_COMPUTE_32F_FAST_TF32,
        CUBLAS_GEMM_DEFAULT_TENSOR_OP);

    const cublasStatus_t restore_status =
        cublasSetMathMode(handle, previous_mode);
    TORCH_CHECK(
        gemm_status == CUBLAS_STATUS_SUCCESS,
        "cublasGemmEx failed: ", int(gemm_status));
    TORCH_CHECK(
        restore_status == CUBLAS_STATUS_SUCCESS,
        "Cannot restore cuBLAS math mode");

    const float* z = linear.data_ptr<float>();
    const float* b = bias.data_ptr<float>();
    const float* y = residual.data_ptr<float>();
    float* out = output.data_ptr<float>();

    const bool aligned =
        ((reinterpret_cast<uintptr_t>(z) |
          reinterpret_cast<uintptr_t>(b) |
          reinterpret_cast<uintptr_t>(y) |
          reinterpret_cast<uintptr_t>(out)) & 15) == 0;

    if (columns % 4 == 0 && aligned) {
        const int vectors = columns / 4;
        const auto* zv = reinterpret_cast<const float4*>(z);
        const auto* bv = reinterpret_cast<const float4*>(b);
        const auto* yv = reinterpret_cast<const float4*>(y);
        auto* ov = reinterpret_cast<float4*>(out);

        if (vectors <= 256)
            epilogue_vectorized<1><<<rows, 256, 0, stream>>>(
                zv, bv, yv, ov, vectors, float(epsilon));
        else if (vectors <= 512)
            epilogue_vectorized<2><<<rows, 256, 0, stream>>>(
                zv, bv, yv, ov, vectors, float(epsilon));
        else if (vectors <= 1024)
            epilogue_vectorized<4><<<rows, 256, 0, stream>>>(
                zv, bv, yv, ov, vectors, float(epsilon));
        else
            epilogue_vectorized<8><<<rows, 256, 0, stream>>>(
                zv, bv, yv, ov, vectors, float(epsilon));
    } else {
        epilogue_scalar<<<rows, 256, 0, stream>>>(
            z, b, y, out, columns, float(epsilon));
    }

    C10_CUDA_KERNEL_LAUNCH_CHECK();
    return output;
}
"""

_ops = load_inline(
    name="tf32_linear_fused_instance_residual_v5",
    cpp_sources=r"""
torch::Tensor linear_norm_residual(
    torch::Tensor x,
    torch::Tensor weight,
    torch::Tensor bias,
    torch::Tensor residual,
    double epsilon);
""",
    cuda_sources=_cuda_source,
    functions=["linear_norm_residual"],
    extra_cflags=["-O3"],
    extra_cuda_cflags=["-O3"],
    extra_ldflags=["-lcublas"],
    verbose=False,
)


class ModelNew(nn.Module):
    def __init__(self, in_features, out_features, eps=1e-5, momentum=0.1):
        super().__init__()
        self.bmm = nn.Linear(in_features, out_features)
        self.instance_norm = nn.InstanceNorm2d(
            out_features, eps=eps, momentum=momentum
        )

    def forward(self, x, y):
        weight = self.bmm.weight
        bias = self.bmm.bias

        if (
            x.is_cuda
            and y.is_cuda
            and x.device == y.device == weight.device == bias.device
            and x.dtype == y.dtype == weight.dtype == bias.dtype == torch.float32
            and x.ndim == 2
            and y.ndim == 2
            and 0 < x.shape[1] <= 2147483647
            and x.shape[0] <= 2147483647
            and x.shape[1] == weight.shape[1]
            and y.shape == (x.shape[0], weight.shape[0])
            and 1 < weight.shape[0] <= 8192
            and not torch.is_autocast_enabled()
        ):
            return _ops.linear_norm_residual(
                x.contiguous(),
                weight.contiguous(),
                bias.contiguous(),
                y.contiguous(),
                self.instance_norm.eps,
            )

        z = self.bmm(x)
        z = self.instance_norm(
            z.unsqueeze(1).unsqueeze(1)
        ).squeeze(1).squeeze(1)
        return (z + y) * y
```
Result of evaluating it:
The solution compiled and ran but its output did not match the reference. Details:
```
{"avg_difference": ["0.000113", "0.000113", "0.000113", "0.000113", "0.000113"], "correctness_issue": "Output mismatch", "correctness_trials": "(0 / 5)", "max_difference": ["0.001286", "0.001332", "0.001452", "0.001305", "0.001293"]}
```

The fastest correct solution so far (0.568x speedup) is:
```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 <ATen/cuda/CUDABlas.h>
#include <c10/cuda/CUDAGuard.h>
#include <c10/cuda/CUDAException.h>
#include <cuda_fp16.h>
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <climits>

__global__ void split_inputs(
    const float* __restrict__ weight,
    const float* __restrict__ x,
    __half* __restrict__ packed,
    int64_t weight_count,
    int64_t total
) {
    for (int64_t i = int64_t(blockIdx.x) * blockDim.x + threadIdx.x;
         i < total;
         i += int64_t(blockDim.x) * gridDim.x) {
        const float v = i < weight_count ? weight[i] : x[i - weight_count];
        const __half hi = __float2half_rn(v);
        const float remainder = (v - __half2float(hi)) * 2048.0f;
        packed[i] = hi;
        packed[total + i] = __float2half_rn(remainder);
    }
}

__device__ __forceinline__ float block_sum(float value) {
    __shared__ float partial[8];
    const int lane = threadIdx.x & 31;
    const int warp = threadIdx.x >> 5;

    #pragma unroll
    for (int offset = 16; offset; offset >>= 1)
        value += __shfl_down_sync(0xffffffff, value, offset);

    if (lane == 0)
        partial[warp] = value;
    __syncthreads();

    if (warp == 0) {
        value = lane < 8 ? partial[lane] : 0.0f;
        #pragma unroll
        for (int offset = 16; offset; offset >>= 1)
            value += __shfl_down_sync(0xffffffff, value, offset);
        if (lane == 0)
            partial[0] = value;
    }
    __syncthreads();
    const float result = partial[0];
    __syncthreads();
    return result;
}

template<int ITEMS>
__global__ void fused_epilogue(
    const float* __restrict__ linear,
    const float* __restrict__ bias,
    const float* __restrict__ residual,
    float* __restrict__ output,
    int columns,
    float epsilon
) {
    const int64_t base = int64_t(blockIdx.x) * columns;
    float values[ITEMS];
    float sum = 0.0f;

    #pragma unroll
    for (int i = 0; i < ITEMS; ++i) {
        const int col = threadIdx.x + i * 256;
        const float value = col < columns
            ? __fadd_rn(linear[base + col], bias[col])
            : 0.0f;
        values[i] = value;
        sum += value;
    }

    const float mean = block_sum(sum) / float(columns);
    float squared_sum = 0.0f;

    #pragma unroll
    for (int i = 0; i < ITEMS; ++i) {
        const int col = threadIdx.x + i * 256;
        if (col < columns) {
            values[i] -= mean;
            squared_sum = fmaf(values[i], values[i], squared_sum);
        }
    }

    const float inv_std =
        rsqrtf(block_sum(squared_sum) / float(columns) + epsilon);

    #pragma unroll
    for (int i = 0; i < ITEMS; ++i) {
        const int col = threadIdx.x + i * 256;
        if (col < columns) {
            const float y = residual[base + col];
            const float normalized = __fmul_rn(values[i], inv_std);
            output[base + col] =
                __fmul_rn(__fadd_rn(normalized, y), y);
        }
    }
}

struct MathModeGuard {
    cublasHandle_t handle;
    cublasMath_t previous;

    explicit MathModeGuard(cublasHandle_t h) : handle(h) {
        TORCH_CHECK(
            cublasGetMathMode(handle, &previous) == CUBLAS_STATUS_SUCCESS,
            "Cannot query cuBLAS math mode");
        const auto mode = static_cast<cublasMath_t>(
            static_cast<unsigned int>(previous) |
            static_cast<unsigned int>(
                CUBLAS_MATH_DISALLOW_REDUCED_PRECISION_REDUCTION));
        TORCH_CHECK(
            cublasSetMathMode(handle, mode) == CUBLAS_STATUS_SUCCESS,
            "Cannot set cuBLAS math mode");
    }

    ~MathModeGuard() {
        cublasSetMathMode(handle, previous);
    }
};

torch::Tensor split_linear_norm(
    torch::Tensor x,
    torch::Tensor weight,
    torch::Tensor bias,
    torch::Tensor y,
    double epsilon
) {
    TORCH_CHECK(
        x.is_cuda() && weight.is_cuda() && bias.is_cuda() && y.is_cuda(),
        "Expected CUDA tensors");
    TORCH_CHECK(
        x.device() == weight.device() &&
        x.device() == bias.device() && x.device() == y.device(),
        "Devices must match");
    TORCH_CHECK(
        x.scalar_type() == at::kFloat &&
        weight.scalar_type() == at::kFloat &&
        bias.scalar_type() == at::kFloat &&
        y.scalar_type() == at::kFloat,
        "Expected float32 tensors");
    TORCH_CHECK(
        x.is_contiguous() && weight.is_contiguous() &&
        bias.is_contiguous() && y.is_contiguous(),
        "Expected contiguous tensors");
    TORCH_CHECK(
        x.dim() == 2 && weight.dim() == 2 &&
        bias.dim() == 1 && y.dim() == 2,
        "Invalid tensor ranks");
    TORCH_CHECK(
        x.size(1) == weight.size(1) &&
        bias.size(0) == weight.size(0) &&
        y.size(0) == x.size(0) && y.size(1) == weight.size(0),
        "Incompatible shapes");
    TORCH_CHECK(
        x.size(0) <= INT_MAX &&
        x.size(1) > 0 && x.size(1) <= INT_MAX &&
        weight.size(0) > 1 && weight.size(0) <= 8192,
        "Unsupported dimensions");

    const c10::cuda::CUDAGuard device_guard(x.device());
    const int rows = int(x.size(0));
    const int columns = int(weight.size(0));
    const int inner = int(x.size(1));

    auto output = torch::empty({rows, columns}, x.options());
    if (rows == 0)
        return output;

    auto linear = torch::empty_like(output);
    const int64_t weight_count = weight.numel();
    const int64_t total = weight_count + x.numel();
    auto packed = torch::empty(
        {2, total}, x.options().dtype(at::kHalf));

    auto* data = reinterpret_cast<__half*>(
        packed.data_ptr<at::Half>());
    const auto stream = at::cuda::getCurrentCUDAStream();
    const int64_t requested_blocks = (total + 255) / 256;
    const int blocks = int(requested_blocks < 65535
        ? requested_blocks : 65535);

    split_inputs<<<blocks, 256, 0, stream>>>(
        weight.data_ptr<float>(), x.data_ptr<float>(),
        data, weight_count, total);
    C10_CUDA_KERNEL_LAUNCH_CHECK();

    const __half* weight_hi = data;
    const __half* x_hi = data + weight_count;
    const __half* weight_lo = data + total;
    const __half* x_lo = data + total + weight_count;

    cublasHandle_t handle = at::cuda::getCurrentCUDABlasHandle();

    {
        MathModeGuard math_guard(handle);

        const float one = 1.0f;
        const float zero = 0.0f;
        const float correction_scale = 1.0f / 2048.0f;

        // Two half components preserve substantially more input precision
        // than a single TF32 conversion. All GEMMs accumulate in float32.
        auto gemm = [&](const __half* w, const __half* a,
                        const float* alpha, const float* beta) {
            const cublasStatus_t status = cublasGemmEx(
                handle,
                CUBLAS_OP_T, CUBLAS_OP_N,
                columns, rows, inner,
                alpha,
                w, CUDA_R_16F, inner,
                a, CUDA_R_16F, inner,
                beta,
                linear.data_ptr<float>(), CUDA_R_32F, columns,
                CUBLAS_COMPUTE_32F,
                CUBLAS_GEMM_DEFAULT_TENSOR_OP);
            TORCH_CHECK(
                status == CUBLAS_STATUS_SUCCESS,
                "cublasGemmEx failed: ", int(status));
        };

        gemm(weight_lo, x_hi, &correction_scale, &zero);
        gemm(weight_hi, x_lo, &correction_scale, &one);
        gemm(weight_hi, x_hi, &one, &one);
    }

    if (columns <= 2048) {
        fused_epilogue<8><<<rows, 256, 0, stream>>>(
            linear.data_ptr<float>(), bias.data_ptr<float>(),
            y.data_ptr<float>(), output.data_ptr<float>(),
            columns, float(epsilon));
    } else if (columns <= 4096) {
        fused_epilogue<16><<<rows, 256, 0, stream>>>(
            linear.data_ptr<float>(), bias.data_ptr<float>(),
            y.data_ptr<float>(), output.data_ptr<float>(),
            columns, float(epsilon));
    } else {
        fused_epilogue<32><<<rows, 256, 0, stream>>>(
            linear.data_ptr<float>(), bias.data_ptr<float>(),
            y.data_ptr<float>(), output.data_ptr<float>(),
            columns, float(epsilon));
    }

    C10_CUDA_KERNEL_LAUNCH_CHECK();
    return output;
}
"""

_ops = load_inline(
    name="split_half_linear_fused_norm_v3",
    cpp_sources=r"""
torch::Tensor split_linear_norm(
    torch::Tensor x,
    torch::Tensor weight,
    torch::Tensor bias,
    torch::Tensor y,
    double epsilon);
""",
    cuda_sources=_cuda_source,
    functions=["split_linear_norm"],
    extra_cflags=["-O3"],
    extra_cuda_cflags=["-O3"],
    extra_ldflags=["-lcublas"],
    verbose=False,
)


class ModelNew(nn.Module):
    def __init__(self, in_features, out_features, eps=1e-5, momentum=0.1):
        super().__init__()
        self.bmm = nn.Linear(in_features, out_features)
        self.instance_norm = nn.InstanceNorm2d(
            out_features, eps=eps, momentum=momentum
        )

    def forward(self, x, y):
        weight = self.bmm.weight
        bias = self.bmm.bias

        if (
            x.is_cuda
            and y.is_cuda
            and x.device == y.device == weight.device == bias.device
            and x.dtype == y.dtype == weight.dtype == bias.dtype == torch.float32
            and x.ndim == 2
            and y.ndim == 2
            and x.shape[1] == weight.shape[1]
            and x.shape[1] > 0
            and y.shape == (x.shape[0], weight.shape[0])
            and 1 < weight.shape[0] <= 8192
            and not torch.is_autocast_enabled()
        ):
            return _ops.split_linear_norm(
                x.contiguous(),
                weight.contiguous(),
                bias.contiguous(),
                y.contiguous(),
                self.instance_norm.eps,
            )

        z = self.bmm(x)
        z = self.instance_norm(
            z.unsqueeze(1).unsqueeze(1)
        ).squeeze(1).squeeze(1)
        return (z + y) * y
```

Write an improved complete ModelNew: fix any error, and if the solution is already correct, make it faster. Output the new code in one ```python codeblock. Just the model code, no other text, and NO testing code.
