-
Notifications
You must be signed in to change notification settings - Fork 963
Add export_llama performance regression test using expected ops #9158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
affe92d
Fix pre-autograd transforms not getting persisted during xnnpack export
jackzhxng 9978148
Graph module as SOT
jackzhxng 537458b
Add perf proxy regression test using expected ops
jackzhxng c5ed931
Merge branch 'main' into jz/regression-test-llama-perf
jackzhxng f125d74
Only check unwanted ops
jackzhxng 945a203
Merge branch 'main' into jz/regression-test-llama-perf
jackzhxng 785904b
Tarun pr rev / fix test
jackzhxng 2f18046
Fix test
jackzhxng e11ddec
Lint
jackzhxng 792c295
Revert model args default changes
jackzhxng 134fd29
Merge branch 'main' into jz/regression-test-llama-perf
jackzhxng 4752fa6
Merge branch 'main' into jz/regression-test-llama-perf
jackzhxng cdda3cc
Test
jackzhxng 2b642a1
Merge branch 'main' into jz/regression-test-llama-perf
jackzhxng 3887bbe
Try fix test
jackzhxng 8ca7e05
Merge branch 'main' into jz/regression-test-llama-perf
jackzhxng 68e5722
Merge branch 'main' into jz/regression-test-llama-perf
jackzhxng ebfa760
Fix Llava
jackzhxng 54cd638
Small change to retrigger meta internal sync CI
jackzhxng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Copyright (c) Meta Platforms, Inc. and affiliates. | ||
| # All rights reserved. | ||
| # | ||
| # This source code is licensed under the BSD-style license found in the | ||
| # LICENSE file in the root directory of this source tree. | ||
|
|
||
| import unittest | ||
|
|
||
| from executorch.devtools.backend_debug import get_delegation_info | ||
| from executorch.examples.models.llama.export_llama_lib import ( | ||
| _export_llama, | ||
| build_args_parser, | ||
| ) | ||
|
|
||
| UNWANTED_OPS = [ | ||
| "aten_permute_copy_default", | ||
| "aten_transpose_copy_default", | ||
| ] | ||
|
|
||
|
|
||
| class ExportLlamaLibTest(unittest.TestCase): | ||
| def test_has_expected_ops_and_op_counts(self): | ||
| """ | ||
| Checks the presence of unwanted expensive ops. | ||
|
|
||
| Serves as a proxy for a performance regression test, as performance | ||
| is directly tied to which and how many of each ops are in the graph. | ||
|
|
||
| If this test breaks, please ensure that the difference in ops | ||
| is intentional before updating the expected ops. | ||
| """ | ||
| # Since we aren't loading a checkpoint, it doesn't | ||
| # matter what model we specify. Note that | ||
| # we cannot test quantization args in this way | ||
| # since quantization requires promoting meta tensors | ||
| # to device=cpu, which requires real weights. | ||
| parser = build_args_parser() | ||
| args = parser.parse_args([]) | ||
| args.use_sdpa_with_kv_cache = True | ||
| args.use_kv_cache = True | ||
| args.verbose = True | ||
|
|
||
| builder = _export_llama(args) | ||
| graph_module = builder.edge_manager.exported_program().graph_module | ||
| delegation_info = get_delegation_info(graph_module) | ||
|
|
||
| for op, _op_info in delegation_info.delegation_by_operator.items(): | ||
| self.assertTrue(op not in UNWANTED_OPS) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.