[devtools] Add reference_graph parameter to calculate_numeric_gap#17459
[devtools] Add reference_graph parameter to calculate_numeric_gap#17459Gasoonjia merged 5 commits intogh/gasoonjia/121/basefrom
Conversation
This change adds a `reference_graph` parameter to the `calculate_numeric_gap` API, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17459
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 Cancelled JobAs of commit 099ec34 with merge base 63f9724 ( CANCELLED JOB - The following job was cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This change adds a `reference_graph` parameter to the `calculate_numeric_gap` API, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/) ghstack-source-id: 341228298 Pull Request resolved: #17459
This PR needs a
|
…ric_gap" This change adds a `reference_graph` parameter to the `calculate_numeric_gap` API, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/) [ghstack-poisoned]
Pull Request resolved: #17459 This change adds a `reference_graph` parameter to the `calculate_numeric_gap` API, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/) ghstack-source-id: 341245956
winskuo-quic
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the PR.
…ric_gap" This change adds a `reference_graph` parameter to the `calculate_numeric_gap` API, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/) [ghstack-poisoned]
Pull Request resolved: #17459 This change adds a `reference_graph` parameter to the `calculate_numeric_gap` API, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud ghstack-source-id: 344105834 Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/)
…ric_gap" This change adds a `reference_graph` parameter to the `calculate_numeric_gap` API, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/) [ghstack-poisoned]
Pull Request resolved: #17459 This change adds a `reference_graph` parameter to the `calculate_numeric_gap` API, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud ghstack-source-id: 344454839 Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/)
…ric_gap" This change adds a `reference_graph` parameter to the `calculate_numeric_gap` API, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/) [ghstack-poisoned]
Pull Request resolved: #17459 This change adds a `reference_graph` parameter to the `calculate_numeric_gap` API, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud ghstack-source-id: 344497033 Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/)
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * #17459 * #17434 * __->__ #17433 This change extends NumericalComparatorBase to support custom preprocessing before numeric gap calculation, enabling backends like Qualcomm to apply necessary tensor transformations (e.g., dequantization, layout conversion) before comparison. Key changes: - Extended NumericalComparatorBase with: - `__init__(inspector)` to store optional Inspector reference for accessing graph metadata - `preprocessing(mapping)` method that can be overridden for custom tensor transformations (default: identity) - `element_compare(a, b)` abstract method for element-level tensor comparison - `compare(mapping, ...)` method that orchestrates the full pipeline: preprocessing → element-wise compare → aggregate to DataFrame This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud Differential Revision: [D93169813](https://our.internmc.facebook.com/intern/diff/D93169813/)
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * #17459 * __->__ #17434 * #17433 When `to_edge_transform_and_lower` is called with `generate_etrecord=True` and custom `transform_passes` are applied, the after-transform graph is now automatically recorded in the ETRecord's `graph_map` under the key `"edge_after_transform"`. This enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation, while have zero impact for regular exportation. This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381). Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud Differential Revision: [D93176563](https://our.internmc.facebook.com/intern/diff/D93176563/)
…7697) This PR was created by the merge bot to help merge the original PR into the main branch. ghstack PR number: #17459 by @Gasoonjia ^ Please use this as the source of truth for the PR details, comments, and reviews ghstack PR base: https://github.com/pytorch/executorch/tree/gh/gasoonjia/121/base ghstack PR head: https://github.com/pytorch/executorch/tree/gh/gasoonjia/121/head Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/gasoonjia/120/orig Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/gasoonjia/121/orig Differential Revision: [D93266779](https://our.internmc.facebook.com/intern/diff/D93266779/) @diff-train-skip-merge Co-authored-by: gasoonjia <gasoonjia@icloud.com>
Stack from ghstack (oldest at bottom):
This change adds a
reference_graphparameter to thecalculate_numeric_gapAPI, allowing users to explicitly select which graph to use as the golden reference for numeric gap calculation, which enables backends like Qualcomm to use the post-custom-transform graph as the golden reference for numeric gap calculation.This is part of the operator-level numeric discrepancy detector project for ExecuTorch Qualcomm backend (#16381).
Design doc: https://docs.google.com/document/d/1GaCHiy9InytOsUrl2BKEgOiP1iKTfpCVdWg6QDh0N2E/edit?tab=t.0#heading=h.fcrpnrtb6cud
Differential Revision: D93266779