Skip to content

Commit 6c8ae2b

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 6c8ae2b

4 files changed

Lines changed: 41 additions & 8 deletions

File tree

.github/workflows/ci-platform-gap9-w-ne16-tiled.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,23 @@ name: CI • GAP9 + NE16 (Tiled)
1717
docker_image_deeploy:
1818
description: "Deeploy Image to use"
1919
required: false
20-
default: "ghcr.io/pulp-platform/deeploy-gap9:latest"
20+
default: "ghcr.io/pulp-platform/deeploy-gap9:devel"
2121

2222
concurrency:
2323
group: ${{ github.workflow }}-${{ github.ref }}
2424
cancel-in-progress: true
2525

2626
jobs:
2727
select-env:
28+
# The GAP9 + NE16 image is hosted in pulp-platform's private ghcr.io
29+
# registry; only upstream's self-hosted runners have credentials to
30+
# pull it. On forks the docker pull always returns "denied", so skip
31+
# the whole pipeline cleanly there. (Same constraint as the existing
32+
# ci-platform-gap9{,-tiled}.yml jobs.)
33+
if: github.repository == 'pulp-platform/Deeploy'
2834
uses: ./.github/workflows/_select-env.yml
2935
with:
30-
docker_image_deeploy: ${{ github.event.inputs.docker_image_deeploy || github.repository == 'pulp-platform/Deeploy' && 'ghcr.io/pulp-platform/deeploy-gap9:latest'}}
36+
docker_image_deeploy: ${{ github.event.inputs.docker_image_deeploy || 'ghcr.io/pulp-platform/deeploy-gap9:devel' }}
3137

3238
gap9-w-ne16-kernels-tiled-singlebuffer-L2:
3339
needs: select-env

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 PULPDMASliceBindings, PULPDWConv1DBinding, PULPReduceMeanBindings, \
50+
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)