Yesterday i had asked in discord stockfish-nnue- general and -help and got no answer.
Today the same game.
Really, no one is interested?
Where is the hero who makes a arm-8 compile for the 256x nn.bin?
Please,make the world a better place

Moderators: hgm, Dann Corbit, Harvey Williamson
Skynet "Well, before making android engine i've put the nn.bin file in src/eval folder, here is simple lto arm8 engine (non pgo). First of all, when Droidfish or Chess for Android GUIs loading the engine, they not providing any information about nn.bin if it was loaded or not." "Almost all android devices has the same path / directory to the internal memory,Thomas Lagershausen wrote: ↑Mon Jul 20, 2020 5:31 pmSorry for asking here.
Yesterday i had asked in discord stockfish-nnue- general and -help and got no answer.
Today the same game.
Really, no one is interested?
Where is the hero who makes a arm-8 compile for the 256x nn.bin?
Please,make the world a better place![]()
Code: Select all
diff --git a/src/Makefile b/src/Makefile
index 2e6c415d..b47aacf0 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -312,8 +312,10 @@ endif
ifeq ($(COMP),clang)
comp=clang
- CXX=clang++
- CXXFLAGS += -pedantic -Wextra -Wshadow
+# CXX=clang++
+ p=$(ANDROID_BASE)/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin
+ CXX=$(p)/aarch64-linux-android24-clang++
+ CXXFLAGS += -Wall -DIS_ARM
ifneq ($(KERNEL),Darwin)
ifneq ($(KERNEL),OpenBSD)
@@ -388,7 +390,7 @@ ifneq ($(comp),mingw)
ifneq ($(OS),Android)
# Haiku has pthreads in its libroot, so only link it in on other platforms
ifneq ($(KERNEL),Haiku)
- LDFLAGS += -lpthread
+# LDFLAGS += -lpthread
endif
endif
endif
@@ -532,6 +534,8 @@ ifeq ($(OS), Android)
LDFLAGS += -fPIE -pie
endif
+LDFLAGS += -static
+
### ==========================================================================
### Section 4. Public Targets
### ==========================================================================
diff --git a/src/eval/nnue/nnue_common.h b/src/eval/nnue/nnue_common.h
index cffb0098..549e05ca 100644
--- a/src/eval/nnue/nnue_common.h
+++ b/src/eval/nnue/nnue_common.h
@@ -13,6 +13,8 @@
#include <tmmintrin.h>
#elif defined(USE_SSE2)
#include <emmintrin.h>
+#elif defined(IS_ARM)
+#include <arm_neon.h>
#endif
namespace Eval {
Hi Peter, can you help me with my batch file here? viewtopic.php?p=853009#p853009petero2 wrote: ↑Fri Jul 24, 2020 2:12 pmHere is a version for 64-bit Android that should work at least for Android 7 and later:
https://www.dropbox.com/s/zz6cgi5kxbupd ... api24?dl=1
I needed a small patch to enable ARM NEON vector instructions, which on my Galaxy S10 phone makes the engine about 2.75x faster than without vector instructions. This is still only around 30% of the regular Stockfish speed, so not as good as on Intel hardware.
I don't know how vector instructions affect thermal throttling though. The speedup for longer searches using more cores may be different.
I used the following patch for the nodchip code to enable ARM NEON vector instructions:Code: Select all
diff --git a/src/Makefile b/src/Makefile index 2e6c415d..b47aacf0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -312,8 +312,10 @@ endif ifeq ($(COMP),clang) comp=clang - CXX=clang++ - CXXFLAGS += -pedantic -Wextra -Wshadow +# CXX=clang++ + p=$(ANDROID_BASE)/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin + CXX=$(p)/aarch64-linux-android24-clang++ + CXXFLAGS += -Wall -DIS_ARM ifneq ($(KERNEL),Darwin) ifneq ($(KERNEL),OpenBSD) @@ -388,7 +390,7 @@ ifneq ($(comp),mingw) ifneq ($(OS),Android) # Haiku has pthreads in its libroot, so only link it in on other platforms ifneq ($(KERNEL),Haiku) - LDFLAGS += -lpthread +# LDFLAGS += -lpthread endif endif endif @@ -532,6 +534,8 @@ ifeq ($(OS), Android) LDFLAGS += -fPIE -pie endif +LDFLAGS += -static + ### ========================================================================== ### Section 4. Public Targets ### ========================================================================== diff --git a/src/eval/nnue/nnue_common.h b/src/eval/nnue/nnue_common.h index cffb0098..549e05ca 100644 --- a/src/eval/nnue/nnue_common.h +++ b/src/eval/nnue/nnue_common.h @@ -13,6 +13,8 @@ #include <tmmintrin.h> #elif defined(USE_SSE2) #include <emmintrin.h> +#elif defined(IS_ARM) +#include <arm_neon.h> #endif namespace Eval {
Awesome!! Everything runs fine!! I get 180knps in the startposition on one thread on a Kirin 710. SF 110720 gets 530knps (so I'm at 34%).petero2 wrote: ↑Fri Jul 24, 2020 2:12 pmHere is a version for 64-bit Android that should work at least for Android 7 and later:
https://www.dropbox.com/s/zz6cgi5kxbupd ... api24?dl=1
I needed a small patch to enable ARM NEON vector instructions, which on my Galaxy S10 phone makes the engine about 2.75x faster than without vector instructions. This is still only around 30% of the regular Stockfish speed, so not as good as on Intel hardware.
I don't know how vector instructions affect thermal throttling though. The speedup for longer searches using more cores may be different.
I used the following patch for the nodchip code to enable ARM NEON vector instructions:Code: Select all
diff --git a/src/Makefile b/src/Makefile index 2e6c415d..b47aacf0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -312,8 +312,10 @@ endif ifeq ($(COMP),clang) comp=clang - CXX=clang++ - CXXFLAGS += -pedantic -Wextra -Wshadow +# CXX=clang++ + p=$(ANDROID_BASE)/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin + CXX=$(p)/aarch64-linux-android24-clang++ + CXXFLAGS += -Wall -DIS_ARM ifneq ($(KERNEL),Darwin) ifneq ($(KERNEL),OpenBSD) @@ -388,7 +390,7 @@ ifneq ($(comp),mingw) ifneq ($(OS),Android) # Haiku has pthreads in its libroot, so only link it in on other platforms ifneq ($(KERNEL),Haiku) - LDFLAGS += -lpthread +# LDFLAGS += -lpthread endif endif endif @@ -532,6 +534,8 @@ ifeq ($(OS), Android) LDFLAGS += -fPIE -pie endif +LDFLAGS += -static + ### ========================================================================== ### Section 4. Public Targets ### ========================================================================== diff --git a/src/eval/nnue/nnue_common.h b/src/eval/nnue/nnue_common.h index cffb0098..549e05ca 100644 --- a/src/eval/nnue/nnue_common.h +++ b/src/eval/nnue/nnue_common.h @@ -13,6 +13,8 @@ #include <tmmintrin.h> #elif defined(USE_SSE2) #include <emmintrin.h> +#elif defined(IS_ARM) +#include <arm_neon.h> #endif namespace Eval {
Small 7.5 MB net ,size halfkp_96x32x32 ,Komodo playing level or maybe slightly better,very fast.With binaries.
https://gofile.io/d/1OgCOc
Hi Peter!petero2 wrote: ↑Fri Jul 31, 2020 6:40 pmI used static linking (-static) to make the engine work on more android devices. This makes the compiled file a lot larger though.Aleksei wrote: ↑Wed Jul 29, 2020 11:53 pmI managed to make android version (from nodechip source) using standalone toolchain, and i want to ask you something. Why your compilation is 1.446 KB while mine is 723 KB, also your is faster about 200 nps, did you make it on Linux PC? Or there is another way for engines compiling with NDK's clang?
The speed difference is probably because I enabled ARM NEON vector instructions (-DIS_ARM). To make this work I had to add an include file to nnue_common.h. For details see:
viewtopic.php?f=2&t=74515&p=853010#p853010
Code: Select all
+# CXX=clang++
+ p=$(ANDROID_BASE)/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin
+ CXX=$(p)/aarch64-linux-android24-clang++
+ CXXFLAGS += -Wall -DIS_ARM
+# LDFLAGS += -lpthread
+#elif defined(IS_ARM)
+#include <arm_neon.h>
Hi petero2, your Android compilation that enable NEON vector instructions and NNUE nets is great !petero2 wrote: ↑Fri Jul 24, 2020 2:12 pmHere is a version for 64-bit Android that should work at least for Android 7 and later:
https://www.dropbox.com/s/zz6cgi5kxbupd ... api24?dl=1
I needed a small patch to enable ARM NEON vector instructions, which on my Galaxy S10 phone makes the engine about 2.75x faster than without vector instructions. This is still only around 30% of the regular Stockfish speed, so not as good as on Intel hardware.
I don't know how vector instructions affect thermal throttling though. The speedup for longer searches using more cores may be different.