@triton.jit
def _fused_scatter_reduce_forward_kernel(inputs_ptr, index_ptr, out_ptr,
    num_feats, num_reductions, numel, REDUCE0, REDUCE1, REDUCE2, REDUCE3,
    BLOCK_SIZE: tl.constexpr):
    pid = tl.program_id(axis=0)
    block_start = pid * BLOCK_SIZE
    offsets = block_start + tl.arange(0, BLOCK_SIZE)
    mask = offsets < numel
    inputs = tl.load(inputs_ptr + offsets, mask=mask)
    index_offsets = offsets // num_feats
    index = tl.load(index_ptr + index_offsets, mask=mask)
    if REDUCE0 > 0:
        out_offsets = num_feats * num_reductions * index
        out_offsets = out_offsets + offsets % num_feats
        if REDUCE0 == 1:
            tl.atomic_add(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE0 == 2:
            tl.atomic_add(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE0 == 3:
            tl.atomic_min(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE0 == 4:
            tl.atomic_max(out_ptr + out_offsets, inputs, mask=mask)
    if REDUCE1 > 0:
        out_offsets = num_feats * num_reductions * index
        out_offsets = out_offsets + num_feats
        out_offsets = out_offsets + offsets % num_feats
        if REDUCE1 == 1:
            tl.atomic_add(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE1 == 2:
            tl.atomic_add(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE2 == 3:
            tl.atomic_min(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE3 == 4:
            tl.atomic_max(out_ptr + out_offsets, inputs, mask=mask)
    if REDUCE2 > 0:
        out_offsets = num_feats * num_reductions * index
        out_offsets = out_offsets + 2 * num_feats
        out_offsets = out_offsets + offsets % num_feats
        if REDUCE2 == 1:
            tl.atomic_add(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE2 == 2:
            tl.atomic_add(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE2 == 3:
            tl.atomic_min(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE2 == 4:
            tl.atomic_max(out_ptr + out_offsets, inputs, mask=mask)
    if REDUCE3 > 0:
        out_offsets = num_feats * num_reductions * index
        out_offsets = out_offsets + 3 * num_feats
        out_offsets = out_offsets + offsets % num_feats
        if REDUCE3 == 1:
            tl.atomic_add(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE3 == 2:
            tl.atomic_add(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE3 == 3:
            tl.atomic_min(out_ptr + out_offsets, inputs, mask=mask)
        elif REDUCE3 == 4:
            tl.atomic_max(out_ptr + out_offsets, inputs, mask=mask)
