Skip to content

Avoid inferred expand_shape in unflatten lowering#4565

Open
KyleHerndon wants to merge 1 commit into
llvm:mainfrom
KyleHerndon:kh/fix-unflatten-explicit-shape
Open

Avoid inferred expand_shape in unflatten lowering#4565
KyleHerndon wants to merge 1 commit into
llvm:mainfrom
KyleHerndon:kh/fix-unflatten-explicit-shape

Conversation

@KyleHerndon

@KyleHerndon KyleHerndon commented May 8, 2026

Copy link
Copy Markdown
Contributor

This fixes a use-after-free in ConvertAtenUnflattenIntOp by avoiding the tensor.expand_shape builder overload that infers the output shape from the source tensor. During dialect conversion, that inference can create/fold arithmetic using stale IR when the framework has already replaced/erased related operations.

Instead, the lowering now computes the mixed output shape explicitly from the converted input, result type, and unflatten sizes, and passes it to tensor.expand_shape.

Verification:

  • clang-format
  • git diff --check

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.

1 participant