Skip to content

Commit 021f95d

Browse files
committed
Only support int8 dtype for quant operators
1 parent 8cfa858 commit 021f95d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

backends/xnnpack/partition/config/xnnpack_config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
from typing import List, Optional
1111

1212
import torch
13+
from torch.export import ExportedProgram
14+
from executorch.backends.xnnpack.utils.quant_utils import is_dynamic_qdq
1315
from executorch.exir.backend.canonical_partitioners.config_partitioner import (
1416
format_target_name,
1517
PartitionerConfig,
1618
)
1719
from executorch.exir.backend.utils import WhyNoPartition
18-
from torch.export import ExportedProgram
1920

2021
logger = logging.getLogger(__name__)
2122
why = WhyNoPartition(logger=logger)
@@ -220,9 +221,12 @@ def _check_node_has_valid_dtype(self, node):
220221
valid_dtypes = {
221222
torch.float32,
222223
torch.float16,
223-
torch.int8,
224224
torch.qint8,
225225
}
226+
# Only allow int8 for quantization operations
227+
if is_dynamic_qdq(node):
228+
valid_dtypes.add(torch.int8)
229+
226230
if (
227231
node.op != "placeholder"
228232
and node.op != "call_function"

0 commit comments

Comments
 (0)