Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onednn backend #1558

Merged
merged 32 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1c79904
initial dnnl backend
borg323 Oct 27, 2020
b8bf227
improve memory propagation
borg323 Nov 3, 2020
7c8b5c0
rename option to jit_cache
borg323 Nov 3, 2020
e39282f
use meson 0.55.3 on appveyor since 0.56.0 is broken (#1457)
borg323 Nov 1, 2020
04d1262
improve SELayer
borg323 Nov 3, 2020
1ad80de
cleanup
borg323 Nov 3, 2020
7df6f85
fix? for avx512
borg323 Nov 3, 2020
5787390
some comments and cleanup
borg323 Nov 4, 2020
48dd609
support for fp16 and gpu
borg323 Nov 7, 2020
9102811
allow using fixed batch size (default 32)
borg323 Nov 10, 2020
e978382
initialize layers early
borg323 Nov 10, 2020
f34de95
cache reorder primitives
borg323 Nov 10, 2020
35329ec
avoid reshapes in FCLayer
borg323 Nov 12, 2020
aed08b0
pass dnnl::memory to LoadWeights()
borg323 Nov 13, 2020
73c6872
add threads backend option
borg323 Nov 13, 2020
2f91b5f
fuse 2 inner product primitives
borg323 Nov 20, 2020
d1bb085
cleanup
borg323 Nov 27, 2020
0cdae72
rename backend to onednn
borg323 May 3, 2021
8b78865
Merge branch 'master' into onednn_back
borg323 May 3, 2021
5dd4cd7
convolution algorithm selection
borg323 May 7, 2021
93d2ff4
small fix
borg323 May 7, 2021
c65f898
binary post-op for gpu only
borg323 May 7, 2021
1267137
add comment
borg323 May 7, 2021
b48279d
use multiple batch size steps
borg323 May 8, 2021
7b0aedf
cleanup
borg323 May 8, 2021
8a3a309
sane defaults
borg323 May 8, 2021
696666e
allow winograd only on cpu
borg323 May 9, 2021
2348880
add to appveyor
borg323 May 11, 2021
d70d758
fix typo
borg323 May 11, 2021
78bb52e
fix copyright years
borg323 May 11, 2021
66ce015
more fine grained locking
borg323 Jun 11, 2021
4039ad6
Merge branch 'master' into onednn_back
borg323 Jun 16, 2021
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
10 changes: 9 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ environment:
- NAME: gpu-opencl
- NAME: cpu-dnnl
- NAME: cpu-openblas
- NAME: onednn
- NAME: android
for:
-
Expand All @@ -26,6 +27,7 @@ install:
- cmd: set DX=false
- cmd: set OPENCL=false
- cmd: set BLAS=false
- cmd: set ONEDNN=false
- cmd: set GTEST=false
- cmd: set ANDROID=false
- cmd: IF %NAME%==android set ANDROID=true
Expand All @@ -37,12 +39,17 @@ install:
- cmd: IF %NAME%==cpu-dnnl set BLAS=true
- cmd: IF %NAME%==cpu-openblas set BLAS=true
- cmd: IF %NAME%==cpu-openblas set GTEST=true
- cmd: IF %NAME%==onednn set ONEDNN=true
- cmd: set NET=744005
- cmd: set NET_HASH=cfc447842108ee9a830a410edb5c38a8601953ba165edc99beb9586546c7d11b
- cmd: IF NOT %BLAS%==true IF NOT %ANDROID%==true set NET=751390
- cmd: IF NOT %BLAS%==true IF NOT %ANDROID%==true set NET_HASH=e3592daea3b2be14c9fdfaf0d486b6154471195de9717f713263b9a0a1cbef72
- cmd: IF %NAME%==cpu-dnnl IF NOT EXIST C:\cache\dnnl_win_1.5.0_cpu_vcomp appveyor DownloadFile https://github.com/oneapi-src/oneDNN/releases/download/v1.5/dnnl_win_1.5.0_cpu_vcomp.zip
- cmd: IF %NAME%==cpu-dnnl IF NOT EXIST C:\cache\dnnl_win_1.5.0_cpu_vcomp 7z x dnnl_win_1.5.0_cpu_vcomp.zip -oC:\cache
- cmd: set DNNL_NAME=dnnl_win_1.5.0_cpu_vcomp
- cmd: IF %NAME%==onednn IF NOT EXIST C:\cache\dnnl_win_1.8.0_cpu_vcomp appveyor DownloadFile https://github.com/oneapi-src/oneDNN/releases/download/v1.8/dnnl_win_1.8.0_cpu_vcomp.zip
- cmd: IF %NAME%==onednn IF NOT EXIST C:\cache\dnnl_win_1.8.0_cpu_vcomp 7z x dnnl_win_1.8.0_cpu_vcomp.zip -oC:\cache
- cmd: IF %NAME%==onednn set DNNL_NAME=dnnl_win_1.8.0_cpu_vcomp
- cmd: IF %NAME%==cpu-openblas IF NOT EXIST C:\cache\OpenBLAS appveyor DownloadFile https://sjeng.org/ftp/OpenBLAS-0.3.3-win-oldthread.zip
- cmd: IF %NAME%==cpu-openblas IF NOT EXIST C:\cache\OpenBLAS 7z x OpenBLAS-0.3.3-win-oldthread.zip -oC:\cache\OpenBLAS
- cmd: IF %OPENCL%==true nuget install opencl-nug -Version 0.777.77 -OutputDirectory C:\cache
Expand Down Expand Up @@ -101,7 +108,8 @@ before_build:
- cmd: IF %APPVEYOR_REPO_TAG%==true IF %ANDROID%==true SET EMBED=true
- cmd: SET EXTRA=
- cmd: IF %NAME%==cpu-dnnl SET EXTRA=-Db_vscrt=md
- cmd: IF %ANDROID%==false meson build --backend vs2017 --buildtype release -Dgtest=%GTEST% -Dopencl=%OPENCL% -Dblas=%BUILD_BLAS% -Ddnnl=true -Ddx=%DX% -Dcudnn=%CUDNN% -Dispc_native_only=false -Dpopcnt=false -Dcudnn_include="%CUDA_PATH%\include","%CUDA_PATH%\cuda\include" -Dcudnn_libdirs="%CUDA_PATH%\lib\x64","%CUDA_PATH%\cuda\lib\x64" -Dopenblas_include="%PKG_FOLDER%\OpenBLAS\dist64\include" -Dopenblas_libdirs="%PKG_FOLDER%\OpenBLAS\dist64\lib" -Ddnnl_dir="%PKG_FOLDER%\dnnl_win_1.5.0_cpu_vcomp" -Dopencl_include="%PKG_FOLDER%\opencl-nug.0.777.77\build\native\include" -Dopencl_libdirs="%PKG_FOLDER%\opencl-nug.0.777.77\build\native\lib\x64" -Ddefault_library=static %EXTRA%
- cmd: IF %NAME%==onednn SET EXTRA=-Db_vscrt=md
- cmd: IF %ANDROID%==false meson build --backend vs2017 --buildtype release -Dgtest=%GTEST% -Dopencl=%OPENCL% -Dblas=%BUILD_BLAS% -Ddnnl=true -Ddx=%DX% -Dcudnn=%CUDNN% -Donednn=%ONEDNN% -Dispc_native_only=false -Dpopcnt=false -Dcudnn_include="%CUDA_PATH%\include","%CUDA_PATH%\cuda\include" -Dcudnn_libdirs="%CUDA_PATH%\lib\x64","%CUDA_PATH%\cuda\lib\x64" -Dopenblas_include="%PKG_FOLDER%\OpenBLAS\dist64\include" -Dopenblas_libdirs="%PKG_FOLDER%\OpenBLAS\dist64\lib" -Ddnnl_dir="%PKG_FOLDER%\%DNNL_NAME%" -Dopencl_include="%PKG_FOLDER%\opencl-nug.0.777.77\build\native\include" -Dopencl_libdirs="%PKG_FOLDER%\opencl-nug.0.777.77\build\native\lib\x64" -Ddefault_library=static %EXTRA%
- cmd: IF %ANDROID%==true meson arm64-v8a --buildtype release -Dgtest=false -Dopenblas_include="%PKG_FOLDER%\OpenBLAS\android-aarch64\include" -Dopenblas_libdirs="%PKG_FOLDER%\OpenBLAS\android-aarch64\lib" -Dembed=%EMBED% -Ddefault_library=static --cross-file crossfile-aarch64
- cmd: IF %ANDROID%==true meson armeabi-v7a --buildtype release -Dgtest=false -Dopenblas_include="%PKG_FOLDER%\OpenBLAS\android-armv7a\include" -Dopenblas_libdirs="%PKG_FOLDER%\OpenBLAS\android-armv7a\lib" -Dembed=%EMBED% -Ddefault_library=static --cross-file crossfile-armv7a -Dispc=false -Dneon=false
build_script:
Expand Down
10 changes: 10 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,16 @@ if get_option('build_backends')
has_backends = true
endif

if get_option('onednn') and dnnl_lib.found()
includes += include_directories(get_option('dnnl_dir') + '/include')
deps += [ dnnl_lib, dependency('openmp', required:true) ]
files += [
'src/neural/onednn/network_onednn.cc',
'src/neural/onednn/layers.cc',
]
has_backends = true
endif

endif # if get_option('build_backends')

if not has_backends and get_option('build_backends')
Expand Down
5 changes: 5 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ option('tensorflow',
value: false,
description: 'Enable TensorFlow backend')

option('onednn',
type: 'boolean',
value: true,
description: 'Enable oneDNN backend')

option('openblas',
type: 'boolean',
value: true,
Expand Down
1 change: 1 addition & 0 deletions scripts/appveyor_win_build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ IF ERRORLEVEL 1 EXIT
cd build
IF %NAME%==cpu-openblas copy C:\cache\OpenBLAS\dist64\bin\libopenblas.dll
IF %NAME%==cpu-dnnl copy C:\cache\dnnl_win_1.5.0_cpu_vcomp\bin\dnnl.dll
IF %NAME%==onednn copy C:\cache\dnnl_win_1.8.0_cpu_vcomp\bin\dnnl.dll
IF %PGO%==true (
IF %OPENCL%==true copy C:\cache\opencl-nug.0.777.77\build\native\bin\OpenCL.dll
IF %CUDA%==true copy "%CUDA_PATH%"\bin\*.dll
Expand Down
5 changes: 5 additions & 0 deletions scripts/appveyor_win_package.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type COPYING |more /P > dist\COPYING
IF %CUDA%==true copy lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%-nodll.zip
IF %NAME%==cpu-openblas 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip C:\cache\OpenBLAS\dist64\bin\libopenblas.dll
IF %NAME%==cpu-dnnl 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip C:\cache\dnnl_win_1.5.0_cpu_vcomp\bin\dnnl.dll
IF %NAME%==onednn 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip C:\cache\dnnl_win_1.8.0_cpu_vcomp\bin\dnnl.dll
IF %OPENCL%==true 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip C:\cache\opencl-nug.0.777.77\build\native\bin\OpenCL.dll
IF %CUDNN%==true 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip "%CUDA_PATH%\bin\cudart64_100.dll" "%CUDA_PATH%\bin\cublas64_100.dll"
IF %CUDNN%==true 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip "%CUDA_PATH%\cuda\bin\cudnn64_7.dll"
Expand All @@ -15,6 +16,10 @@ IF %NAME%==cpu-dnnl copy "%PKG_FOLDER%\dnnl_win_1.5.0_cpu_vcomp\LICENSE" dist\DN
IF %NAME%==cpu-dnnl copy "%PKG_FOLDER%\dnnl_win_1.5.0_cpu_vcomp\THIRD-PARTY-PROGRAMS" dist\DNNL-THIRD-PARTY-PROGRAMS
IF %NAME%==cpu-dnnl 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip .\dist\DNNL-LICENSE
IF %NAME%==cpu-dnnl 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip .\dist\DNNL-THIRD-PARTY-PROGRAMS
IF %NAME%==onednn copy "%PKG_FOLDER%\dnnl_win_1.8.0_cpu_vcomp\LICENSE" dist\DNNL-LICENSE
IF %NAME%==onednn copy "%PKG_FOLDER%\dnnl_win_1.8.0_cpu_vcomp\THIRD-PARTY-PROGRAMS" dist\DNNL-THIRD-PARTY-PROGRAMS
IF %NAME%==onednn 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip .\dist\DNNL-LICENSE
IF %NAME%==onednn 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip .\dist\DNNL-THIRD-PARTY-PROGRAMS
IF %OPENCL%==true type scripts\check_opencl.bat |more /P > dist\check_opencl.bat
IF %OPENCL%==true 7z a lc0-%APPVEYOR_REPO_TAG_NAME%-windows-%NAME%.zip .\dist\check_opencl.bat
IF %DX%==true type scripts\check_dx.bat |more /P > dist\check_dx.bat
Expand Down
Loading