Skip to content

Commit 1c64a66

Browse files
Revert "Fix export_llama never passing enable_bf16 to the XNNPACK partitioner" (pytorch#21948)
Reverts pytorch#21864
1 parent 0e543a3 commit 1c64a66

2 files changed

Lines changed: 0 additions & 24 deletions

File tree

‎examples/models/llama/export_llama_lib.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,6 @@ def _export_llama(llm_config: LlmConfig) -> LLMEdgeManager: # noqa: C901
17241724
generate_etrecord=llm_config.debug.generate_etrecord,
17251725
verbose=llm_config.debug.verbose,
17261726
gen_tag_fn=gen_tag_fn,
1727-
enable_bf16=llm_config.model.dtype_override.value == "bf16",
17281727
)
17291728
elif llm_config.backend.openvino.enabled:
17301729
builder = _to_edge_and_lower_llama_openvino(

‎examples/models/llama/tests/test_export_llama_lib.py‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,6 @@ def test_has_expected_ops_and_op_counts(self):
7070
for op, _op_info in delegation_info.delegation_by_operator.items():
7171
self.assertTrue(op not in UNWANTED_OPS)
7272

73-
def test_bf16_xnnpack_delegates_linears(self):
74-
"""
75-
bf16 linears only delegate when enable_bf16 reaches the partitioner,
76-
so this guards the wiring from dtype_override to
77-
get_xnnpack_partitioner. Some non-gemm subgraphs delegate either way,
78-
so the assertion is on linears specifically.
79-
"""
80-
parser = build_args_parser()
81-
args = parser.parse_args([])
82-
args.use_kv_cache = True
83-
args.xnnpack = True
84-
args.xnnpack_extended_ops = True
85-
args.dtype_override = "bf16"
86-
87-
llm_config = LlmConfig.from_args(args)
88-
builder = _export_llama(llm_config)
89-
graph_module = builder.edge_manager.exported_program().graph_module
90-
delegation_info = get_delegation_info(graph_module)
91-
92-
linear = delegation_info.delegation_by_operator["aten_linear_default"]
93-
self.assertGreater(linear.delegated, 0)
94-
self.assertEqual(linear.non_delegated, 0)
95-
9673
@unittest.skipUnless(HAS_ARM_BACKEND, "ARM backend not available")
9774
def test_get_quantizer_and_quant_params_returns_tosa_quantizer(self):
9875
llm_config = LlmConfig()

0 commit comments

Comments
 (0)