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

Occur an ASM error when compiling arm_nn_mat_mul_core_4x_s8 #87

Closed
WORsjlt opened this issue Nov 21, 2023 · 11 comments
Closed

Occur an ASM error when compiling arm_nn_mat_mul_core_4x_s8 #87

WORsjlt opened this issue Nov 21, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@WORsjlt
Copy link

WORsjlt commented Nov 21, 2023

Processor: Cortex-M55
Error message:
cmsis-nn/Source/NNSupportFunctions/arm_nn_mat_mul_core_4x_s8.c: In function 'arm_nn_mat_mul_core_4x_s8':
/(my project path)/cmsis-nn/Include/Internal/arm_nn_compiler.h:97:23: error: 'asm' operand has impossible constraints
97 | #define __ASM __asm
| ^~~~~
cmsis-nn/Source/NNSupportFunctions/arm_nn_mat_mul_core_4x_s8.c:84:9: note: in expansion of macro '__ASM'
84 | __ASM volatile(" .p2align 2 \n"
| ^~~~~

Why is this happening? And how to fix it?
Appreciate!

@mansnils mansnils added the bug Something isn't working label Nov 21, 2023
@mansnils
Copy link
Contributor

Hi @WORsjlt
Thanks for reporting this. What compiler and version are you using?

@mansnils
Copy link
Contributor

Also would like to check if it may be related to compiler options?
https://github.com/ARM-software/CMSIS-NN#compiler-options

@WORsjlt
Copy link
Author

WORsjlt commented Nov 22, 2023

Hi @mansnils
Here is the output message about compiler and version when compiling:
GNU C17 (Arm GNU Toolchain 11.3.Rel1) version 11.3.1 20220712 (arm-none-eabi)
compiled by GNU C version 4.8.5 20150623 (Red Hat 4.8.5-44), GMP version 6.2.1, MPFR version 3.1.6, MPC version 1.0.3, isl version isl-0.15-1-g835ea3a-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 801c9e4705ed9ec92526a3ce66f3ab92
GNU assembler version 2.38 (arm-none-eabi) using BFD version (Arm GNU Toolchain 11.3.Rel1) 2.38.20220708

Hope it helps!

@mansnils
Copy link
Contributor

It looks like a supported compiler. Question is how to reproduce this. Do you build like described here: https://github.com/ARM-software/CMSIS-NN#building-cmsis-nn-as-a-library
Or do you set some custom build options?

@WORsjlt
Copy link
Author

WORsjlt commented Nov 22, 2023

I tried to build cmsis-nn inside a project using Nuttx. I defined -DTARGET_CPU=cortex-m55 and some custom options, but I'm not sure which option produces this. Here are some options filtering out header files:
-imultilib thumb/v8-m.main+dp/hard -iprefix /(my project path)/prebuilts/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/ -isysroot /(my project path)/prebuilts/gcc/linux/arm/bin/../arm-none-eabi -D__USES_INITFINI__ -D NuttX -isystem /(my project path)/nuttx/include cmsis-nn/Source/NNSupportFunctions/arm_nn_mat_mul_core_4x_s8.c -quiet -dumpdir cmsis-nn/Source/NNSupportFunctions/ -dumpbase arm_nn_mat_mul_core_4x_s8.c.(my project path).cmsis-nn.c -dumpbase-ext .c -mlittle-endian -mtune=cortex-m55 -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -mlibarch=armv8.1-m.main+fp.dp+mve.fp -march=armv8.1-m.main+fp.dp+mve.fp
-EL -march=armv8.1-m.main+fp.dp+mve.fp -mfloat-abi=hard -mfpu=fpv5-d16 -meabi=5 -mthumb -mimplicit-it=always

@felix-johnny
Copy link
Contributor

@WORsjlt The optimization level is missing in this. Could you try with atleast -O1 or higher?

@WORsjlt
Copy link
Author

WORsjlt commented Nov 22, 2023

@felix-johnny I used -O3.

@mansnils
Copy link
Contributor

@WORsjlt Could you post the complete line from above (...arm_nn_mat_mul_core_4x_s8.c -quiet -dumpdir ...) with all compiler options?

@WORsjlt
Copy link
Author

WORsjlt commented Nov 22, 2023

@mansnils Sure! Some of the project information has been removed for personal academic reasons. Sorry about that.

COLLECT_GCC_OPTIONS='-c' '-Wstrict-prototypes' '-Wno-attributes' '-Wno-unknown-pragmas' '-Wno-psabi' '-nostdlib' '-pipe' '-O3' '-fno-strict-aliasing' '-fno-omit-frame-pointer' '-fno-optimize-sibling-calls' '-funwind-tables' '-fasynchronous-unwind-tables' '-fno-common' '-Wall' '-Wshadow' '-Wundef' '-ffunction-sections' '-fdata-sections' '-g' '-mlittle-endian' '-mtune=cortex-m55' '-mfpu=fpv5-d16' '-mfloat-abi=hard' '-mthumb' '-isystem' '-D' 'NuttX' '-Wno-cpp' '-v' '-o' 'cmsis-nn/Source/NNSupportFunctions/arm_nn_mat_mul_core_4x_s8.c.(my project path).cmsis-nn.o' '-mlibarch=armv8.1-m.main+fp.dp+mve.fp' '-march=armv8.1-m.main+fp.dp+mve.fp' '-dumpdir' 'cmsis-nn/Source/NNSupportFunctions/' /(my project path)/prebuilts/gcc/linux/arm/bin/../libexec/gcc/arm-none-eabi/11.3.1/cc1 -quiet -v thumb/v8-m.main+dp/hard -iprefix /(my project path)/prebuilts/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/ -isysroot /(my project path)/prebuilts/gcc/linux/arm/bin/../arm-none-eabi -D__USES_INITFINI__ -D NuttX -isystem /(my project path)/nuttx/include cmsis-nn/Source/NNSupportFunctions/arm_nn_mat_mul_core_4x_s8.c -quiet -dumpdir cmsis-nn/Source/NNSupportFunctions/ -dumpbase arm_nn_mat_mul_core_4x_s8.c.(my project path).cmsis-nn.c -dumpbase-ext .c -mlittle-endian -mtune=cortex-m55 -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -mlibarch=armv8.1-m.main+fp.dp+mve.fp -march=armv8.1-m.main+fp.dp+mve.fp -g -O3 -Wstrict-prototypes -Wno-attributes -Wno-unknown-pragmas -Wno-psabi -Wall -Wshadow -Wundef -Wno-cpp -version -fno-strict-aliasing -fno-omit-frame-pointer -fno-optimize-sibling-calls -funwind-tables -fasynchronous-unwind-tables -fno-common -ffunction-sections -fdata-sections -o - | /(my project path)/prebuilts/gcc/linux/arm/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/as -v -EL -march=armv8.1-m.main+fp.dp+mve.fp -mfloat-abi=hard -mfpu=fpv5-d16 -meabi=5 -mthumb -mimplicit-it=always -o cmsis-nn/Source/NNSupportFunctions/arm_nn_mat_mul_core_4x_s8.c.(my project path).cmsis-nn.o

@mansnils
Copy link
Contributor

Can you try without -fno-omit-frame-pointer?

@WORsjlt
Copy link
Author

WORsjlt commented Nov 23, 2023

Cancelling -fno-omit-frame-pointer works! Thank you very much! @mansnils @felix-johnny

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants