def causal_conv1d_update(
        cls, x, conv_state, weight, bias=None, activation=None, cache_seqlens=None
    ):
        """
        x: (batch, dim) or (batch, dim, seqlen)
        conv_state: (batch, dim, state_len), where state_len >= width - 1
        weight: (dim, width)
        bias: (dim,)
        activation: None, "silu", or "swish"
        cache_seqlens: (batch,), dtype int32.
            If not None, the conv_state is treated as a circular buffer.
            The conv_state will be updated by copying x to the
            conv_state starting at the index
            @cache_seqlens % state_len before performing the convolution.

        out: (batch, dim) or (batch, dim, seqlen)
        """
        if activation not in [None, "silu", "swish"]:
            raise NotImplementedError("activation must be None, silu, or swish")
        out, conv_state_new = torch.ops.torch_ipex.causal_conv1d_update(
            x, conv_state, weight, bias, activation == "silu", cache_seqlens
        )
        conv_state.copy_(conv_state_new)
        return out

        x: (batch, dim) or (batch, dim, seqlen)
        conv_state: (batch, dim, state_len), where state_len >= width - 1
        weight: (dim, width)
        bias: (dim,)
        activation: None, "silu", or "swish"
        cache_seqlens: (batch,), dtype int32.
            If not None, the conv_state is treated as a circular buffer.
            The conv_state will be updated by copying x to the
            conv_state starting at the index
            @cache_seqlens % state_len before performing the convolution.

        out: (batch, dim) or (batch, dim, seqlen)
        
intel_extension_for_pytorch/transformers/models/cpu/fusions/mha_fusion.py