@triton.jit
def _gelu_glu_bwd_kernel_(grad_output_ptr, grad_input_ptr, input_ptr,
    grad_output_row_stride, grad_input_row_stride, input_row_stride,
    grad_output_col_stride, grad_input_col_stride, input_col_stride, n_rows,
    n_cols, BLOCK_SIZE: tl.constexpr):
    col_idx = tl.program_id(0)
    row_idx = tl.arange(0, BLOCK_SIZE)
    grad_output = tl.load(grad_output_ptr + row_idx *
        grad_output_row_stride + col_idx * grad_output_col_stride, mask=tl.
        arange(0, BLOCK_SIZE) < n_rows, other=-float('inf'))
    x = tl.load(input_ptr + row_idx * input_row_stride + col_idx *
        input_col_stride, mask=tl.arange(0, BLOCK_SIZE) < n_rows, other=-
        float('inf'))
    gate = tl.load(input_ptr + row_idx * input_row_stride + (col_idx + 
        n_cols // 2) * input_col_stride, mask=tl.arange(0, BLOCK_SIZE) <
        n_rows, other=-float('inf'))
    gate_cube = gate * gate * gate
    beta = 0.7978845608028654
    kappa = 0.044715
    inner = beta * (gate + kappa * gate_cube)
    inner_tanh = tanh(inner)
    gate_gelu = 0.5 * gate * (inner_tanh + 1)
    grad_x = grad_output * gate_gelu
    grad_gelu = grad_output * x
    grad_gate = grad_gelu * (0.5 * (1 + inner_tanh) + 0.5 * gate * (1 - 
        inner_tanh * inner_tanh) * beta * (1 + kappa * 3 * gate * gate))
    tl.store(grad_input_ptr + row_idx * grad_input_row_stride + col_idx *
        grad_input_col_stride, grad_x, mask=tl.arange(0, BLOCK_SIZE) < n_rows)
    tl.store(grad_input_ptr + row_idx * grad_input_row_stride + (col_idx + 
        n_cols // 2) * grad_input_col_stride, grad_gate, mask=tl.arange(0,
        BLOCK_SIZE) < n_rows)
