Skip to content

Cache param/buffer/constant names in RemovePermutesAroundElementwiseTosaOps (#22164) - #22164

Merged
meta-codesync[bot] merged 1 commit into
pytorch:mainfrom
apullin:export-D114224782
Aug 28, 2026
Merged

Cache param/buffer/constant names in RemovePermutesAroundElementwiseTosaOps (#22164)#22164
meta-codesync[bot] merged 1 commit into
pytorch:mainfrom
apullin:export-D114224782

Conversation

@apullin

@apullin apullin commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary:

RemovePermutesAroundElementwiseTosaOps._is_constant called is_param_node() for every node reached during recursive visit() walk. Each is_param_node rebuilds immutable dict over full input_specs via uncached graph_signature properties. This made pass O(nodes * inputs). Precompute the union of param/buffer/lifted-constant placeholder names once per pass invocation in call() and use O(1) set membership. Refreshing it at invocation time tracks the current ExportedProgram when a pass instance is reused. Semantics unchanged.

On an ensemble network of ~1M parameters, lowering produced identical output while running 10.5 seconds faster (2.7%).

Differential Revision: D114224782

@apullin
apullin requested a review from digantdesai as a code owner August 25, 2026 21:16
@pytorch-bot

pytorch-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22164

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 2 Pending

As of commit 0a8bc0a with merge base ff679f5 (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 25, 2026
@meta-codesync

meta-codesync Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@apullin has exported this pull request. If you are a Meta employee, you can view the originating Diff in D114224782.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@meta-codesync meta-codesync Bot changed the title Cache param/buffer/constant names in RemovePermutesAroundElementwiseTosaOps Cache param/buffer/constant names in RemovePermutesAroundElementwiseTosaOps (#22164) Aug 27, 2026
apullin added a commit to apullin/executorch that referenced this pull request Aug 27, 2026
…osaOps (pytorch#22164)

Summary:

`RemovePermutesAroundElementwiseTosaOps._is_constant` called `is_param_node()` for every node reached during recursive `visit()` walk. Each `is_param_node` rebuilds immutable dict over full input_specs via uncached graph_signature properties. This made pass O(nodes * inputs). Precompute union of param/buffer/lifted-constant placeholder names once in `__init__` and use O(1) set membership. Semantics unchanged.

Differential Revision: D114224782
@apullin
apullin force-pushed the export-D114224782 branch from adbba66 to fc5b29a Compare August 27, 2026 15:13
apullin added a commit to apullin/executorch that referenced this pull request Aug 27, 2026
…osaOps (pytorch#22164)

Summary:

`RemovePermutesAroundElementwiseTosaOps._is_constant` called `is_param_node()` for every node reached during recursive `visit()` walk. Each `is_param_node` rebuilds immutable dict over full input_specs via uncached graph_signature properties. This made pass O(nodes * inputs). Precompute union of param/buffer/lifted-constant placeholder names once in `__init__` and use O(1) set membership. Semantics unchanged.

Differential Revision: D114224782
@apullin
apullin force-pushed the export-D114224782 branch 2 times, most recently from ca334bb to 4d6cdeb Compare August 27, 2026 21:58
apullin added a commit to apullin/executorch that referenced this pull request Aug 27, 2026
…osaOps (pytorch#22164)

Summary:

`RemovePermutesAroundElementwiseTosaOps._is_constant` called `is_param_node()` for every node reached during recursive `visit()` walk. Each `is_param_node` rebuilds immutable dict over full input_specs via uncached graph_signature properties. This made pass O(nodes * inputs). Precompute the union of param/buffer/lifted-constant placeholder names once per pass invocation in `call()` and use O(1) set membership. Refreshing it at invocation time tracks the current `ExportedProgram` when a pass instance is reused. Semantics unchanged.

Differential Revision: D114224782
@apullin
apullin requested review from JakeStevens and rascani August 27, 2026 21:59
@apullin
apullin force-pushed the export-D114224782 branch from 4d6cdeb to 90268dd Compare August 28, 2026 15:01
apullin added a commit to apullin/executorch that referenced this pull request Aug 28, 2026
…osaOps (pytorch#22164)

Summary:

`RemovePermutesAroundElementwiseTosaOps._is_constant` called `is_param_node()` for every node reached during recursive `visit()` walk. Each `is_param_node` rebuilds immutable dict over full input_specs via uncached graph_signature properties. This made pass O(nodes * inputs). Precompute the union of param/buffer/lifted-constant placeholder names once per pass invocation in `call()` and use O(1) set membership. Refreshing it at invocation time tracks the current `ExportedProgram` when a pass instance is reused. Semantics unchanged.

Differential Revision: D114224782
apullin added a commit to apullin/executorch that referenced this pull request Aug 28, 2026
…osaOps (pytorch#22164)

Summary:

`RemovePermutesAroundElementwiseTosaOps._is_constant` called `is_param_node()` for every node reached during recursive `visit()` walk. Each `is_param_node` rebuilds immutable dict over full input_specs via uncached graph_signature properties. This made pass O(nodes * inputs). Precompute the union of param/buffer/lifted-constant placeholder names once per pass invocation in `call()` and use O(1) set membership. Refreshing it at invocation time tracks the current `ExportedProgram` when a pass instance is reused. Semantics unchanged.

Differential Revision: D114224782
@apullin
apullin force-pushed the export-D114224782 branch from 90268dd to 4113e2d Compare August 28, 2026 15:22
…osaOps (pytorch#22164)

Summary:

`RemovePermutesAroundElementwiseTosaOps._is_constant` called `is_param_node()` for every node reached during recursive `visit()` walk. Each `is_param_node` rebuilds immutable dict over full input_specs via uncached graph_signature properties. This made pass O(nodes * inputs). Precompute the union of param/buffer/lifted-constant placeholder names once per pass invocation in `call()` and use O(1) set membership. Refreshing it at invocation time tracks the current `ExportedProgram` when a pass instance is reused. Semantics unchanged.

On an ensemble network of ~1M parameters, lowering produced identical output while running 10.5 seconds faster (2.7%).

Differential Revision: D114224782
@apullin
apullin force-pushed the export-D114224782 branch from 4113e2d to 0a8bc0a Compare August 28, 2026 15:56
@meta-codesync
meta-codesync Bot merged commit 60ec827 into pytorch:main Aug 28, 2026
504 of 507 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported module: arm Issues related to arm backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants