Skip to content

[TorchToTosa] Support flattened index_put updates in TOSA lowering#4561

Open
ahagro01 wants to merge 2 commits intollvm:mainfrom
ahagro01:scatternd-flattened-updates
Open

[TorchToTosa] Support flattened index_put updates in TOSA lowering#4561
ahagro01 wants to merge 2 commits intollvm:mainfrom
ahagro01:scatternd-flattened-updates

Conversation

@ahagro01
Copy link
Copy Markdown
Contributor

@ahagro01 ahagro01 commented May 6, 2026

Fixes TOSA lowering for index_put/scatter updates when the update tensor is already flattened.

Previously, fillK was computed from only the first ND dimensions of fillValues, which assumes updates still follow the indexed tensor shape. Flattened updates break that assumption and can produce invalid reshape/scatter shapes.

The fix derives fillK from the total number of update elements with a divisibility check. This supports both shaped and flattened updates while preserving the existing {N, fillK, C} scatter form. A regression test was added for flattened torch.aten.index_put.hacked_twin updates.

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