Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
c51e8a9
Add ncnn backend
sunnycase Sep 20, 2023
121cb8d
Pass test softmax
sunnycase Oct 17, 2023
5a256cb
Apply code-format changes
sunnycase Oct 17, 2023
5326f59
Merge branch 'master' into feature/ncnn-backend
sunnycase Oct 17, 2023
00987cc
Fix build
sunnycase Oct 19, 2023
94776ca
Fix build
sunnycase Oct 19, 2023
85a4aa6
Fix build
sunnycase Oct 20, 2023
ba191be
Merge branch 'master' into feature/ncnn-backend
Nov 21, 2023
748ade1
support more than 3D ncnn:softmax
Nov 27, 2023
7fa6bac
fix shape
Nov 28, 2023
2620eab
Merge branch 'master' into feature/ncnn-backend
Nov 28, 2023
724b20e
fix merge error
Nov 28, 2023
c429045
Apply code-format changes
curioyang Nov 28, 2023
2e56c95
support ncnn unary
Nov 29, 2023
c06c672
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
Nov 29, 2023
5baa3a4
Apply code-format changes
curioyang Nov 29, 2023
38d37ea
Merge branch 'master' into feature/ncnn-backend
curioyang Dec 1, 2023
615d103
add batchnorm
curioyang Dec 8, 2023
652fba1
Apply code-format changes
curioyang Dec 8, 2023
cf35523
[x] binary
curioyang Dec 22, 2023
dfa768d
[x] binary
curioyang Dec 22, 2023
3cdee3e
Apply code-format changes
curioyang Dec 22, 2023
b82e98a
- [X] batchnorm
curioyang Dec 22, 2023
6bb7d6e
Merge branches 'feature/ncnn-backend' and 'feature/ncnn-backend' of g…
curioyang Dec 22, 2023
87db075
Merge branch 'master' into feature/ncnn-backend
curioyang Dec 28, 2023
55662b0
support align binary broadcast axis
curioyang Dec 29, 2023
f726450
Apply code-format changes
curioyang Dec 29, 2023
af0d93e
tmp profile
curioyang Jan 4, 2024
bf04601
support celu [need ncnn 0826+]
curioyang Jan 5, 2024
c50e181
Apply code-format changes
curioyang Jan 5, 2024
e388fbb
support clip
curioyang Jan 5, 2024
eba0eaf
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Jan 5, 2024
5d1bf67
fix runtime bug
curioyang Jan 9, 2024
a64b161
support concat
curioyang Jan 9, 2024
a13218d
Apply code-format changes
curioyang Jan 9, 2024
f1d990f
remove ncnn channel gap in buffer
curioyang Jan 11, 2024
8f0dab0
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Jan 11, 2024
03755a8
format
curioyang Jan 11, 2024
d8ff9ed
Apply code-format changes
curioyang Jan 11, 2024
712d20d
stash conv
curioyang Jan 11, 2024
d23a0e9
cumsum --> [ncnn op] CumulativeSum
curioyang Jan 11, 2024
e8ffebe
Apply code-format changes
curioyang Jan 11, 2024
d78713a
Merge branch 'feature/ncnn-backend' into feature/add_ncnn_conv
curioyang Jan 12, 2024
28e3fa5
conv2d --> [ncnn op] conv
curioyang Jan 18, 2024
9d6665c
Apply code-format changes
curioyang Jan 18, 2024
efe9962
Elu --> [ncnn op] ELU
curioyang Jan 18, 2024
f3f203b
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Jan 18, 2024
59a82b9
Apply code-format changes
curioyang Jan 18, 2024
f37f639
format ncnn param
curioyang Jan 18, 2024
4d3c19c
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Jan 18, 2024
21321ff
Erf --> [ncnn op] Erf
curioyang Jan 18, 2024
db7efb1
disable lowering erf
curioyang Jan 18, 2024
8ea444a
Apply code-format changes
curioyang Jan 18, 2024
19852ed
fix warning
curioyang Jan 18, 2024
b8d9f44
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Jan 18, 2024
a9641b4
Hardsigmoid --> [ncnn op] HardSigmoid
curioyang Jan 19, 2024
2b61889
Apply code-format changes
curioyang Jan 19, 2024
d60a98c
fix flops
curioyang Jan 19, 2024
3f15f88
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Jan 19, 2024
7f07de0
Apply code-format changes
curioyang Jan 19, 2024
3de9d7d
HardSwish --> [ncnn op] HardSwish
curioyang Jan 19, 2024
4b47f9f
Apply code-format changes
curioyang Jan 19, 2024
1e67682
instancenorm --> [ncnn op] instancenorm
curioyang Jan 19, 2024
2f6eafc
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Jan 19, 2024
7cbdb14
Apply code-format changes
curioyang Jan 19, 2024
3f9120d
fix flops
curioyang Jan 19, 2024
c571942
stash layernorm
curioyang Jan 24, 2024
1dfb844
LRN -->[ncnn op] LRN
curioyang Jan 24, 2024
3c18eee
fix dump manager
curioyang Feb 1, 2024
74bcf7f
Apply code-format changes
curioyang Feb 1, 2024
7caf301
LSTM -->[ncnn op] LSTM
curioyang Feb 1, 2024
db2d714
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Feb 1, 2024
01ce002
Apply code-format changes
curioyang Feb 1, 2024
ec34708
Merge branch 'master' into feature/ncnn-backend
curioyang Feb 1, 2024
28c1de8
Pad -->[ncnn op] Padding
curioyang Feb 2, 2024
ee2605f
ReduceWindows2D -->[ncnn op] Pooling
curioyang Feb 5, 2024
91097a6
PRelu -->[ncnn op] PRelu
curioyang Feb 5, 2024
b11c3c4
fix name
curioyang Feb 5, 2024
bdc2cfa
Reduce -->[ncnn op] Reduction
curioyang Feb 6, 2024
62b05f3
Reshape -->[ncnn op] Reshape
curioyang Feb 7, 2024
24d81b8
SELU -->[ncnn op] SELU
curioyang Feb 8, 2024
066356d
add paramdict func
curioyang Feb 8, 2024
f75351c
Sigmoid --> [ncnn op] Sigmoid
curioyang Feb 19, 2024
d603a6a
Slice --> [ncnn op] Crop
curioyang Feb 20, 2024
3fc3c77
fix shape error
curioyang Feb 20, 2024
823fb98
Softplus --> [ncnn op] Softplus
curioyang Feb 20, 2024
dbe2c73
Split --> [ncnn op] Slice
curioyang Feb 21, 2024
87ccd05
fix scaler doesn't have shape.
curioyang Feb 21, 2024
7aff638
Tile --> [ncnn op] Tile
curioyang Feb 21, 2024
6a33505
Transpose --> [ncnn op] Permute
curioyang Feb 22, 2024
c897098
MatMul --> [ncnn op] MatMul
curioyang Feb 26, 2024
d980532
fix reshape
curioyang Feb 26, 2024
9a5de03
update test without other op
curioyang Feb 26, 2024
fb20a6c
ConvTranspose --> [ncnn op] ConvTranspose
curioyang Feb 29, 2024
b3653ff
update ncnn version to 20240102
curioyang Feb 29, 2024
789116c
recover reduce scaler output shape
curioyang Feb 29, 2024
c5edcc5
Merge branch 'feature/ncnn-backend' into feature/layernorm
curioyang Feb 29, 2024
c811887
LayerNorm --> [ncnn op] layernorm
curioyang Mar 4, 2024
d5a0065
Cast --> [ncnn op] Cast
curioyang Mar 4, 2024
3537c8d
GELU --> [ncnn op] GELU
curioyang Mar 5, 2024
cba4030
remove glue op
curioyang Mar 5, 2024
9cfa87b
fix celu
curioyang Mar 5, 2024
1fe4243
dequantize --> [ncnn op] dequantize
curioyang Mar 5, 2024
059afa0
Squeeze --> [ncnn op] Squeeze
curioyang Mar 6, 2024
16b4f8f
Unsqueeze --> [ncnn op] Unsqueeze
curioyang Mar 6, 2024
d89524a
fix load rdata in ncnn runtime
curioyang Mar 18, 2024
8cc6ce6
fix binary
curioyang Mar 21, 2024
662020f
- [X] Split DWConv and Conv
curioyang Mar 21, 2024
416a8cd
fix bin data serialize
curioyang Mar 21, 2024
a21fc8f
fix reshape
curioyang Mar 21, 2024
ac82217
fix
curioyang Mar 22, 2024
47b7f82
fix warning
curioyang Mar 22, 2024
6e8cb7c
fix binary 4D
curioyang Mar 22, 2024
417ef36
fix reduction
curioyang Mar 22, 2024
3fb7fad
fix scaler binary and two input binary
curioyang Mar 25, 2024
0b2e0a7
add more test for ncnn
curioyang Mar 25, 2024
e9a98db
remove log and fix ncnn output shape
curioyang Mar 25, 2024
582508e
fix get max thread for ncnn::opt.num_thread
curioyang Mar 25, 2024
4a357da
Merge branch 'dev/3.0' into feature/ncnn-backend
curioyang Mar 25, 2024
6875840
Apply code-format changes
curioyang Mar 25, 2024
6c5d0b5
enable riscv64-unknown-linux-gnu-13.2.0 in Conan setting
curioyang Mar 25, 2024
fe652b8
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Mar 25, 2024
0382455
remove unused code
curioyang Mar 25, 2024
3a316ac
add more vision in conan setting
curioyang Mar 25, 2024
006e3e4
add more vision in conan setting
curioyang Mar 25, 2024
9481ca4
Update runtime-build.yml
curioyang Mar 25, 2024
d22db45
Update runtime-build.yml
curioyang Mar 25, 2024
5f062e5
update layernorm test
curioyang Mar 26, 2024
ea46852
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Mar 26, 2024
561d65b
Apply code-format changes
curioyang Mar 26, 2024
c92d023
fix
curioyang Mar 26, 2024
52626f4
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Mar 26, 2024
1d3d1cf
fix
curioyang Mar 26, 2024
41b7299
fix
curioyang Mar 28, 2024
a150bb4
update tset ncnn version
curioyang Mar 28, 2024
c63ed29
fix padding bug
curioyang Mar 29, 2024
52b083a
fix pattern with fixesshape
curioyang Mar 29, 2024
bd90248
add paddings NHWC to NCHW
curioyang Mar 29, 2024
9d68d74
fix fold pad to reducewindows2d
curioyang Mar 29, 2024
23bcda5
fix param format
curioyang Mar 29, 2024
1571e14
fix tflite pad transpose input\output\paddings
curioyang Mar 29, 2024
2f45751
fix tflite reducewindows2d with real countIncludePad
curioyang Mar 29, 2024
ed2ff13
fix pool pad mode
curioyang Apr 1, 2024
a31b380
fix pad with tp
curioyang Apr 1, 2024
643ab65
fix DeConv test case with limitation of stride and kernel size
curioyang Apr 1, 2024
dbd361c
fix less than 4D
curioyang Apr 1, 2024
54a7efc
Apply code-format changes
curioyang Apr 1, 2024
8e4f7c3
fix Prelu bug
curioyang Apr 2, 2024
c6772c3
Merge branch 'feature/ncnn-backend' of github.com:kendryte/nncase int…
curioyang Apr 2, 2024
782f4c0
fix string bug
curioyang Apr 2, 2024
30f1753
fix bin data
curioyang May 31, 2024
3489dd3
Merge branch 'dev/3.0' into feature/ncnn-backend
curioyang May 31, 2024
dac19f2
Apply code-format changes
curioyang May 31, 2024
8c62dee
fix Syntax format
curioyang Jun 7, 2024
9b0610e
divide bin data
curioyang Jun 7, 2024
7fd4286
add condition for dump ncnn param/bin
curioyang Jun 7, 2024
fa74f42
Merge branch 'feature/ncnn-backend' of https://github.com/kendryte/nn…
curioyang Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/runtime-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
strategy:
matrix:
config:
- { name: riscv64-linux, shell: bash, arch: riscv64, toolchain: riscv64-unknown-linux, toolchain_env: RISCV_ROOT_PATH, toolchain_file: riscv64-unknown-linux-gnu-12.0.1, qemu: qemu-riscv64, loader_args: '-cpu;rv64,v=true,Zfh=true,vlen=128,elen=64,vext_spec=v1.0;-L', cmakeArgs: '', buildType: Release }
- {name: riscv64-linux, shell: bash, arch: riscv64, toolchain: riscv64-unknown-linux, toolchain_env: RISCV_ROOT_PATH, toolchain_file: riscv64-unknown-linux-gnu-13.2.0, qemu: qemu-riscv64, loader_args: '-cpu;rv64,v=true,Zfh=true,vlen=128,elen=64,vext_spec=v1.0;-L', cmakeArgs: '', buildType: Release}

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -151,4 +151,4 @@ jobs:
with:
name: nncaseruntime-${{matrix.config.name}}
path: ${{github.workspace}}/install
if-no-files-found: error
if-no-files-found: error
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ if(ENABLE_DUMP_MEM)
add_definitions(-DDUMP_MEM)
endif()

if(ENABLE_OPENMP)
add_definitions(-DENABLE_OPENMP)
endif()

if(NOT CMAKE_TOOLCHAIN_FILE)
include(toolchains/native.toolchain.cmake)
endif()
Expand Down Expand Up @@ -283,5 +287,7 @@ if(BUILD_TESTING)
endif()

# Modules
add_subdirectory(modules/ncnn)
#add_subdirectory(modules/k210)

#add_subdirectory(modules/vulkan)
3 changes: 3 additions & 0 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
find_package(gsl-lite REQUIRED)
find_package(ncnn REQUIRED)

if (ENABLE_OPENMP)
find_package(OpenMP COMPONENTS CXX REQUIRED)
endif ()
Expand Down
4 changes: 2 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ class nncaseConan(ConanFile):
"python": True,
"vulkan_runtime": False
}

def imports(self):
if self.settings.os == 'Windows':
self.copy("nethost.dll", "bin", "bin")
self.copy("ortki.dll", "bin", "bin")

def requirements(self):
self.requires('ncnn/20240102')
if self.options.tests:
self.requires('gtest/1.10.0')
self.requires('ortki/0.0.3')
Expand All @@ -64,7 +65,6 @@ def configure(self):

if self.settings.os == 'Windows':
self.settings.compiler.toolset = 'ClangCL'

if not self.options.runtime:
if self.settings.os == 'Windows':
self.options["nethost"].shared = True
Expand Down
67 changes: 67 additions & 0 deletions modules/Nncase.Modules.CPU/Targets/CPUTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,73 @@ public void RegisterTargetInDependentPass(IPassManager passManager, CompileOptio
/// <inheritdoc/>
public void RegisterTargetDependentPass(IPassManager passManager, CompileOptions options)
{
passManager.AddWithName<DataflowPass>("LowerNcnnIR").Configure(p =>
{
p.Add<Passes.Rules.Lower.RemoveMarker>();

// Fold reduce
p.Add<Passes.Rules.Ncnn.LowerReductionSumSquare>();
p.Add<Passes.Rules.Ncnn.LowerReductionL1>();
p.Add<Passes.Rules.Ncnn.LowerReductionL2>();
p.Add<Passes.Rules.Ncnn.LowerReductionLogSum>();
p.Add<Passes.Rules.Ncnn.LowerReductionLogSumExp>();

// single op
p.Add<Passes.Rules.Ncnn.LowerBatchNorm>();
p.Add<Passes.Rules.Ncnn.LowerSoftmax>();
p.Add<Passes.Rules.Ncnn.LowerUnary>();
p.Add<Passes.Rules.Ncnn.LowerBinary>();

p.Add<Passes.Rules.Ncnn.LowerCelu>();
p.Add<Passes.Rules.Ncnn.LowerClamp>();
p.Add<Passes.Rules.Ncnn.LowerConcat>();
p.Add<Passes.Rules.Ncnn.LowerConv>();
p.Add<Passes.Rules.Ncnn.LowerCumsum>();
p.Add<Passes.Rules.Ncnn.LowerElu>();

p.Add<Passes.Rules.Ncnn.LowerErf>();
p.Add<Passes.Rules.Ncnn.LowerHardSigmoid>();
p.Add<Passes.Rules.Ncnn.LowerHardSwish>();
p.Add<Passes.Rules.Ncnn.LowerInstanceNorm>();
p.Add<Passes.Rules.Ncnn.LowerLayerNorm>();
p.Add<Passes.Rules.Ncnn.LowerLRN>();
p.Add<Passes.Rules.Ncnn.LowerLSTM>();
p.Add<Passes.Rules.Ncnn.LowerPadding>();
p.Add<Passes.Rules.Ncnn.LowerPooling>();
p.Add<Passes.Rules.Ncnn.LowerPReLU>();
p.Add<Passes.Rules.Ncnn.LowerReduction>();

p.Add<Passes.Rules.Ncnn.LowerSELU>();
p.Add<Passes.Rules.Ncnn.LowerSigmoid>();
p.Add<Passes.Rules.Ncnn.LowerCrop>();
p.Add<Passes.Rules.Ncnn.LowerSoftplus>();
p.Add<Passes.Rules.Ncnn.LowerSlice>();
p.Add<Passes.Rules.Ncnn.LowerTile>();
p.Add<Passes.Rules.Ncnn.LowerPermute>();
p.Add<Passes.Rules.Ncnn.LowerMatmul>();
p.Add<Passes.Rules.Ncnn.LowerConvTranspose>();
p.Add<Passes.Rules.Ncnn.LowerCast>();
p.Add<Passes.Rules.Ncnn.LowerGELU>();

p.Add<Passes.Rules.Neutral.FoldTwoReshapes>();
p.Add<Passes.Rules.Neutral.FoldNopReshape>();
p.Add<Passes.Rules.Ncnn.LowerReshape>();

// p.Add<Passes.Rules.Ncnn.LowerDequantize>(); // ncnn dequantize int to float.
});

passManager.AddWithName<DataflowPass>("RemoveGlueOp").Configure(p =>
{
p.Add<Passes.Rules.Neutral.FoldConstCall>();
p.Add<Passes.Rules.Neutral.FoldSqueezeUnsqueeze>();
p.Add<Passes.Rules.Neutral.FoldUnsqueezeSqueeze>();
});

passManager.AddWithName<DataflowPass>("RemoveSingleSqueezeAndUnsqueeze").Configure(p =>
{
p.Add<Passes.Rules.Ncnn.LowerSqueeze>();
p.Add<Passes.Rules.Ncnn.LowerUnsqueeze>();
});
}

/// <inheritdoc/>
Expand Down
8 changes: 8 additions & 0 deletions modules/Nncase.Modules.CPU/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,18 @@
"nncase.io": {
"type": "Project"
},
"nncase.modules.ncnn": {
"type": "Project",
"dependencies": {
"Nncase.CodeGen": "[1.0.0, )",
"Nncase.Passes": "[1.0.0, )"
}
},
"nncase.modules.stackvm": {
"type": "Project",
"dependencies": {
"Nncase.CodeGen": "[1.0.0, )",
"Nncase.Modules.Ncnn": "[1.0.0, )",
"Nncase.Passes": "[1.0.0, )"
}
},
Expand Down
Loading