@@ -1116,17 +1116,16 @@ def test_qnn_backend_expm1(self):
11161116 self .lower_module_and_test_output (module , sample_input )
11171117
11181118 def test_qnn_backend_fp16a8w_conv2d (self ):
1119- # fp16a8w: FP16 activation + INT8 weight; weight kernel must be [1,1],
1120- # in channel must be multiple of 32/bw = 4
1119+ # fp16a8w: FP16 activation + INT8 weight; weight kernel must be [1,1]
11211120 modules = [
11221121 Conv2dSingle ( # noqa: F405
1123- in_channel = 4 , out_channel = 4 , kernel_size = 1 , padding = 0
1122+ in_channel = 2 , out_channel = 4 , kernel_size = 1 , padding = 0
11241123 ),
11251124 Conv2dSingle ( # noqa: F405
1126- in_channel = 4 , out_channel = 4 , kernel_size = 1 , padding = 0 , bias = False
1125+ in_channel = 2 , out_channel = 4 , kernel_size = 1 , padding = 0 , bias = False
11271126 ),
11281127 ]
1129- sample_input = (torch .randn ([1 , 4 , 3 , 3 ]),)
1128+ sample_input = (torch .randn ([1 , 2 , 3 , 3 ]),)
11301129 for i , module in enumerate (modules ):
11311130 with self .subTest (i = i ):
11321131 module = self .get_qdq_module (
@@ -1137,16 +1136,15 @@ def test_qnn_backend_fp16a8w_conv2d(self):
11371136 def test_qnn_backend_fp16a8w_conv2d_qat (self ):
11381137 # fp16a8w QAT: FP16 activation + INT8 weight; weight kernel must be [1,1]
11391138 # QAT fake quantize (FusedMovingAvgObsFakeQuantize) requires float32 tensors,
1140- # in channel must be multiple of 32/bw = 4
11411139 modules = [
11421140 Conv2dSingle ( # noqa: F405
1143- in_channel = 4 , out_channel = 4 , kernel_size = 1 , padding = 0
1141+ in_channel = 2 , out_channel = 4 , kernel_size = 1 , padding = 0
11441142 ),
11451143 Conv2dSingle ( # noqa: F405
1146- in_channel = 4 , out_channel = 4 , kernel_size = 1 , padding = 0 , bias = False
1144+ in_channel = 2 , out_channel = 4 , kernel_size = 1 , padding = 0 , bias = False
11471145 ),
11481146 ]
1149- sample_input = (torch .randn ([1 , 4 , 3 , 3 ]),)
1147+ sample_input = (torch .randn ([1 , 2 , 3 , 3 ]),)
11501148 for i , module in enumerate (modules ):
11511149 with self .subTest (i = i ):
11521150 # QAT in float32
@@ -1273,7 +1271,8 @@ def test_qnn_backend_gather(self):
12731271 Gather (), # noqa: F405
12741272 # TODO: resolve accuracy problem
12751273 # GatherArgmin(), # noqa: F405
1276- GatherWhere (), # noqa: F405
1274+ # TODO: There is a accuracy regression after 2.37
1275+ # GatherWhere(), # noqa: F405
12771276 ]
12781277 # shape = (2, 2, 3, 4)
12791278 sample_inputs = [
@@ -1685,10 +1684,10 @@ def test_qnn_backend_is_nan(self):
16851684 float ("nan" ),
16861685 - float ("nan" ),
16871686 0.2 ,
1688- # float("inf"), # inf is treat as nan in QNN2.50
1687+ float ("inf" ),
16891688 3.2 ,
16901689 float ("nan" ),
1691- # -float("inf"), # inf is treat as nan in QNN2.50
1690+ - float ("inf" ),
16921691 ],
16931692 dtype = torch .float32 ,
16941693 ),
@@ -2806,14 +2805,15 @@ def test_qnn_backend_where(self):
28062805 Where (), # noqa: F405
28072806 WhereConstant (torch .randn (3 , 2 ), torch .randn (3 , 2 )), # noqa: F405
28082807 WhereConstantOther (), # noqa: F405
2809- WhereConstantAll (), # noqa: F405
2808+ # TODO: There is a accuracy regression after 2.37
2809+ # WhereConstantAll(), # noqa: F405
28102810 WhereConstantInf (), # noqa: F405
28112811 ]
28122812 sample_inputs = [
28132813 (torch .randn (3 , 2 ), torch .randn (3 , 2 ), torch .randn (3 , 2 )),
28142814 (torch .randn (3 , 2 ),),
28152815 (torch .randn (3 , 2 ),),
2816- (torch .randn (3 , 2 ),),
2816+ # (torch.randn(3, 2),),
28172817 (torch .randn (30 , 20 ),),
28182818 ]
28192819 for i , module in enumerate (modules ):
@@ -2877,6 +2877,11 @@ def setUp(self):
28772877 shared_buffer = TestQNN .shared_buffer ,
28782878 )
28792879
2880+ # TODO: Needs to be fixed in HTP
2881+ @unittest .skipIf (
2882+ is_qnn_sdk_version_greater_than ("2.37" ),
2883+ "Failed to prepare the graph because of an index operation with argmin output." ,
2884+ )
28802885 def test_qnn_backend_argmin_view_squeeze_conv2d (self ):
28812886 module = ArgminViewSqueezeConv2D () # noqa: F405
28822887 sample_input = (torch .randn (32 ), torch .randn (32 , 3 , 32 , 32 ))
@@ -2916,6 +2921,11 @@ def test_qnn_backend_conv2d_avg_pool2d(self):
29162921 sample_input = (torch .randn (16 , 3 , 16 , 16 ),)
29172922 self .lower_module_and_test_output (module , sample_input )
29182923
2924+ # TODO: Needs to be fixed in HTP
2925+ @unittest .skipIf (
2926+ is_qnn_sdk_version_greater_than ("2.40" ),
2927+ "UT did not pass because of aten.mean.dim when using keep_dim for some devices after QNN 2.41." ,
2928+ )
29192929 def test_qnn_backend_conv2d_bn_hardtanh_mean (self ):
29202930 module = Conv2dBnHardtanhMean () # noqa: F405
29212931 sample_input = (torch .randn (1 , 1 , 6 , 6 ),)
@@ -3913,7 +3923,7 @@ def test_qnn_backend_conv_transpose2d(self):
39133923 gm = self .get_qdq_module (module , sample_input )
39143924 self .lower_module_and_test_output (gm , sample_input )
39153925
3916- @unittest .skip ("As of QNN 2.50 , transpose conv block quant is not supported" )
3926+ @unittest .skip ("As of QNN 2.37 , transpose conv block quant is not supported" )
39173927 def test_qnn_backend_conv_transpose2d_block (self ):
39183928 i_ch , o_ch , kernel , padding = 128 , 32 , (1 , 1 ), 0
39193929 modules = [
@@ -4437,7 +4447,8 @@ def test_qnn_backend_gather(self):
44374447 Gather (), # noqa: F405
44384448 # TODO: resolve accuracy problem
44394449 # GatherArgmin(), # noqa: F405
4440- GatherWhere (), # noqa: F405
4450+ # TODO: There is a accuracy regression after 2.37
4451+ # GatherWhere(), # noqa: F405
44414452 ]
44424453 # shape = (2, 2, 3, 4)
44434454 sample_inputs = [
@@ -6429,14 +6440,15 @@ def test_qnn_backend_where(self):
64296440 Where (), # noqa: F405
64306441 WhereConstant (torch .randn (3 , 2 ), torch .randn (3 , 2 )), # noqa: F405
64316442 WhereConstantOther (), # noqa: F405
6432- WhereConstantAll (), # noqa: F405
6443+ # TODO: There is a accuracy regression after 2.37
6444+ # WhereConstantAll(), # noqa: F405
64336445 WhereConstantInf (), # noqa: F405
64346446 ]
64356447 sample_inputs = [
64366448 (torch .randn (3 , 2 ), torch .randn (3 , 2 ), torch .randn (3 , 2 )),
64376449 (torch .randn (3 , 2 ),),
64386450 (torch .randn (3 , 2 ),),
6439- (torch .randn (3 , 2 ),),
6451+ # (torch.randn(3, 2),),
64406452 (torch .randn (30 , 20 ),),
64416453 ]
64426454 for i , module in enumerate (modules ):
@@ -6830,6 +6842,7 @@ def test_qnn_backend_masked_softmax(self):
68306842 has_masked_softmax = True
68316843 self .assertTrue (has_masked_softmax )
68326844
6845+ @unittest .skip ("UT pass before QNN 2.26, segfault during partitioner" )
68336846 def test_qnn_backend_moe_feed_forward (self ):
68346847 from executorch .examples .models .llama .llama_transformer import MOEFeedForward
68356848 from executorch .examples .models .llama .model_args import ModelArgs
@@ -9014,7 +9027,7 @@ def setUp(self):
90149027 SM8650 = 32 ,
90159028 SM8750 = 36 ,
90169029 pte_size = 2_700_000_000 , # 2.7 GB
9017- wikitext_ppl = 19 ,
9030+ wikitext_ppl = 17 ,
90189031 hellaswag_acc_norm = None ,
90199032 sqnr = 27 ,
90209033 ),
@@ -9024,13 +9037,13 @@ def setUp(self):
90249037 pte_size = 2_860_000_000 , # 2.86 GB
90259038 wikitext_ppl = 14 ,
90269039 hellaswag_acc_norm = None ,
9027- sqnr = 20 ,
9040+ sqnr = 27 ,
90289041 ),
90299042 "gemma3-1b" : TestExampleLLMScript .LlmSpecs (
9030- SM8650 = 68 ,
9031- SM8750 = 72 ,
9043+ SM8650 = 70 ,
9044+ SM8750 = 100 ,
90329045 pte_size = 1_200_000_000 , # 1.2 GB
9033- wikitext_ppl = 24 ,
9046+ wikitext_ppl = 23 ,
90349047 hellaswag_acc_norm = None ,
90359048 sqnr = 10 ,
90369049 ),
@@ -9040,7 +9053,7 @@ def setUp(self):
90409053 pte_size = 4_500_000_000 , # 4.5 GB
90419054 wikitext_ppl = 120 ,
90429055 hellaswag_acc_norm = None ,
9043- sqnr = 9 ,
9056+ sqnr = 10 ,
90449057 ),
90459058 "glm-1_5b" : TestExampleLLMScript .LlmSpecs (
90469059 SM8650 = 42 ,
@@ -9064,15 +9077,15 @@ def setUp(self):
90649077 pte_size = 4_000_000_000 , # 4GB
90659078 wikitext_ppl = 14 ,
90669079 hellaswag_acc_norm = None ,
9067- sqnr = 2 ,
9080+ sqnr = 20 ,
90689081 ),
90699082 "llama3_2-1b_instruct" : TestExampleLLMScript .LlmSpecs (
90709083 SM8650 = 37 ,
90719084 SM8750 = 45 ,
90729085 pte_size = 1_500_000_000 , # 1.5 GB
90739086 wikitext_ppl = 18 ,
90749087 hellaswag_acc_norm = None ,
9075- sqnr = 13 ,
9088+ sqnr = 15 ,
90769089 ),
90779090 "llama3_2-3b_instruct" : TestExampleLLMScript .LlmSpecs (
90789091 SM8650 = 21 ,
@@ -9083,20 +9096,20 @@ def setUp(self):
90839096 sqnr = 14 ,
90849097 ),
90859098 "qwen2_5-0_5b" : TestExampleLLMScript .LlmSpecs (
9086- SM8650 = 95 ,
9087- SM8750 = 130 ,
9099+ SM8650 = 115 ,
9100+ SM8750 = 155 ,
90889101 pte_size = 600_000_000 , # 600 MB
90899102 wikitext_ppl = 15 ,
90909103 hellaswag_acc_norm = None ,
90919104 sqnr = 8 ,
90929105 ),
90939106 "qwen2_5-1_5b" : TestExampleLLMScript .LlmSpecs (
90949107 SM8650 = 38 ,
9095- SM8750 = 45 ,
9108+ SM8750 = 47 ,
90969109 pte_size = 1_500_000_000 , # 1.5 GB
90979110 wikitext_ppl = 10 ,
90989111 hellaswag_acc_norm = None ,
9099- sqnr = 9.5 ,
9112+ sqnr = 10 ,
91009113 ),
91019114 "qwen3-0_6b" : TestExampleLLMScript .LlmSpecs (
91029115 SM8650 = 47 ,
@@ -9110,9 +9123,9 @@ def setUp(self):
91109123 SM8650 = 28 ,
91119124 SM8750 = 34 ,
91129125 pte_size = 1_800_000_000 , # 1.8 GB
9113- wikitext_ppl = 20 ,
9126+ wikitext_ppl = 15 ,
91149127 hellaswag_acc_norm = None ,
9115- sqnr = 11.5 ,
9128+ sqnr = 12 ,
91169129 ),
91179130 "smollm2_135m" : TestExampleLLMScript .LlmSpecs (
91189131 SM8650 = 214 ,
@@ -9138,11 +9151,6 @@ def test_static_llm_model(self): # noqa: C901
91389151 assert (
91399152 self .model_name in self .llm_specs
91409153 ), f"Unable to find { self .model_name } under model_specs."
9141- if (
9142- self .model_name == "granite_3_3-2b_instruct"
9143- and is_qnn_sdk_version_greater_than ("2.49" )
9144- ):
9145- self .skipTest ("The model crush in dsp side since 2.50, skipped" )
91469154
91479155 is_llama_model = self .model_name in {
91489156 "llama3_2-1b_instruct" ,
@@ -9441,7 +9449,7 @@ def test_codegen2_1b(self):
94419449 pte_size = msg ["pte_size" ]
94429450 self .assertLessEqual (pte_size , 1_200_000_000 ) # 1200MB
94439451 if not self .compile_only and not self .enable_x86_64 :
9444- self .assertGreaterEqual (msg ["inference_speed" ], 50 ) # Lanai
9452+ self .assertGreaterEqual (msg ["inference_speed" ], 60 )
94459453
94469454 def test_llama_stories_260k (self ):
94479455 if not self .required_envs ():
@@ -9632,8 +9640,8 @@ def test_attention_sink(self):
96329640 else :
96339641 if not self .compile_only :
96349642 self .assertLessEqual (
9635- msg ["attention_sink_evictor_pte_size" ], 1_850_000
9636- ) # 1.85 MB
9643+ msg ["attention_sink_evictor_pte_size" ], 1_700_000
9644+ ) # 1.7 MB
96379645 self .assertLessEqual (
96389646 msg ["wiki_ppl" ], self .llm_specs [model_name ].wikitext_ppl
96399647 )
@@ -9785,7 +9793,7 @@ def setUp(self):
97859793 self .alm_specs = {
97869794 "granite_speech_3_3-2b" : TestExampleMultimodalityScript .ALMSpecs (
97879795 max_seq_len = 1024 ,
9788- sm8650_token_rate = 4 ,
9796+ sm8650_token_rate = 5 ,
97899797 sm8750_token_rate = 8 ,
97909798 encoder_pte_size = 900_000_000 , # 900MB
97919799 tok_embedding_pte_size = 240_000_000 , # 240MB
@@ -9797,8 +9805,8 @@ def setUp(self):
97979805 self .vlm_specs = {
97989806 "smolvlm_500m_instruct" : TestExampleMultimodalityScript .VLMSpecs (
97999807 max_seq_len = 1024 ,
9800- sm8650_token_rate = 37 ,
9801- sm8750_token_rate = 40 ,
9808+ sm8650_token_rate = 50 ,
9809+ sm8750_token_rate = 55 ,
98029810 encoder_pte_size = 110_000_000 , # 110MB
98039811 tok_embedding_pte_size = 100_000_000 , # 100MB
98049812 decoder_pte_size = 400_000_000 , # 400MB
0 commit comments