Skip to content

Commit 51cd95e

Browse files
committed
[GAP9] unmask FP32 GEMM and SkipConnection paths
Two FP32 kernel tests regressed since the NE16 Linear PR integration: 1. FP32 GEMM/Regular: the new GAP9_NE16GEMMInt32Mapper was prepended to the plain Gemm op binding list. It uses the same GEMMParser class as the FloatGEMM and GEMMDequant mappers, and Deeploy keys candidate bindings by parser class — so listing the NE16Int32 mapper first masked the other two. FP32 inputs failed the NE16Int32 type check and there was no backtrack to the FloatGEMM mapper. Drop GAP9_NE16GEMMInt32Mapper from the Gemm op list (the int8/uint8 path is already covered by RequantizedGemm with its own NE16 mapper). 2. FP32 Reshape/SkipConnection: MatMulAddMergePass fused MatMul+Add into a Gemm with alpha=beta=1 and no transA/transB. The MatMul inputs in this test don't share Gemm semantics, so the merge produced wrong outputs (16/16 errors). Devel base doesn't include this pass in the GAP9 lowering chain and the test passes there. Disable it for GAP9 to match. gvsoc gap9.evk: - FP32 GEMM/Regular: 0/1024 errors, 28987 cycles - FP32 Reshape/SkipConnection: 0/16 errors, 8343 cycles - devel base: 0/1024, 28k-ish; 0/16, 8020 cycles — same shape. gap9_tiled suite: 96 passed / 1 failed (was 92/5). Remaining failure (Models/CCT/FP32/CCT_2_32_32_128) also fails at 3b011bb devel base — pre-existing, unrelated to this PR.
1 parent c01425b commit 51cd95e

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

Deeploy/Targets/GAP9/Platform.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@
112112
QuantPatternPass(),
113113
DequantPatternPass(),
114114
DequantQuantMergePass(),
115-
MatMulAddMergePass(),
115+
# MatMulAddMergePass(), # fuses to Gemm with transA=transB=0 — wrong layout
116+
# for MatMul inputs that don't share Gemm semantics; FP32
117+
# SkipConnection regressed from 0/16 to 16/16 errors under it.
118+
# Leave MatMul and Add separate (matches devel base behavior).
116119
SkipEmptyConcatPass(),
117120
SkipUnityRequantPass(previous_op_regex = "Concat", num_inputs = 2),
118121
SkipUnityRequantPass(previous_op_regex = "Reshape|Transpose", num_inputs = 1),
@@ -142,7 +145,14 @@
142145
'RequantizedGemm':
143146
PULPRQSGEMMLayer([GAP9_NE16GEMMMapper, GAP9_MatrixVecMapper, GAP9_TallGEMMMapper, GAP9_GEMMMapper]),
144147
'Gemm':
145-
GEMMLayer([GAP9_NE16GEMMInt32Mapper, GAP9_FloatGEMMMapper, GAP9_GEMMDequantMapper]),
148+
# GAP9_NE16GEMMInt32Mapper would also belong here for int8/uint8 Gemm,
149+
# but it shares the same GEMMParser class as the other mappers; the
150+
# deployer keys candidate-bindings by parser class, so listing it
151+
# alongside FloatGEMM / GEMMDequant masks them for FP32 / dequant
152+
# paths and the whole graph fails to map. The int8/uint8 path is
153+
# already covered by RequantizedGemm above; keep plain Gemm for FP
154+
# and dequant flavours only.
155+
GEMMLayer([GAP9_FloatGEMMMapper, GAP9_GEMMDequantMapper]),
146156
'Gelu':
147157
GELULayer([GAP9_GELUMapper]),
148158
'LayerNormalization':

0 commit comments

Comments
 (0)