Skip to content

Commit b8087fc

Browse files
committed
[NE16] integrate Pu DENG's NE16 Linear PR with NE16-w platform
- TargetLibraries/GAP9/CMakeLists.txt: rename CNN_Libraries_NE16 → CNN_Libraries_HWPE (the actual gap9-sdk path); skip SDK CNN_BasicKernels_NE16.c source for GAP9_w_NE16 platform (it uses the pulp-nnx ne16 stack, so the SDK NE16 kernels are not needed). - Deeploy/Targets/NE16/Platform.py: instantiate the GAP9ClusterEngine with a trimmed includeList (no CNN_BasicKernels_NE16.h / ne16_utils.h / CNN_Copy.h) so the generated Network.c does not pull in the SDK NE16 header alongside pulp-nnx ne16_task_defs.h — the NE16_REG_* macros are defined in both and trigger -Werror redefs.
1 parent 3a8bf48 commit b8087fc

3 files changed

Lines changed: 33 additions & 6 deletions

File tree

Deeploy/Targets/GAP9/Platform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
IntegerDivRequantMergePass, MatMulAddMergePass, MergeConstAddAndRequantPass, MergeTrueIntegerDivRequantShiftPass, \
4747
QuantPatternPass, RQSSplitPass, SkipEmptyConcatPass, SkipUnityRequantPass, iGELURequantMergePass, \
4848
iHardswishRequantMergePass
49-
from Deeploy.Targets.PULPOpen.Bindings import BasicDequantBindings, BasicQuantBindings, PULPConv1DBinding, \
50-
PULPDMASliceBindings, PULPDWConv1DBinding, PULPReduceMeanBindings, PULPRQSConv1DBindings, PULPSliceBindings
49+
from Deeploy.Targets.PULPOpen.Bindings import BasicDequantBindings, BasicQuantBindings, PULPDMASliceBindings, \
50+
PULPDWConv1DBinding, PULPReduceMeanBindings, PULPRQSConv1DBindings, PULPSliceBindings
5151
from Deeploy.Targets.PULPOpen.Layers import PULPRQSConvLayer, PULPRQSGEMMLayer
5252
from Deeploy.Targets.PULPOpen.Parsers import PULPConv1DParser, PULPConv2DParser, PULPDWConv1DParser, \
5353
PULPDWConv2DParser, PULPFPConv2DParser, PULPFPDWConv2DParser, PULPGEMMParser, PULPMatrixVecParser, \

Deeploy/Targets/NE16/Platform.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ def __init__(self,
2828
structBuffer = GAP9StructBuffer,
2929
transientBuffer = GAP9TransientBuffer) -> None:
3030
if engines is None:
31-
engines = [NE16Engine("NE16"), GAP9ClusterEngine("GAP9Cluster")]
31+
# Drop SDK NE16 headers from the cluster engine include list so the
32+
# generated Network.c does not pull in CNN_BasicKernels_NE16.h /
33+
# ne16_utils.h alongside pulp-nnx's ne16_task_defs.h
34+
# (NE16_REG_* macros are defined in both, causing -Werror redefs).
35+
cluster = GAP9ClusterEngine(
36+
"GAP9Cluster",
37+
includeList = [
38+
"pmsis.h", "DeeployGAP9Math.h", "pulp_nn_kernels.h", "DeeployMchan.h", "CNN_BasicKernels_fp32.h"
39+
],
40+
)
41+
engines = [NE16Engine("NE16"), cluster]
3242
super().__init__(engines, variableBuffer, constantBuffer, structBuffer, transientBuffer)
3343

3444

@@ -44,7 +54,17 @@ def __init__(self,
4454
structBuffer = GAP9StructBuffer,
4555
transientBuffer = GAP9TransientBuffer) -> None:
4656
if engines is None:
47-
engines = [NE16Engine("NE16"), GAP9ClusterEngine("GAP9Cluster")]
57+
# Drop SDK NE16 headers from the cluster engine include list so the
58+
# generated Network.c does not pull in CNN_BasicKernels_NE16.h /
59+
# ne16_utils.h alongside pulp-nnx's ne16_task_defs.h
60+
# (NE16_REG_* macros are defined in both, causing -Werror redefs).
61+
cluster = GAP9ClusterEngine(
62+
"GAP9Cluster",
63+
includeList = [
64+
"pmsis.h", "DeeployGAP9Math.h", "pulp_nn_kernels.h", "DeeployMchan.h", "CNN_BasicKernels_fp32.h"
65+
],
66+
)
67+
engines = [NE16Engine("NE16"), cluster]
4868
super().__init__(memoryHierarchy, defaultTargetMemoryLevel, engines, variableBuffer, constantBuffer,
4969
structBuffer, transientBuffer)
5070
self.weightMemoryLevel = weightMemoryLevel

TargetLibraries/GAP9/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55
file(GLOB_RECURSE SOURCES
66
"src/**"
77
"$ENV{GAP_SDK_HOME}/tools/autotiler_v3/CNN_Libraries_fp32/CNN_Bias_Linear_Activation_fp32.c"
8-
"$ENV{GAP_SDK_HOME}/tools/autotiler_v3/CNN_Libraries_NE16/CNN_BasicKernels_NE16.c"
98
"$ENV{GAP_SDK_HOME}/tools/autotiler_v3/CNN_Libraries/CNN_Copy.c"
109
)
1110

11+
# CNN_BasicKernels_NE16 from gap9-sdk redefines NE16_REG_* macros that
12+
# pulp-nnx's ne16 hal also defines. For GAP9_w_NE16 we use the pulp-nnx
13+
# NE16 stack; for plain GAP9 (Pu DENG's NE16-Linear path) we use the SDK's.
14+
if(NOT platform STREQUAL "GAP9_w_NE16")
15+
list(APPEND SOURCES
16+
"$ENV{GAP_SDK_HOME}/tools/autotiler_v3/CNN_Libraries_HWPE/CNN_BasicKernels_NE16.c"
17+
)
18+
endif()
19+
1220

1321
# Exclude dory_mem and dory_dma from SOURCES (they need different optimization)
1422
list(FILTER SOURCES EXCLUDE REGEX ".*dory_(mem|dma).*")
@@ -48,7 +56,6 @@ target_include_directories(deeploygap9
4856
${TILER_EMU_INC}
4957
${TILER_CNN_KERNEL_PATH_FP32}
5058
${TILER_CNN_KERNEL_PATH_FP16}
51-
$ENV{GAP_SDK_HOME}/tools/autotiler_v3/CNN_Libraries_NE16
5259
$ENV{GAP_SDK_HOME}/tools/autotiler_v3/CNN_Libraries_SQ8
5360
$ENV{GAP_SDK_HOME}/tools/autotiler_v3/CNN_Libraries
5461
${TILER_DSP_KERNEL_V2_PATH}

0 commit comments

Comments
 (0)