Skip to content

Reduce code duplication in contiguous.rs prepare functions #120

@shinaoka

Description

@shinaoka

Summary

strided-einsum2/src/contiguous.rs has 6 nearly identical prepare_* functions:

  • prepare_input_view, prepare_input_owned
  • prepare_output_view, prepare_output_owned
  • (plus backend-generic variants)

All follow the same pattern: extract dims/strides → try_fuse_group() twice → check REQUIRES_UNIT_STRIDE → conditionally copy via HPTT.

Proposal

Consolidate into 2 core functions (prepare_input, prepare_output) with ownership kind as a parameter. Estimated ~200 lines reduction.

Risk

Low. The splitting is purely organizational; semantics remain identical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions