|
13 | 13 | # Import GAP9-specific tiler bindings |
14 | 14 | from Deeploy.Targets.GAP9.Tiler import GAP9AddTilingReadyBindings, GAP9AveragePoolGrad2DTilingReadyBindings, \ |
15 | 15 | GAP9BatchNormalizationGradTilingReadyBindings, GAP9BatchNormInternalTilingReadyBindings, \ |
16 | | - GAP9ConcatTilingReadyBindings, GAP9Conv2DTilingReadyBindings, GAP9ConvGradBTilingReadyBindings, \ |
17 | | - GAP9ConvGradW2DTilingReadyBindings, GAP9ConvGradX2DTilingReadyBindings, GAP9DWConv2DTilingReadyBindings, \ |
| 16 | + GAP9ConcatTilingReadyBindings, GAP9Conv2DCHWTilingReadyBindings, GAP9Conv2DTilingReadyBindings, \ |
| 17 | + GAP9ConvGradBTilingReadyBindings, GAP9ConvGradW2DTilingReadyBindings, GAP9ConvGradX2DTilingReadyBindings, \ |
| 18 | + GAP9DWConv2DCHWTilingReadyBindings, GAP9DWConv2DTilingReadyBindings, \ |
18 | 19 | GAP9DWConvGradW2DTilingReadyBindings, GAP9DWConvGradX2DTilingReadyBindings, GAP9FlattenTilingReadyBindings, \ |
19 | 20 | GAP9FPGELUGradTilingReadyBindings, GAP9FPGELUTilingReadyBindings, GAP9FPGEMMTilingReadyBindings, \ |
20 | 21 | GAP9GatherTilingReadyBindings, GAP9GlobalAveragePool2DTilingReadyBindings, \ |
|
55 | 56 | from Deeploy.Targets.PULPOpen.Layers import PULPRQSConvLayer, PULPRQSGEMMLayer |
56 | 57 | from Deeploy.Targets.PULPOpen.Parsers import PULPConv1DParser, PULPConv2DParser, PULPConvGradW2DParser, \ |
57 | 58 | PULPConvGradX2DParser, PULPDWConv1DParser, PULPDWConv2DParser, PULPDWConvGradW2DParser, PULPDWConvGradX2DParser, \ |
58 | | - PULPFPConv2DParser, PULPFPDWConv2DParser, PULPGEMMParser, PULPMatrixVecParser, PULPPWConvGradW2DParser, \ |
| 59 | + PULPFPConv2DCHWParser, PULPFPConv2DParser, PULPFPDWConv2DCHWParser, PULPFPDWConv2DParser, PULPGEMMParser, \ |
| 60 | + PULPMatrixVecParser, PULPPWConvGradW2DParser, \ |
59 | 61 | PULPPWConvGradX2DParser, PULPTallGEMMParser |
60 | 62 |
|
61 | 63 | # Create GAP9-specific NodeMappers |
|
81 | 83 | GAP9_Conv1DMapper = NodeMapper(PULPConv1DParser(), PULPRQSConv1DBindings) |
82 | 84 | GAP9_DWConv1DMapper = NodeMapper(PULPDWConv1DParser(), [PULPDWConv1DBinding]) |
83 | 85 | GAP9_FPConv2DMapper = NodeMapper(PULPFPConv2DParser(), GAP9Conv2DTilingReadyBindings) |
| 86 | +# Channels-first (NCHW) forward conv mappers. Their parsers only accept Conv nodes |
| 87 | +# tagged keep_channels_first (PULPConvKeepCHWPass), so they are placed ahead of the |
| 88 | +# HWC mappers in the 'Conv' mapping and untagged convs fall through to the HWC path. |
| 89 | +GAP9_FPConv2DCHWMapper = NodeMapper(PULPFPConv2DCHWParser(), GAP9Conv2DCHWTilingReadyBindings) |
| 90 | +GAP9_FPDWConv2DCHWMapper = NodeMapper(PULPFPDWConv2DCHWParser(), GAP9DWConv2DCHWTilingReadyBindings) |
84 | 91 | GAP9_Conv2DMapper = NodeMapper(PULPConv2DParser(), GAP9RQSConv2DTilingReadyBindings) |
85 | 92 | GAP9_FPDWConv2DMapper = NodeMapper(PULPFPDWConv2DParser(), GAP9DWConv2DTilingReadyBindings) |
86 | 93 | GAP9_DWConv2DMapper = NodeMapper(PULPDWConv2DParser(), GAP9RQSDWConv2DTilingReadyBindings) |
|
133 | 140 | # GAP9-specific mapping using ClDma |
134 | 141 | GAP9Mapping = { |
135 | 142 | 'Conv': |
136 | | - ConvLayer([GAP9_FPConv2DMapper, GAP9_FPDWConv2DMapper]), |
| 143 | + ConvLayer([ |
| 144 | + GAP9_FPConv2DCHWMapper, GAP9_FPDWConv2DCHWMapper, GAP9_FPConv2DMapper, GAP9_FPDWConv2DMapper |
| 145 | + ]), |
137 | 146 | 'RequantizedConv': |
138 | 147 | PULPRQSConvLayer([GAP9_Conv2DMapper, GAP9_DWConv2DMapper, GAP9_Conv1DMapper, GAP9_DWConv1DMapper]), |
139 | 148 | 'RequantizedGemm': |
|
0 commit comments