def _from_same_src_op(gemm_ops: List[Operator], op_type: str) -> bool:
    """
    Check that the first input of all the ops in gemm_ops come from the same exact op.
    Returns true if they all come from the same op, and false otherwise.
    """
    if len(gemm_ops) <= 1:
        return True
    src_ops = list(gemm_ops[0]._attrs["inputs"][0].src_ops())
    if len(src_ops) != 1:
        return False
    src_op = src_ops[0]
    if src_op._attrs["op"] != op_type:
        return False
    for gemm_op in gemm_ops[1:]:
        src_ops = gemm_op._attrs["inputs"][0].src_ops()
        if len(src_ops) != 1:
            return False
        if src_op not in src_ops:
            return False
    return True

    Check that the first input of all the ops in gemm_ops come from the same exact op.
    Returns true if they all come from the same op, and false otherwise.
    
python/aitemplate/compiler/transform/fuse_parallel_gemms.py