cancel
Showing results for 
Search instead for 
Did you mean: 

Server Gurus Discussions

afernandezody
Adept II

Errors while compiling with -mllvm

Hello AMD gurus,
I'm following the AOCC user guide to configure an EPYC-2 server with Ubuntu 18.04. My question is about flags as using target selection, code generation and the 1st group of optimization flags. The issues arise when I try to use the 'mllvm' group. When I throw everything (-O3 -ffast-math -march=znver2 -mllvm -agressive-loop-unswitch -enable-strided-vectorization -enable-epilog-vectorization -vectorize-memory-aggressively -enable-redundant-movs -merge-contant -function-specialize -lv-function-specialization -enable-vectorize-compares -inline-recursion -reduce-array-computations=3 -global-vectorize-slp -region-vectorize -nt-store-aggressive -enable-X86-prefetching -suppress-fmas), I get the error:

clang-9: error: clang-9: error: unknown argument: '-vectorize-memory-aggressively'
unknown argument: '-vectorize-memory-aggressively'
clang-9: error: unknown argument: '-merge-contant'
clang-9: error: unknown argument: '-merge-contant'
clang-9: error: unknown argument: '-function-specialize'
clang-9: error: unknown argument: '-function-specialize'
clang-9: error: unknown argument: '-inline-recursion'
clang-9: error: unknown argument: '-inline-recursion'
clang-9: error: unknown argument: '-reduce-array-computations=3'
clang-9: error: unknown argument: '-reduce-array-computations=3'
clang-9: error: unknown argument: '-global-vectorize-slp'
clang-9: error: unknown argument: '-global-vectorize-slp'
clang-9: error: unknown argument: '-region-vectorize'
clang-9: error: unknown argument: '-region-vectorize'
clang-9: error: unknown argument: '-nt-store-aggressive'
clang-9: error: unknown argument: '-nt-store-aggressive'
clang-9: error: unknown argument: '-suppress-fmas'
clang-9: error: unknown argument: '-suppress-fmas'
clang-9clang-9: warning: -lv-function-specialization: 'linker' input unused [-Wunused-command-line-argument]
: warning: -lv-function-specialization: 'linker' input unused [-Wunused-command-line-argument]
<builtin>: recipe for target 'src/main.o' failed
make: *** [src/main.o] Error 1
make: *** Waiting for unfinished jobs....
<builtin>: recipe for target 'src/CG.o' failed
make: *** [src/CG.o] Error 1

If I'm a bit more surgical and remove some of flags causing trouble (-O3 -ffast-math -march=znver2 -mllvm -agressive-loop-unswitch -enable-strided-vectorization -enable-epilog-vectorization -enable-redundant-movs -lv-function-specialization -enable-vectorize-compares -enable-X86-prefetching), I'm still getting the following errors

clang-9: warning: -lv-function-specialization: 'linker' input unused [-Wunused-command-line-argument]
clang-9: warning: -lv-function-specialization: 'linker' input unused [-Wunused-command-line-argument]
clang-9: warning: argument unused during compilation: '-e nable-strided-vectorization' [-Wunused-command-line-argument]clang-9: warning: argument unused during compilation: '-e nable-strided-vectorization' [-Wunused-command-line-argument]
clang-9: warning: argument unused during compilation: '-e nable-epilog-vectorization' [-Wunused-command-line-argument]
clang-9: warning: argument unused during compilation: '-e nable-redundant-movs' [-Wunused-command-line-argument]
clang-9: warning: argument unused during compilation: '-e nable-vectorize-compares' [-Wunused-command-line-argument]
clang-9
clang-9: warning: argument unused during compilation: '-e nable-epilog-vectorization' [-Wunused-command-line-argument]
clang-9: : warning: argument unused during compilation: '-e nable-redundant-movs' [-Wunused-command-line-argument]
clang-9: warning: argument unused during compilation: '-e nable-vectorize-compares' [-Wunused-command-line-argument]
clang-9: warning: argument unused during compilation: '-e nable-X86-prefetching' [-Wunused-command-line-argument]
warning: argument unused during compilation: '-e nable-X86-prefetching' [-Wunused-command-line-argument]
clang (LLVM option parsing)clang (LLVM option parsing): Unknown command line argument ': Unknown command line argument '-agressive-loop-unswitch'.  Try: 'clang (LLVM option parsing) --help'
clang (LLVM option parsing)-agressive-loop-unswitch'.  Try: 'clang (LLVM option parsing) --help'
clang (LLVM option parsing): Did you mean '  --aggressive-loop-unswitch'?
: Did you mean '  --aggressive-loop-unswitch'?
<builtin>: recipe for target 'src/main.o' failed
make: *** [src/main.o] Error 1
make: *** Waiting for unfinished jobs....
<builtin>: recipe for target 'src/CG.o' failed
make: *** [src/CG.o] Error 1

I'm unsure if there is something wrong or if all these flags should be invoked in a different fashion.
Thanks.

0 Likes
6 Replies

Dear AMD User,

 

Please note that Clang flags and LLVM flags are different. For LLVM flags, you need to pass -mllvm driver/flag to some of the optimization  that you mentioned in your flags. This -mllvm flag is the front end and get applied on the optimizer. I have modified flags that you mentioned as below

 

"-O3 -ffast-math -march=znver2 -floop-unswitch-aggressive -mllvm -enable-strided-vectorization -mllvm -enable-epilog-vectorization -mllvm -vectorize-memory-aggressively -mllvm -enable-redundant-movs -fmerge-all-constants -mllvm -function-specialize -mllvm -lv-function-specialization -mllvm -enable-vectorize-compares -mllvm -inline-recursion=2 -mllvm -reduce-array-computations=3 -mllvm -global-vectorize-slp -mllvm -region-vectorize -fnt-store=aggressive -mllvm -enable-X86-prefetching -mllvm -suppress-fmas"

 

Please go through AOCC 2.1 Clang compiler documentation for more details.( https://developer.amd.com/wp-content/resources/AOCC-2.1-Clang-the%20C%20C++%20Compiler.pdf )
 

 Happy Coding...!

Thanks!

0 Likes

Hi @ravitejak07,
I've begun to recompile some of my apps with AOCC 2.2 but it's unclear if the compilation has proceeded as desired. In order to try to vectorize, the flags read

CXXFLAGS     =  -O3 -mllvm -enable-strided-vectorization -mllvm -enable-epilog-vectorization -march=znver2 -mtune=znver2

It compiles all the files but, at the end, I'm getting the message:

clang-10: warning: argument unused during compilation: '-mllvm -enable-strided-vectorization' [-Wunused-command-line-argument]
clang-10: warning: argument unused during compilation: '-mllvm -enable-epilog-vectorization' [-Wunused-command-line-argument]

Thus, it doesn't seem that it vectorized any component of the code.
Thanks.

0 Likes

Dear AMD User,

Please note that LLVM related -enable-strided-vectorization and -enable-epilog-vectorization flags have to be used in specific conditions.

As per the documentation,

-enable-strided-vectorization: Enables effective use of gatherand scatter  kind  of  instruction  patterns.  This  flag  needs  to  be  used  along  with  the interleave vectorization flag i.e if your application have interleaved access, you need to pass related LLVM interleave flag

-enable-epilog-vectorization  : This  this  optimization  takes  effect  only when the original vector loop is vectorized with a vector width or factor of sixteen. This  vectorization  width  of  sixteen  may  be  overwritten  by-min-width-epilog-vectorization command line option.

Thanks

0 Likes

Hi @ravitejak07,
Sorry to have to reactivate the thread again. I was able to understand when to use the strided & epilog vectorizations but the compiler still doesn't seem to enable the vector library. I modified the flags by including -mllvm -vector-library=LIBMVEC. Everything goes well until the end when I get the warning:

clang-10: warning: argument unused during compilation: '-mllvm -vector-library=LIBMVEC' [-Wunused-command-line-argument]

As far as the mvec library, it's version 2.28 and located at /lib64 so it looks like correctly installed.
Thanks.   

0 Likes

Dear AMD user,

Sorry for the delay in reply.

Were you using this flag while linking?  If yes, please remove at this stage. You can use like below.

clang -mllvm -vector-library=LIBMVEC  -c sample.c

clang sample.o -lmvec -o sample

Hope this clarifies.

Thanks

0 Likes