Skip to content

Keep a folded int8 dtype through every retrace (#24239) - #24239

Merged
meta-codesync[bot] merged 1 commit into
pytorch:mainfrom
pssrawat:export-D128001102
Oct 29, 2026
Merged

meta-codesync[bot] merged 1 commit into
pytorch:mainfrom
pssrawat:export-D128001102

Conversation

@pssrawat

@pssrawat pssrawat commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Once Q/DQ is folded, the LUT activations (tanh, sigmoid, silu, gelu, log*, sqrt, rsqrt) and div take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., ValidateCortexMExplicitLayoutPass rejects a convolution behind tanh.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until AtenToCortexMPass, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102

@pssrawat
pssrawat requested a review from rascani as a code owner October 28, 2026 15:33
@pytorch-bot

pytorch-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 New Failure, 1 Unrelated Failure

As of commit 8d2f9d6 with merge base 14b5e1d (image):

NEW FAILURE - The following job has failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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 Oct 28, 2026
@meta-codesync

meta-codesync Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

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

@pssrawat pssrawat added the release notes: none Do not include this in the release notes label Oct 28, 2026
pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 28, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102
@meta-codesync meta-codesync Bot changed the title Keep a folded int8 dtype through every retrace Keep a folded int8 dtype through every retrace (#24239) Oct 28, 2026
pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 28, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102
pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 28, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102
pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 29, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102
pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 29, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102
pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 29, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102
pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 29, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102
@AdrianLundell

Copy link
Copy Markdown
Collaborator

Thanks, looks good to me when CI passes. Hopefully this can just be temporary and the Aten kernels can be fixed to remain in int8 at some point.

Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102
pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 29, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102
pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 29, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102
pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 29, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Differential Revision: D128001102

@rascani rascani left a comment

Copy link
Copy Markdown
Contributor

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.

pssrawat added a commit to pssrawat/executorch that referenced this pull request Oct 29, 2026
Summary:

Once Q/DQ is folded, the LUT activations (`tanh`, `sigmoid`, `silu`, `gelu`, `log*`, `sqrt`, `rsqrt`) and `div` take int8, but their ATen fake kernels promote it to float. Every pass retraces the graph, so each retrace labels these ops, and every view, permute, clamp and layout copy behind them. The dtype-based checks downstream then decline tensors that are int8 on device: e.g., `ValidateCortexMExplicitLayoutPass` rejects a convolution behind `tanh`.

Fix the dtype during tracing, as the Arm backend does for ops whose fake kernel cannot handle quantized inputs. For these ops, when a node carries output qparams, the retrace takes its output dtype from them instead of from the fake kernel. Every pass that rebuilds the graph recomputes these types, and most passes in the Cortex-M lists are shared passes that don't know about this fix. So CortexMPassManager attaches it to every pass it runs. The one exception is AtenToCortexMPass, which replaces these ops with Cortex-M kernels that already report int8.

The ops stay ATen until `AtenToCortexMPass`, and permute and layout-copy substitution still reads only the fake-tensor dtype, so an int8 graph that was never quantized lowers too.

Authored with an AI coding assistant (Claude).

Reviewed By: rascani

Differential Revision: D128001102
@meta-codesync
meta-codesync Bot merged commit e0855ac into pytorch:main Oct 29, 2026
342 of 346 checks passed
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. meta-exported release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants