Skip to content

Implement scheme for custom arm_pass_manager insertions (#16396)#16396

Merged
meta-codesync[bot] merged 1 commit intomainfrom
export-D87120925
Mar 17, 2026
Merged

Implement scheme for custom arm_pass_manager insertions (#16396)#16396
meta-codesync[bot] merged 1 commit intomainfrom
export-D87120925

Conversation

@3l1
Copy link
Contributor

@3l1 3l1 commented Dec 25, 2025

Summary:

Implement scheme for custom arm_pass_manager + ...

bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925

@3l1 3l1 requested a review from digantdesai as a code owner December 25, 2025 18:50
@pytorch-bot
Copy link

pytorch-bot bot commented Dec 25, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 2e23d86 with merge base d0820e1 (image):
💚 Looks good so far! There are no failures yet. 💚

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 Dec 25, 2025
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Dec 25, 2025

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

Copy link
Contributor

@digantdesai digantdesai left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@3l1
Copy link
Contributor Author

3l1 commented Dec 25, 2025

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot bot added the release notes: none Do not include this in the release notes label Dec 25, 2025
@3l1
Copy link
Contributor Author

3l1 commented Dec 25, 2025

NOTE: I have pending changes before merging !!

facebook-github-bot pushed a commit that referenced this pull request Jan 13, 2026
Summary:


Dual LUT Strategy (from Bolt reference)
1. **Range LUT**: Covers full int16 range, LOW resolution at small values
2. **Resolution LUT**: Scaled input (x*128), HIGH resolution for codes 0-256

 Interpolation Weights
- **x <= 255**: Use resolution_lut (high accuracy for small values)
- **x >= 256**: Use range_lut (works fine for large values)
- **Transition at 255/256** to avoid interpolation artifacts

Buck Build Fixes
- Created TARGETS file in `/fb` subdirectory to enable Buck discovery
- Restructured parent TARGETS to break circular dependency (core → fb, passes → core + fb)
- Fixed Python circular import by importing directly from module files

Next Steps

- Full test suite validation
- Performance benchmarking
- Reduce number of rescale ops

Reviewed By: digantdesai

Differential Revision: D87120925
facebook-github-bot pushed a commit that referenced this pull request Jan 27, 2026
Summary:


Port of Dual LUT Strategy (from Bolt reference) to increase reciprocal/rsqrt numerics

1. **Range LUT**: Covers full int16 range, LOW resolution at small values
2. **Resolution LUT**: Scaled input (x*128), HIGH resolution for codes 0-256

 Interpolation Weights
- **x <= 255**: Use resolution_lut (high accuracy for small values)
- **x >= 256**: Use range_lut (works fine for large values)
- **Transition at 255/256** to avoid interpolation artifacts

Reviewed By: digantdesai

Differential Revision: D87120925
facebook-github-bot pushed a commit that referenced this pull request Jan 27, 2026
Summary:


Port of Dual LUT Strategy (from Bolt reference) to increase reciprocal/rsqrt numerics

1. **Range LUT**: Covers full int16 range, LOW resolution at small values
2. **Resolution LUT**: Scaled input (x*128), HIGH resolution for codes 0-256

 Interpolation Weights
- **x <= 255**: Use resolution_lut (high accuracy for small values)
- **x >= 256**: Use range_lut (works fine for large values)
- **Transition at 255/256** to avoid interpolation artifacts

Reviewed By: digantdesai

Differential Revision: D87120925
facebook-github-bot pushed a commit that referenced this pull request Jan 27, 2026
Summary:


Port of Dual LUT Strategy (from Bolt reference) to increase reciprocal/rsqrt numerics

1. **Range LUT**: Covers full int16 range, LOW resolution at small values
2. **Resolution LUT**: Scaled input (x*128), HIGH resolution for codes 0-256

 Interpolation Weights
- **x <= 255**: Use resolution_lut (high accuracy for small values)
- **x >= 256**: Use range_lut (works fine for large values)
- **Transition at 255/256** to avoid interpolation artifacts

Reviewed By: digantdesai

Differential Revision: D87120925
facebook-github-bot pushed a commit that referenced this pull request Jan 27, 2026
Summary:


Port of Dual LUT Strategy (from Bolt reference) to increase reciprocal/rsqrt numerics

1. **Range LUT**: Covers full int16 range, LOW resolution at small values
2. **Resolution LUT**: Scaled input (x*128), HIGH resolution for codes 0-256

 Interpolation Weights
- **x <= 255**: Use resolution_lut (high accuracy for small values)
- **x >= 256**: Use range_lut (works fine for large values)
- **Transition at 255/256** to avoid interpolation artifacts

Reviewed By: digantdesai

Differential Revision: D87120925
facebook-github-bot pushed a commit that referenced this pull request Jan 27, 2026
Summary:


Port of Dual LUT Strategy (from Bolt reference) to increase reciprocal/rsqrt numerics

1. **Range LUT**: Covers full int16 range, LOW resolution at small values
2. **Resolution LUT**: Scaled input (x*128), HIGH resolution for codes 0-256

 Interpolation Weights
- **x <= 255**: Use resolution_lut (high accuracy for small values)
- **x >= 256**: Use range_lut (works fine for large values)
- **Transition at 255/256** to avoid interpolation artifacts

Reviewed By: digantdesai

Differential Revision: D87120925
facebook-github-bot pushed a commit that referenced this pull request Jan 27, 2026
Summary:


Port of Dual LUT Strategy (from Bolt reference) to increase reciprocal/rsqrt numerics

1. **Range LUT**: Covers full int16 range, LOW resolution at small values
2. **Resolution LUT**: Scaled input (x*128), HIGH resolution for codes 0-256

 Interpolation Weights
- **x <= 255**: Use resolution_lut (high accuracy for small values)
- **x >= 256**: Use range_lut (works fine for large values)
- **Transition at 255/256** to avoid interpolation artifacts


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
facebook-github-bot pushed a commit that referenced this pull request Feb 5, 2026
Summary:


Port of Dual LUT Strategy (from Bolt reference) to increase reciprocal/rsqrt numerics

1. **Range LUT**: Covers full int16 range, LOW resolution at small values
2. **Resolution LUT**: Scaled input (x*128), HIGH resolution for codes 0-256

 Interpolation Weights
- **x <= 255**: Use resolution_lut (high accuracy for small values)
- **x >= 256**: Use range_lut (works fine for large values)
- **Transition at 255/256** to avoid interpolation artifacts


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
facebook-github-bot pushed a commit that referenced this pull request Feb 6, 2026
Summary:


Port of Dual LUT Strategy (from Bolt reference) to increase reciprocal/rsqrt numerics

1. **Range LUT**: Covers full int16 range, LOW resolution at small values
2. **Resolution LUT**: Scaled input (x*128), HIGH resolution for codes 0-256

 Interpolation Weights
- **x <= 255**: Use resolution_lut (high accuracy for small values)
- **x >= 256**: Use range_lut (works fine for large values)
- **Transition at 255/256** to avoid interpolation artifacts


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
@3l1 3l1 changed the title Implement dual LUT scheme for int16 reciprocal/rsqrt operations Implement scheme for custom arm_pass_manager - Feb 6, 2026
@3l1 3l1 changed the title Implement scheme for custom arm_pass_manager - Implement scheme for custom arm_pass_manager + ... Feb 6, 2026
meta-codesync bot pushed a commit that referenced this pull request Mar 3, 2026
Summary:

Implement scheme for custom arm_pass_manager 


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
@meta-codesync meta-codesync bot force-pushed the export-D87120925 branch from 3a36881 to 5c64e51 Compare March 3, 2026 17:29
3l1 added a commit that referenced this pull request Mar 3, 2026
Summary:
Pull Request resolved: #16396

Implement scheme for custom arm_pass_manager

bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
@3l1 3l1 force-pushed the export-D87120925 branch from 5c64e51 to 608d34e Compare March 3, 2026 17:30
meta-codesync bot pushed a commit that referenced this pull request Mar 3, 2026
Summary:

Implement scheme for custom arm_pass_manager 


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
@meta-codesync meta-codesync bot force-pushed the export-D87120925 branch from 608d34e to 913af5f Compare March 3, 2026 17:30
3l1 added a commit that referenced this pull request Mar 3, 2026
Summary:
Pull Request resolved: #16396

Implement scheme for custom arm_pass_manager

bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
@3l1 3l1 force-pushed the export-D87120925 branch from 913af5f to 54740da Compare March 3, 2026 17:39
meta-codesync bot pushed a commit that referenced this pull request Mar 3, 2026
Summary:

Implement scheme for custom arm_pass_manager 


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
@meta-codesync meta-codesync bot force-pushed the export-D87120925 branch from 54740da to a2a811c Compare March 3, 2026 17:51
@zingo
Copy link
Collaborator

zingo commented Mar 9, 2026

Hi I see you linkrunner error is

291  295 |     def _configure_pass_insertions(self, exported_program: ExportedProgram) -> None:
291      |-        """Hook for subclasses to configure pass insertions.
292      |-Called at the STARTof pipeline construction, before any passes are added.
     296 |+        """Hook for subclasses to configure pass insertions.Called at the START
     297 |+of pipeline construction, before any passes are added.
294  298 | 

I think this was fixed recently You probably need to rebase it. Ill try to rebase rebasing it here to check but you might get meta internal mismatch, let see if so you need to do it on oyr side or re-sync internal version.

@robell
Copy link
Collaborator

robell commented Mar 9, 2026

hi @3l1 - I'm hoping to use this feature for some changes I'm making - are you aiming to get it in soon? Thanks.

meta-codesync bot pushed a commit that referenced this pull request Mar 12, 2026
Summary:


Implement scheme for custom arm_pass_manager + ...


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
meta-codesync bot pushed a commit that referenced this pull request Mar 12, 2026
Summary:


Implement scheme for custom arm_pass_manager + ...


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
@meta-codesync meta-codesync bot changed the title Arm backend: Implement scheme for custom arm_pass_manager insertions Implement scheme for custom arm_pass_manager insertions (#16396) Mar 12, 2026
meta-codesync bot pushed a commit that referenced this pull request Mar 12, 2026
Summary:


Implement scheme for custom arm_pass_manager + ...


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
meta-codesync bot pushed a commit that referenced this pull request Mar 13, 2026
Summary:


Implement scheme for custom arm_pass_manager + ...


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
meta-codesync bot pushed a commit that referenced this pull request Mar 13, 2026
Summary:


Implement scheme for custom arm_pass_manager + ...


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
@zingo zingo changed the title Implement scheme for custom arm_pass_manager insertions (#16396) Arm backend: Implement scheme for custom arm_pass_manager insertions (#16396) Mar 13, 2026
@zingo zingo changed the title Arm backend: Implement scheme for custom arm_pass_manager insertions (#16396) Implement scheme for custom arm_pass_manager insertions (#16396) Mar 13, 2026
@zingo zingo changed the title Implement scheme for custom arm_pass_manager insertions (#16396) Arm backend: Implement scheme for custom arm_pass_manager insertions (#16396) Mar 13, 2026
@zingo
Copy link
Collaborator

zingo commented Mar 13, 2026

@SS-JIA / @digantdesai this has a conflicting internal Meta version stopping merge, would it be OK to re-import, thanks for the help :)

meta-codesync bot pushed a commit that referenced this pull request Mar 14, 2026
Summary:


Implement scheme for custom arm_pass_manager + ...


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
@@ -1,13 +1,56 @@
load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not available in the shims. For other uses, I guess they are in the .bzl file which is lazily loaded and never loaded in OSS? How about doing something like this,

diff --git a/backends/arm/_passes/TARGETS b/backends/arm/_passes/TARGETS
index e782018f6c..5473ffdec4 100644
--- a/backends/arm/_passes/TARGETS
+++ b/backends/arm/_passes/TARGETS
@@ -1,4 +1,3 @@
-load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode")
 load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")

 runtime.python_library(
@@ -35,7 +34,7 @@ runtime.python_library(
     srcs = [],
     deps = [
         ":arm_pass_manager_base",
-        "//executorch/backends/arm/_passes/fb:fb",
+        # @oss-disable: "//executorch/backends/arm/_passes/fb:fb",
     ],
 )

@@ -48,7 +47,7 @@ runtime.python_library(
     ]),
     deps = [
         ":core",
-        ":arm_pass_manager_fb" if is_fbcode else ":arm_pass_manager_base",
+        ":arm_pass_manager_base" if runtime.is_oss else ":arm_pass_manager_fb",
         "//executorch/backends/arm/tosa:utils",
         "//executorch/backends/arm/tosa/dialect:lib",
         "//executorch/backends/transforms:fuse_view_copy",
diff --git a/backends/arm/test/targets.bzl b/backends/arm/test/targets.bzl
index bc7cf84808..c81413ce0f 100644
--- a/backends/arm/test/targets.bzl
+++ b/backends/arm/test/targets.bzl
@@ -1,5 +1,5 @@
 # load("//caffe2/test/fb:defs.bzl", "define_tests")
-load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_fbcode")
+load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
 load("@fbcode_macros//build_defs:python_pytest.bzl", "python_pytest")
 load("@bazel_skylib//lib:paths.bzl", "paths")

@@ -67,7 +67,7 @@ def define_arm_tests():
                 "//executorch/kernels/quantized:custom_ops_generated_lib",
             ],
             deps = [
-                "//executorch/backends/arm/test/tester/fb:arm_tester_fb" if is_fbcode else "//executorch/backends/arm/test:arm_tester",
+                "//executorch/backends/arm/test:arm_tester" if runtime.is_oss else "//executorch/backends/arm/test/tester/fb:arm_tester_fb",
                 "//executorch/backends/arm/test:conftest",
                 "//executorch/backends/arm/test/misc:dw_convs_shared_weights_module",
                 "//executorch/backends/arm:ethosu",

Summary:


Implement scheme for custom arm_pass_manager + ...


bypass-github-export-checks
bypass-github-pytorch-ci-checks
bypass-github-executorch-ci-checks

Reviewed By: digantdesai, Ninja91

Differential Revision: D87120925
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants