def transform_strided_ops(
    sorted_graph: List[Tensor], workdir: str = None
) -> List[Tensor]:
    """
    Add strided inputs / outputs to ops to avoid unnecessary data movement.
    """
    if detect_target().name() == "cuda":
        funcs = [
            # TODO: Remove these passes after cat supports input_accessors.
            _fuse_slices_concat_reshape_concat,
            _fuse_split_and_group_gemm,
            # Common passes:
            _fuse_strided_op_and_view_op,
            _fuse_strided_op_and_cat,
            _fuse_split_and_strided_op,
            # make sure this pass runs after _fuse_strided_op_and_cat
            _fuse_slice_and_strided_op,
            # TODO: Remove this pass after we support general strides with input_accessors
            _fuse_slices_concat,
            # TODO: Remove group_gemm passes after group_gemm shape inference is fixed.
            _fuse_group_gemm_reshape_cat,
        ]
    else:
        funcs = [
            # Keep on ROCM
            _fuse_strided_op_and_view_op,
            _fuse_split_and_strided_op,
            _fuse_slices_concat,
        ]
    for func in funcs:
        sorted_graph = func(sorted_graph)
    return sorted_graph
Add strided inputs / outputs to ops to avoid unnecessary data movement.
python/aitemplate/compiler/transform/transform_strided_ops.py