Skip to content

[optimization] Implement RemoveRedundantLayoutOpsPass - #842

Merged
mhs4670go merged 3 commits into
Samsung:mainfrom
mhs4670go:pas
Jul 27, 2026
Merged

[optimization] Implement RemoveRedundantLayoutOpsPass#842
mhs4670go merged 3 commits into
Samsung:mainfrom
mhs4670go:pas

Conversation

@mhs4670go

Copy link
Copy Markdown
Contributor

Introduce the optimization pass that removes redundant Reshape and Transpose operations.

Related: #829
TICO-DCO-1.0-Signed-off-by: seongwoo mhs4670go@naver.com

Introduce the optimization pass that removes redundant Reshape and Transpose operations.

TICO-DCO-1.0-Signed-off-by: seongwoo <mhs4670go@naver.com>
@mhs4670go
mhs4670go requested a review from a team July 27, 2026 05:10

@shs-park shs-park left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI found one or more actionable issues in this PR.
Please check the inline comments when present.

Reviewed by AI via personal agents

if _check_perm(perm_data, producer_perm_data):
# The two transposes cancel out, connect to producer's input
main_input = producer_inputs[0]
transpose_op.inputs = [main_input] + list(inputs[1:])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inverse transposes are not actually cancelled because the surviving transpose_op keeps its original permutation input.

For Transpose([1,0]) -> Transpose([1,0]), this rewires the second op to produce Transpose(input, [1,0]) instead of the original input, changing model outputs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I've resolved that problem. PTAL:)

@mhs4670go
mhs4670go requested a review from shs-park July 27, 2026 07:53
@shs-park

Copy link
Copy Markdown
Contributor

This PR is too large for the default AI review.

  • Changed files: 19
  • Reviewable changed files: 17
  • Diff lines: 961

Please split the change or request a narrower follow-up review.

Reviewed by AI via personal agents

@shs-park shs-park left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
=)

@mhs4670go
mhs4670go merged commit d0bbfeb into Samsung:main Jul 27, 2026
7 checks passed
@mhs4670go
mhs4670go deleted the pas branch July 27, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants