Support whole-number float exponents in ReplacePowWithMulPass (#18851)#18851
Support whole-number float exponents in ReplacePowWithMulPass (#18851)#18851khazaei wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18851
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ⏳ 2 Pending, 2 Unrelated FailuresAs of commit db78fae with merge base 75c677f ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@khazaei has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100695654. |
This PR needs a
|
cc464b5 to
9b8346e
Compare
…h#18851) Summary: Extend `ReplacePowWithMulPass` to accept float exponents that are whole numbers (e.g., 2.0, 3.0, 4.0) in addition to integer exponents. Previously the pass only matched `int` typed exponents, causing it to miss valid optimization opportunities when the exponent was a float with no fractional part. Changes: - Broaden the type check from `isinstance(_, int)` to `isinstance(_, (int, float))` - Add a guard to reject non-whole-number floats (e.g., 1.5, 0.5) - Convert validated float exponents to `int` before proceeding - Update docstring to document the new behavior Reviewed By: hsharma35, mcremon-meta Differential Revision: D100695654
…h#18851) Summary: Extend `ReplacePowWithMulPass` to accept float exponents that are whole numbers (e.g., 2.0, 3.0, 4.0) in addition to integer exponents. Previously the pass only matched `int` typed exponents, causing it to miss valid optimization opportunities when the exponent was a float with no fractional part. Changes: - Broaden the type check from `isinstance(_, int)` to `isinstance(_, (int, float))` - Add a guard to reject non-whole-number floats (e.g., 1.5, 0.5) - Convert validated float exponents to `int` before proceeding - Update docstring to document the new behavior Reviewed By: hsharma35, mcremon-meta Differential Revision: D100695654
9b8346e to
e6267b1
Compare
…h#18851) Summary: Pull Request resolved: pytorch#18851 Extend `ReplacePowWithMulPass` to accept float exponents that are whole numbers (e.g., 2.0, 3.0, 4.0) in addition to integer exponents. Previously the pass only matched `int` typed exponents, causing it to miss valid optimization opportunities when the exponent was a float with no fractional part. Changes: - Broaden the type check from `isinstance(_, int)` to `isinstance(_, (int, float))` - Add a guard to reject non-whole-number floats (e.g., 1.5, 0.5) - Convert validated float exponents to `int` before proceeding - Update docstring to document the new behavior Reviewed By: hsharma35, mcremon-meta Differential Revision: D100695654
e6267b1 to
6b1da40
Compare
…h#18851) Summary: Pull Request resolved: pytorch#18851 Extend `ReplacePowWithMulPass` to accept float exponents that are whole numbers (e.g., 2.0, 3.0, 4.0) in addition to integer exponents. Previously the pass only matched `int` typed exponents, causing it to miss valid optimization opportunities when the exponent was a float with no fractional part. Changes: - Broaden the type check from `isinstance(_, int)` to `isinstance(_, (int, float))` - Add a guard to reject non-whole-number floats (e.g., 1.5, 0.5) - Convert validated float exponents to `int` before proceeding - Update docstring to document the new behavior Reviewed By: hsharma35, mcremon-meta Differential Revision: D100695654
6b1da40 to
db78fae
Compare
Summary:
Extend
ReplacePowWithMulPassto accept float exponents that are whole numbers(e.g., 2.0, 3.0, 4.0) in addition to integer exponents. Previously the pass only
matched
inttyped exponents, causing it to miss valid optimization opportunitieswhen the exponent was a float with no fractional part.
Changes:
isinstance(_, int)toisinstance(_, (int, float))intbefore proceedingReviewed By: hsharma35, mcremon-meta
Differential Revision: D100695654