Skip to content

Fix memory outdated planning optimization invalidated by reshapes.#10157

Merged
copybara-service[bot] merged 1 commit intomasterfrom
test_910218321
May 6, 2026
Merged

Fix memory outdated planning optimization invalidated by reshapes.#10157
copybara-service[bot] merged 1 commit intomasterfrom
test_910218321

Conversation

@copybara-service
Copy link
Copy Markdown
Contributor

Fix memory outdated planning optimization invalidated by reshapes.

When XNNPack's memory planner finds a node that can be computed in place
because the input and output shapes are the same, it aliases the output data
pointer to the input buffer.

After a reshape, this optimization may not be valid anymore. For instance, an
input could require a broadcast and be smaller than its output: this happens in
our own test cases and was hidden by the face that the inputs and outputs were
external values (which disables the above optimization).

@copybara-service copybara-service Bot force-pushed the test_910218321 branch 3 times, most recently from c3ae1a1 to cc9f3b7 Compare May 6, 2026 10:44
When XNNPack's memory planner finds a node that can be computed in place
because the input and output shapes are the same, it aliases the output data
pointer to the input buffer.

After a reshape, this optimization may not be valid anymore. For instance, an
input could require a broadcast and be smaller than its output: this happens in
our own test cases and was hidden by the face that the inputs and outputs were
external values (which disables the above optimization).

PiperOrigin-RevId: 911271536
@copybara-service copybara-service Bot merged commit b12ed13 into master May 6, 2026
@copybara-service copybara-service Bot deleted the test_910218321 branch May 6, 2026 12:17
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