-
Notifications
You must be signed in to change notification settings - Fork 649
[Backend Tester] Add additional quantized test flows for XNNPACK and Vulkan #13534
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 250 commits
Commits
Show all changes
327 commits
Select commit
Hold shift + click to select a range
b2ab3a5
Update
GregoryComer c23c3e9
Update
GregoryComer c99c41a
Update
GregoryComer bf57d6c
Update
GregoryComer f261355
Update
GregoryComer c3a24f9
Update
GregoryComer 1697cbc
Update
GregoryComer b94b45e
Update
GregoryComer 5740f0a
Update
GregoryComer ed6840d
Update
GregoryComer f2a7e1f
Update
GregoryComer 0e162ab
Update
GregoryComer c6bd56b
Update
GregoryComer 144a8ae
Update
GregoryComer 6f85fc1
Update
GregoryComer 2439022
Update
GregoryComer bd79ef2
Update
GregoryComer 8932c29
Update
GregoryComer ea2549c
Update
GregoryComer ffaa1c3
Update
GregoryComer bba2fa9
Update
GregoryComer 3a3e026
Update
GregoryComer 2c4488f
Update
GregoryComer 491ec2b
Update
GregoryComer 375b076
Update
GregoryComer fc1c2a7
Update
GregoryComer 78086b4
Update
GregoryComer 285e058
Update
GregoryComer cfbc408
Update
GregoryComer f4b0dc2
Update
GregoryComer 5e92884
Update
GregoryComer 605a0ad
Update
GregoryComer aa27776
Update
GregoryComer 90ce443
Update
GregoryComer 67f60e4
Update
GregoryComer 1b9315e
Update
GregoryComer 54563ee
Update
GregoryComer 94d89c4
Update
GregoryComer d79d1a8
Update
GregoryComer 733d4f9
Update
GregoryComer 1e3e79c
Update
GregoryComer 6043952
Update
GregoryComer 8f476ea
Update
GregoryComer 1c136d7
Update
GregoryComer 780519f
Update
GregoryComer a62c6d0
Update
GregoryComer 7e1a002
Update
GregoryComer a628d29
Update
GregoryComer 3615d89
Update
GregoryComer e994bc1
Update
GregoryComer 0aba8e1
Update
GregoryComer 4329bf6
Update
GregoryComer 105aabc
Update
GregoryComer c1a51ee
Update
GregoryComer dd30127
Update
GregoryComer 4216805
Update
GregoryComer 092b8d1
Update
GregoryComer bd786cd
Update
GregoryComer 1d34f49
Update
GregoryComer 933fba2
Update
GregoryComer d468ae4
Update
GregoryComer acbd480
Update
GregoryComer e515bf1
Update
GregoryComer 803db00
Update
GregoryComer ab18089
Update
GregoryComer 49944fa
Update
GregoryComer 60f3932
Update
GregoryComer fe201b8
Update
GregoryComer a807a90
Update
GregoryComer 1897d4e
Update
GregoryComer f65d80f
Update
GregoryComer 0d1f097
Update
GregoryComer f0c2490
Update
GregoryComer 0046b02
Update
GregoryComer 32e1029
Update
GregoryComer f4df9c9
Update
GregoryComer 832cea5
Update
GregoryComer 40819b9
Update
GregoryComer 692f0fa
Update
GregoryComer 871312a
Update
GregoryComer 53990fe
Update
GregoryComer 567d055
Update
GregoryComer cd998cf
Update
GregoryComer 2a837ab
Update
GregoryComer 51c392a
Update
GregoryComer f066d46
Update
GregoryComer ab5415f
Update
GregoryComer e96c2ef
Update
GregoryComer 31bc137
Update
GregoryComer dae5d43
Update
GregoryComer 06b5532
Update
GregoryComer a343abc
Update
GregoryComer 778f7cd
Update
GregoryComer c19a8ea
Update
GregoryComer b4a8428
Update
GregoryComer 8aa25c7
Update
GregoryComer 637b8a2
Update
GregoryComer 7141f6c
Update
GregoryComer 4b43363
Update
GregoryComer 88d1dd3
Update
GregoryComer c583fa1
Update
GregoryComer 7ba2a7f
Update
GregoryComer e7b7975
Update
GregoryComer 29c1061
Update
GregoryComer 995c4b5
Update
GregoryComer 0fc4475
Update
GregoryComer 1fec71c
Update
GregoryComer ad8ab13
Update
GregoryComer f955b94
Update
GregoryComer 765e960
Update
GregoryComer a3c2dbe
Update
GregoryComer 1008ad4
Update
GregoryComer e94e9ae
Update
GregoryComer 0225d15
Update
GregoryComer 724e992
Update
GregoryComer 98eee4d
Update
GregoryComer ad04155
Update
GregoryComer 20574c3
Update
GregoryComer 4fd031e
Update
GregoryComer a5f702f
Update
GregoryComer 569916c
Update
GregoryComer 8303207
Update
GregoryComer 0a017d0
Update
GregoryComer b299659
Update
GregoryComer b7d4b4e
Update
GregoryComer 5a717d5
Update
GregoryComer 5fc71bd
Update
GregoryComer 55cb818
Update
GregoryComer d19e0db
Update
GregoryComer b1c89f6
Update
GregoryComer 264fc53
Update
GregoryComer 60b39ed
Update
GregoryComer 8b814bc
Update
GregoryComer ceb875b
Update
GregoryComer 600cf8a
Update
GregoryComer 6880e0b
Update
GregoryComer f27ffc1
Update
GregoryComer 6c41bd5
Update
GregoryComer 6ed39c5
Update
GregoryComer 82b83ef
Update
GregoryComer 3b737f6
Update
GregoryComer 871ea46
Update
GregoryComer f7cfc18
Update
GregoryComer 1a3844c
Update
GregoryComer d951c8a
Update
GregoryComer fe7e387
Update
GregoryComer 0dfca3b
Update
GregoryComer de1ef9a
Update
GregoryComer 70fd984
Update
GregoryComer 482c469
Update
GregoryComer 4d42d47
Update
GregoryComer 8ff7471
Update
GregoryComer ee716bc
Update
GregoryComer ac56137
Update
GregoryComer ad1ddaa
Update
GregoryComer d3553e1
Update
GregoryComer 85ceee6
Update
GregoryComer 2965ad6
Update
GregoryComer 02c2e14
Update
GregoryComer 5e34ef2
Update
GregoryComer 32a34e3
Update
GregoryComer 5038454
Update
GregoryComer 46152fb
Update
GregoryComer d76bc1a
Update
GregoryComer bd5573a
Update
GregoryComer 3f8bc4e
Update
GregoryComer 5abef0c
Update
GregoryComer f070aa4
Update
GregoryComer 1de7e98
Update
GregoryComer db6dc2b
Update
GregoryComer f944c0a
Update
GregoryComer 4d5f1d0
Update
GregoryComer c986013
Update
GregoryComer c46aa24
Update
GregoryComer 93a58c6
Update
GregoryComer e269157
Update
GregoryComer e1464a8
Update
GregoryComer d974e4a
Update
GregoryComer 16ec464
Update
GregoryComer 0498ae2
Update
GregoryComer 69eff72
Update
GregoryComer a9875c5
Update
GregoryComer e9cb12c
Update
GregoryComer c519708
Update
GregoryComer 8b8ac05
Update
GregoryComer 33c7e16
Update
GregoryComer bcb823c
Update
GregoryComer 89d18a2
Update
GregoryComer a64ed51
Update
GregoryComer f4785a5
Update
GregoryComer 77d5d14
Update
GregoryComer 8c36fd6
Update
GregoryComer 412f963
Update
GregoryComer 970a530
Update
GregoryComer 6d626f2
Update
GregoryComer 986d9f7
Update
GregoryComer ff331d1
Update
GregoryComer 83c228a
Update
GregoryComer 017d011
Update
GregoryComer 9370958
Update
GregoryComer 98a6e76
Update
GregoryComer 927d00d
Update
GregoryComer 685f5b5
Update
GregoryComer 52ca00c
Update
GregoryComer 7f15e20
Update
GregoryComer 0cadcf4
Update
GregoryComer 3f064c0
Update
GregoryComer 6bc083c
Update
GregoryComer 66ab2d6
Update
GregoryComer 4639359
Update
GregoryComer eea49a0
Update
GregoryComer 7293189
Update
GregoryComer ca2c9b2
Update
GregoryComer 2c25957
Update
GregoryComer 42a664e
Update
GregoryComer 35e5f95
Update
GregoryComer 5c820ba
Update
GregoryComer 7b04d3b
Update
GregoryComer 5cc215e
Update
GregoryComer ee7bfb3
Update
GregoryComer 014130c
Update
GregoryComer 108a284
Update
GregoryComer b8daf4e
Update
GregoryComer 2b95d42
Update
GregoryComer b7f676e
Update
GregoryComer 4457748
Update
GregoryComer 35c56cc
Update
GregoryComer 85d9244
Update
GregoryComer 4dd373e
Update
GregoryComer 6b95ce7
Update
GregoryComer 9d942a3
Update
GregoryComer 219a2aa
Update
GregoryComer c89a4d9
[Backend Tester] Add QNN test flow to nightly CI (#13468)
GregoryComer 1925b9a
Update
GregoryComer baabb35
Update
GregoryComer b601683
Update
GregoryComer 3558f8d
Update
GregoryComer df9a205
Update
GregoryComer 4530c3e
Update
GregoryComer f0108aa
Update
GregoryComer 1e0c6e8
Update
GregoryComer ee39628
Update
GregoryComer d8e486a
Update
GregoryComer e345809
Update
GregoryComer 3cc5e63
Update
GregoryComer 33ac51b
Update
GregoryComer 27d6230
Update
GregoryComer 814a262
Update
GregoryComer 62c15f4
Update
GregoryComer 9e604b4
Update
GregoryComer 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
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
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 |
---|---|---|
@@ -1,17 +1,61 @@ | ||
from executorch.backends.qualcomm.tests.tester import QualcommTester | ||
from executorch.backends.qualcomm.quantizer.quantizer import QnnQuantizer, QuantDtype | ||
from executorch.backends.qualcomm.tests.tester import QualcommTester, Quantize | ||
from executorch.backends.test.suite.flow import TestFlow | ||
from torchao.quantization.pt2e import MovingAverageMinMaxObserver | ||
|
||
|
||
def _create_qualcomm_flow( | ||
def _create_qnn_flow( | ||
name: str, | ||
quantize: bool = False, | ||
quant_dtype: QuantDtype | None = None, | ||
per_channel_conv=True, | ||
per_channel_linear=False, | ||
is_qat=False, | ||
use_fp16=True, | ||
) -> TestFlow: | ||
if quantize and quant_dtype is None: | ||
raise RuntimeError("Quant dtype must be provided when quantize is true.") | ||
|
||
def create_tester(*args, **kwargs) -> QualcommTester: | ||
kwargs["use_fp16"] = (use_fp16,) | ||
return QualcommTester(*args, **kwargs) | ||
|
||
def create_quantize_stage() -> Quantize: | ||
quantizer = QnnQuantizer() | ||
quantizer.set_default_quant_config( | ||
quant_dtype, | ||
is_qat=is_qat, | ||
is_conv_per_channel=per_channel_conv, | ||
is_linear_per_channel=per_channel_linear, | ||
act_observer=MovingAverageMinMaxObserver, | ||
) | ||
return Quantize(quantizer=quantizer) | ||
|
||
return TestFlow( | ||
name, | ||
backend="qualcomm", | ||
tester_factory=QualcommTester, | ||
tester_factory=create_tester, | ||
quantize=quantize, | ||
quantize_stage_factory=create_quantize_stage if quantize else None, | ||
) | ||
|
||
|
||
QUALCOMM_TEST_FLOW = _create_qualcomm_flow("qualcomm") | ||
QNN_TEST_FLOW = _create_qnn_flow("qnn") | ||
QNN_16A16W_TEST_FLOW = _create_qnn_flow( | ||
"qnn_16a16w", quantize=True, quant_dtype=QuantDtype.use_8a8w, use_fp16=False | ||
) | ||
QNN_16A8W_TEST_FLOW = _create_qnn_flow( | ||
"qnn_16a8w", quantize=True, quant_dtype=QuantDtype.use_16a8w, use_fp16=False | ||
) | ||
QNN_16A4W_TEST_FLOW = _create_qnn_flow( | ||
"qnn_16a4w", quantize=True, quant_dtype=QuantDtype.use_16a4w, use_fp16=False | ||
) | ||
QNN_16A4W_BLOCK_TEST_FLOW = _create_qnn_flow( | ||
"qnn_16a4w_block", | ||
quantize=True, | ||
quant_dtype=QuantDtype.use_8a8w, | ||
use_fp16=False, | ||
) | ||
QNN_8A8W_TEST_FLOW = _create_qnn_flow( | ||
"qnn_8a8w", quantize=True, quant_dtype=QuantDtype.use_8a8w, use_fp16=False | ||
) |
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 |
---|---|---|
@@ -1,17 +1,43 @@ | ||
from typing import Callable | ||
|
||
from executorch.backends.test.harness.stages import Quantize | ||
from executorch.backends.test.suite.flow import TestFlow | ||
from executorch.backends.vulkan.test.tester import VulkanTester | ||
from executorch.backends.vulkan.quantizer.vulkan_quantizer import ( | ||
get_symmetric_quantization_config as get_symmetric_quantization_config_vulkan, | ||
) | ||
from executorch.backends.vulkan.test.tester import ( | ||
Quantize as VulkanQuantize, | ||
VulkanTester, | ||
) | ||
|
||
|
||
def _create_vulkan_flow( | ||
name: str, | ||
quantize: bool = False, | ||
def _create_vulkan_flow_base( | ||
name: str, quantize_stage_factory: Callable[..., Quantize] | None = None | ||
) -> TestFlow: | ||
return TestFlow( | ||
name, | ||
backend="vulkan", | ||
tester_factory=VulkanTester, | ||
quantize=quantize, | ||
quantize=quantize_stage_factory is not None, | ||
quantize_stage_factory=quantize_stage_factory, | ||
) | ||
|
||
|
||
def _create_vulkan_flow() -> TestFlow: | ||
return _create_vulkan_flow_base("vulkan") | ||
|
||
|
||
def _create_vulkan_static_int8_per_channel_flow() -> TestFlow: | ||
def create_quantize_stage() -> Quantize: | ||
qparams = get_symmetric_quantization_config_vulkan() | ||
return VulkanQuantize( | ||
quantization_config=qparams, | ||
) | ||
|
||
return _create_vulkan_flow_base( | ||
"vulkan_static_int8_per_channel", create_quantize_stage | ||
) | ||
|
||
|
||
VULKAN_TEST_FLOW = _create_vulkan_flow("vulkan") | ||
VULKAN_TEST_FLOW = _create_vulkan_flow() | ||
VULKAN_STATIC_INT8_PER_CHANNEL_TEST_FLOW = _create_vulkan_static_int8_per_channel_flow() |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no groupwise 4b? I am ok for now, just checking if you run into something or just low prio for now.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I intend to add that. I was planning to confirm with @metascroy which AO API is recommended and update the XNNPACK delegate docs, as well.