def get_special_exec_cond_and_kernel(
    func_attrs,
    input_type,
    output_type,
    acc_type,
    output_accessors,
    reduction_op,
    reduction_identity,
) -> (str, str):
    """
    In the current implementation, each thread performs one vector load per row,
    runs the reduction, then with the results does one vector store.

    Returns
    ---
    exec_cond : str
        This should replace the exec conditions for original kernel.

    special_reduction_code : str
        Includes the kernel code and the launcher for the host.
    """
    exec_conds = []

    for vector_type, vec_bytesize in vector_types[input_type]:
        vlen = int(vec_bytesize / bytesize[input_type])
        exec_cond = EXEC_COND_TEMPLATE.render(
            indent="  ",
            func_name=func_attrs["name"],
            elem_input_type=input_type,
            elem_output_type=output_type,
            elem_compute_type=acc_type,
            vector_type=vector_type,
            vlen=vlen,
        )
        exec_conds.append(exec_cond)

    special_reduction_code = SRC_TEMPLATE.render(
        func_name=func_attrs["name"],
        reduction_op=reduction_op,
        reduction_identity=reduction_identity,
    )
    return "".join(exec_conds), special_reduction_code
In the current implementation, each thread performs one vector load per row,
runs the reduction, then with the results does one vector store.

Returns
---
exec_cond : str
This should replace the exec conditions for original kernel.

special_reduction_code : str
Includes the kernel code and the launcher for the host.
python/aitemplate/backend/cuda/reduce/reduce_common_slim_tensor.py