29 Commits

Author SHA1 Message Date
nihui 5ea98309e3 layer param hardening (#7003)
* harden layer parameter validation

Original patches and author identities:
https://github.com/Tencent/ncnn/pull/6912 (beilzx)
https://github.com/Tencent/ncnn/pull/6919 (FluxMind-O)
https://github.com/Tencent/ncnn/pull/6928 (lxcxjxhx)
https://github.com/Tencent/ncnn/pull/6948 (ktz03)
https://github.com/Tencent/ncnn/pull/6950 (ktz03)
https://github.com/Tencent/ncnn/pull/6971 (LI)
https://github.com/Tencent/ncnn/pull/6974 (LI)
https://github.com/Tencent/ncnn/pull/6977 (LI)

Co-authored-by: beilzx <2069360659@qq.com>
Co-authored-by: FluxMind-O <3283918317@qq.com>
Co-authored-by: lxcxjxhx <lxcxjxhx@users.noreply.github.com>
Co-authored-by: ktz03 <2484593937@qq.com>
Co-authored-by: LI <2484593937@qq.com>
2026-09-15 19:18:46 +08:00
nihui b440d37b88 fix vulkan bf16 packed without shaderInt16 (#6962)
Co-authored-by: blue wombat <219594305+aadpnde@users.noreply.github.com>
2026-09-07 10:46:50 +08:00
nihui b5bc05e2e8 drop vulkan shader pack8 (#6270) 2025-08-22 11:05:59 +08:00
nihui 171b9d1bba use spdx license header, copyright Tencent (#6152) 2025-07-08 11:01:29 +08:00
nihui 9f832c19c1 vulkan int8 packing quantize dequantize requantize (#3731)
* add int8 definitions
* packing vulkan int8/int32, quantize vulkan
* vulkan dequantize
* requantize vulkan
2025-06-26 10:47:25 +08:00
nihui 24a3b99f1f drop layer support_image_storage and option use_image_storage (#6126)
* fix pyncnn build
2025-06-16 11:23:41 +08:00
nihui 211e238639 drop layer forward vkimagemat (#6124)
vkimagemat was originally used as a mat storage in the hope of improving performance on old adreno gpus, but in fact it is slower than the cpu in most cases and is no longer suitable for the latest adreno architecture and large shapes
2025-06-14 10:36:47 +08:00
nihui 556b79ce4d create layer decoupled (#5258)
* create layer decoupled
* no more virtual public
* allow build test with shared library
* decouple cpu vulkan
* drop old scripts
2024-01-05 14:08:15 +08:00
nihui 249b264336 workaround moltenvk error on spec const composite op (#4714)
* workaround moltenvk error on spec const composite op

* workaround moltenvk crying on binding image with memory offset
2023-05-11 12:12:03 +08:00
nihui dadc640c66 x86 avx512 optimization (#3581)
* unified relu avx512

* unifed clip avx512

* unaryop avx512

* sigmoid avx512

* binaryop avx512

* padding convolution avx512

* convolutiondepthwise avx512

* innerproduct avx512

* reshape avx512

* slice avx512

* hardsigmoid hardswish avx512

* swish avx512

* pooling avx512

* crop avx512

* convolution sgemm pack16

* convolution 3x3 winograd pack16

* interp avx512

* convolution sgemm pack1to16

* convolution sgemm pack16to8

* convolution sgemm pack8to16

* convolution sgemm pack16to4

* fix vulkan permute pack8

* fix vulkan convolution gemm pack8to1
2022-04-09 17:23:27 +08:00
nihui cf20dbc0bd relu3d, batchnorm3d, reshape4d, flatten4d, permute4d (#3397)
Co-authored-by: ElvisYu <elvisyuovo@gmail.com>
Co-authored-by: 余浩文 <m18107220188@163.com>
Co-authored-by: nihui <nihui@users.noreply.github.com>
Co-authored-by: Zr2223 <67497651+Zr2223@users.noreply.github.com>
Co-authored-by: Zr2223 <Zr2223@users.noreply.github.com>
2021-12-05 19:55:04 +08:00
nihui f10cc6dd93 initial data structure changes for 3dcnn, conv3d, pooling3d (#3378)
Co-authored-by: ElvisYu <elvisyuovo@gmail.com>
Co-authored-by: 余浩文 <m18107220188@163.com>
Co-authored-by: Zr2223 <67497651+Zr2223@users.noreply.github.com>
2021-12-02 16:50:55 +08:00
nihui b413fd3a3d auto code-format bot and disable restyled (#3075) 2021-07-13 17:28:11 +08:00
nihuini 934a1a8e32 test flatten packing padding int8 2021-06-17 19:42:45 +08:00
nihuini 3915b5d496 arm neon optimization for packing fp16/bf16 pack8 family 2021-01-11 19:53:04 +08:00
nihui 54c0a13b9f build shared library (#2525)
* build shared lib and enable lto

* reserved for layer and option

* allocator pimpl

* datareader pimpl

* paramdict pimpl, disable copy assign for allocator and datareader

* modelbin pimpl

* net extractor pimpl

* gpu pimple

* disable copy assign vulkandevice, code format

* command pimpl, dummy image readonly

* pipeline pipelinecache pimpl, export platform class

* code format, export simple family

* update ci

* disable lto on android armv7, merge webassembly ci

* link libgcc, fix macos dylib version

* pipeline pimpl, gpu info pimpl

* destroy gpu info after vulkan device

* ignore msvc stl class warning

* fix ncnn_paramdict_get_float return type

* fix vktransfer upload fp16 without flatten, add command test
2021-01-01 22:55:10 +08:00
nihui cf3cf83cd3 unified image shader storage type (#2231)
* drop bug_layout_binding_id_alias flag
2020-10-21 17:16:21 +08:00
nihuini 985c15ed33 packing pack8 conversion arm fp16s 2020-08-20 16:37:17 +08:00
Tijmen Verhulsdonck d1b5711791 X86 Elempack 8 AVX implementations. (#1853)
* added avx implementations of FC and Max pool

* Specify AVX2

* Small fixes and using Fused avx activations

* fix type casting

* fixing some CI errors

* Fix code format

* fix pooling test

* remove vector typedef

* More compile fixes

* remove vector typedef

* set c++ version to 17

* Force c++ 17

* Fixing mathfun

* Try and workaround typedef issues

* typefix

* Remove typedef

* switch to static inline

* attempting to fix msvc bug

* Verified MSVX FIX

* Fixing clang build

* commit before switch

* More avx and packing implementation

* Fix ctest

* starting the depthwise pack 8 implementation

* Unrolled loop

* add depthwise pack 8 implementations

* Working 1x1 pack 8 implementation added

* revert incorrect changes

* added conact elempack 8

* more elempack enabled layers added and started on the conversion of the winograd pack4 conv 3x3

* Added code formatting

* fix styling

* Unroll loops

* unrolling loops

* Added more elempac layers for mobilenet v3

* revert commit

* fix code style

* remove arm neon references

* remove pack4 references

* More cleanup

* added packing avx code

* fixing linux build ctests

* remove usage of aligned loads

* More aligned mem ops removed

* Cleanup, revert some files and remove not working winograd and shufflechannel implementation

* add stackoverflow referal

* Fix windows build

* Restyled by clang-format

* Restyled by astyle

* Restyled by clang-format

* Restyled by astyle

* implement requested chaanges

* remove reshape

* revert arm file change

* Restyled by clang-format

* Restyled by astyle

* Restyled by clang-format

* Restyled by astyle

* fix unterminated directive

Co-authored-by: Restyled.io <commits@restyled.io>
2020-06-20 10:15:23 +08:00
nihui 3ef995ed1e format code style and setup restyled.io (#1840) 2020-06-13 22:17:51 +08:00
nihui 8fec0038ba fix ci test 2020-06-01 22:30:49 +08:00
nihuini 4a624c636b skip image tests on unsupported platforms 2020-06-01 19:27:26 +08:00
nihuini b9e9b99e56 reuse device packing and unpacking, noop test, fix packing test 2020-05-08 15:07:48 +08:00
nihui 9a9a618229 image storage is mandatory, less options makes life easier 2020-05-08 00:09:35 +08:00
nihui e8688b042f fuse packing cast storage, binaryop image shader, dummy buffer and image, device-wide utility packing converter operators, fix multi-blob layer test 2020-05-05 21:31:07 +08:00
nihui 62da1228e1 adreno image shader + fp16 + fp16a (#1714)
* wip

* wip

* fix

* image and imageview can not be destroyed until command execution ends

* fast copy path for tightly packed data

* wip

* texture load works

* 1d 3d image

* record clone image, multiple commands share one image reference

* upload download image

* layer forward accept vkimagemat

* vkimagemat graph works

* staging vkimagemat for passing dynamic parameters, macro for fp32+image shader, padding image shader

* vkimagemat elemsize

* convolution test pass

* conv1x1s1 image shader

* fast staging image allocator from host memory, pooling image shader

* convolutiondepthwise image shader

* innerproduct image shader

* packing image shader

* crop deconvolution image shader

* resolve spirv binding types

* image fp16 and fp16a, cast image shader

* eltwise image shader

* wip

* absval image shader

* deconvolutiondepthwise image shader

* concat image shader, squeezenet works

* noop split image shader

* uniform precision hint

* layer support_image_storage

* wip

* vulkan device utility operator

* command is storage and packing option aware

* fallback to cpu on image allocation failed, mobilenetssd works

* flatten image shader, enable more test

* ci test

* check imgfp32 imgfp16 imgfp16a features

* fix ci test

* fix ci test

* upgrade swiftshader

* wip

* opt aggressive

* imgfp16p

* opt none

* convolution winograd image shader

* fix flush range, fast copy path for continous buffer

* minor fix

* fix innerproduct

* wip ...

* wip

* cast fix

* packing test

* wip

* image fp16p is fp16p

* wip

* silence

* more line info

* code clean

* softmax image shader
2020-04-30 17:08:30 +08:00
nihui 979dd5fd11 test does not need to provide data type options 2020-04-12 19:28:04 +08:00
nihui 0f7e7bca02 shader shape specialization constant and basic local group size partition (#1523)
* use Mat class for Shape description

* shape specialization constant in compute shader

* wip

* wip

* test forward_inplace, add binaryop unaryop sigmoid test

* fix arm unaryop test

* fix arm binaryop test

* make shape hint optional, cast int8 to fp32, add cast test

* wip

* follow the good and old local size setting for conv1x1

* the optimal local size rewrite

* fix build on msvc

* add permute shader for all packing layout, add permute test

* concat and slice patial shape constant, slice test

* fix slice test

* interp test

* add lrn test, test packing layout implicitly

* add eltwise test

* add normalize test

* add instancenorm test

* reorg shape constant

* simple local group size partition

* add shape constant param
2020-02-17 15:45:29 +08:00
nihui 3f987808ca add packing test 2020-01-07 22:41:50 +08:00