UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor amslinger
Visitor
481 Views
Registered: ‎07-05-2018

"unrecognizable insn" when compiling Parsec Benchmarks

Jump to solution

I am trying to compile the Parsec Benchmarks for a Microblaze multicore. Unfortunately, the fluidanimate benchmark does not compile, as line 344 in pthreads.cpp causes an "unrecognizable insn" internal compiler error. The problem appears to be an issue with the floating-point conversion in the line above (and is unrelated to PThreads). I have created a small test case, which shows the same behavior.

int main()
{
	volatile float vec = 1.0;
	volatile int ci = 2;
	register int cj = (int)(vec);

	if (ci < 0) {
		ci = 0;
	}

	return cj;
}

Compiler output:

$ mb-gcc -v -O2 -mhard-float -mxl-float-convert test_case.c
Using built-in specs.
COLLECT_GCC=mb-gcc
COLLECT_LTO_WRAPPER=c:/xilinx/sdk/2018.3/gnu/microblaze/nt/bin/../libexec/gcc/microblaze-xilinx-elf/7.3.1/lto-wrapper.exe
Target: microblaze-xilinx-elf
Configured with: /proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_bld/target_build/src/gcc-custom/configure --build=x86_64-build_unknown-linux-gnu --host=x86_64-host_w64-mingw32 --target=microblaze-xilinx-elf --prefix=/proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_output --with-local-prefix=/proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_output/microblaze-xilinx-elf/sysroot --disable-libmudflap --with-sysroot=/proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_output/microblaze-xilinx-elf/sysroot --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG 1.20.0' --disable-__cxa_atexit --with-gmp=/proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_bld/target_build/microblaze-xilinx-elf/buildtools/complibs-host --with-mpfr=/proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_bld/target_build/microblaze-xilinx-elf/buildtools/complibs-host --with-mpc=/proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_bld/target_build/microblaze-xilinx-elf/buildtools/complibs-host --with-ppl=no --with-isl=no --with-cloog=no --with-libelf=/proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_bld/target_build/microblaze-xilinx-elf/buildtools/complibs-host --enable-lto --enable-target-optspace --without-long-double-128 --disable-libgomp --disable-libmudflap --disable-nls --disable-libstdcxx-pch --enable-languages=c,c++
Thread model: single
gcc version 7.3.1 20180425 (crosstool-NG 1.20.0)
COLLECT_GCC_OPTIONS='-v' '-O2' '-mhard-float' '-mxl-float-convert'
 c:/xilinx/sdk/2018.3/gnu/microblaze/nt/bin/../libexec/gcc/microblaze-xilinx-elf/7.3.1/cc1.exe -quiet -v -iprefix c:\xilinx\sdk\2018.3\gnu\microblaze\nt\bin\../lib/gcc/microblaze-xilinx-elf/7.3.1/ test_case.c -quiet -dumpbase test_case.c -mhard-float -mxl-float-convert -auxbase test_case -O2 -version -o C:\Users\amslinri\AppData\Local\Temp\ccas3Yjt.s
GNU C11 (crosstool-NG 1.20.0) version 7.3.1 20180425 (microblaze-xilinx-elf)
        compiled by GNU C version 4.8.0 20121031 (experimental), GMP version 5.0.1, MPFR version 3.0.1, MPC version 1.0.2, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/xilinx/sdk/2018.3/gnu/microblaze/nt/lib/gcc/../../lib/gcc/microblaze-xilinx-elf/7.3.1/include"
ignoring nonexistent directory "/proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_output/microblaze-xilinx-elf/sysroot/proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_output/lib/gcc/microblaze-xilinx-elf/7.3.1/../../../../include"
ignoring duplicate directory "c:/xilinx/sdk/2018.3/gnu/microblaze/nt/lib/gcc/../../lib/gcc/microblaze-xilinx-elf/7.3.1/include-fixed"
ignoring duplicate directory "c:/xilinx/sdk/2018.3/gnu/microblaze/nt/lib/gcc/../../lib/gcc/microblaze-xilinx-elf/7.3.1/../../../../microblaze-xilinx-elf/include"
ignoring nonexistent directory "/proj/sdk/gnu/microblaze/builds/HEAD/nightly/2018_11_29/rdi_scripts/../build/nt/ctng_output/microblaze-xilinx-elf/sysroot/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 c:\xilinx\sdk\2018.3\gnu\microblaze\nt\bin\../lib/gcc/microblaze-xilinx-elf/7.3.1/include
 c:\xilinx\sdk\2018.3\gnu\microblaze\nt\bin\../lib/gcc/microblaze-xilinx-elf/7.3.1/include-fixed
 c:\xilinx\sdk\2018.3\gnu\microblaze\nt\bin\../lib/gcc/microblaze-xilinx-elf/7.3.1/../../../../microblaze-xilinx-elf/include
End of search list.
GNU C11 (crosstool-NG 1.20.0) version 7.3.1 20180425 (microblaze-xilinx-elf)
        compiled by GNU C version 4.8.0 20121031 (experimental), GMP version 5.0.1, MPFR version 3.0.1, MPC version 1.0.2, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 76da5aca25a80f9fc438452dd1398ae2
test_case.c: In function 'main':
test_case.c:12:1: error: unrecognizable insn:
 }
 ^
(insn 42 41 13 2 (set (reg:SF 3 r3 [orig:42 vec.0_1 ] [42])
        (reg:SI 4 r4 [orig:43 ci.1_2 ] [43])) "test_case.c":7 -1
     (nil))
test_case.c:12:1: internal compiler error: in extract_insn, at recog.c:2311
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

The problem most likely involves another optimization flag, as it does not occur at "-O0". However, I cannot pinpoint this flag, as the error does not occur if I enable all flags returned by "-O2 -Q --help=optimizers".

What is the best way to circumvent the problem or get the bug fixed? I already posted a bug report at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89659. As I want to evaluate and publish the runtime of the benchmarks, I want to avoid altering the source code or disabling optimizations unnecessarily. I also dislike the idea, of replacing "-O2" by the individual flags, as I do not know, which one is missing and how much this will influence performance. Disabling hardware floating point support is not an option either, as this ruins performance.

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
384 Views
Registered: ‎04-05-2017

Re: "unrecognizable insn" when compiling Parsec Benchmarks

Jump to solution

There is a bug in peephole2 microblaze optimization.

peephole2 will substitute one sequence of instructions with another sequence. here It is trying to substitute {fint, Branch_cond}  to {fcmp, Branch_cond}  but  this was not properly implemented so we are seeing this issue.

-fno-peephole2 will disable this optimization. anyway we fixed this issue in latest builds.

7 Replies
Highlighted
Moderator
Moderator
431 Views
Registered: ‎10-06-2016

Re: "unrecognizable insn" when compiling Parsec Benchmarks

Jump to solution

Hi @amslinger ,

I'm able to reproduce your issue on my end as well but not sure about the root cause. I will try to reach toolchain developer team to see if it is a bug or we are missing somithing here, so will back to you once I get some feedback.

Regards


Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos
Xilinx Employee
Xilinx Employee
385 Views
Registered: ‎04-05-2017

Re: "unrecognizable insn" when compiling Parsec Benchmarks

Jump to solution

There is a bug in peephole2 microblaze optimization.

peephole2 will substitute one sequence of instructions with another sequence. here It is trying to substitute {fint, Branch_cond}  to {fcmp, Branch_cond}  but  this was not properly implemented so we are seeing this issue.

-fno-peephole2 will disable this optimization. anyway we fixed this issue in latest builds.

Visitor amslinger
Visitor
372 Views
Registered: ‎07-05-2018

Re: "unrecognizable insn" when compiling Parsec Benchmarks

Jump to solution

Adding "-fno-peephole2" to the flags makes the fluidanimate benchmark compile. As far as I can tell, the output looks correct, too. When testing the benchmark on x86 with and without the flag, I did not observe a significant difference in runtime. This is exactly what I was looking for.

Thanks for fixing the issue in the latest build. I did not manage to find the current build or its source online. As I do not assume, that I finish this project before XSDK 2019.1 releases, I will try it out once it is available for download.

0 Kudos
259 Views
Registered: ‎10-25-2017

Re: "unrecognizable insn" when compiling Parsec Benchmarks

Jump to solution

Hi @mbodapat 

I am using ISE 14.7 and facing this issue.

Can you guide me how  to use "-fno-peephole2".

Thanks

Uday

0 Kudos
Visitor amslinger
Visitor
243 Views
Registered: ‎07-05-2018

Re: "unrecognizable insn" when compiling Parsec Benchmarks

Jump to solution

Hi @udaykumarurimi 

I can only guide you in XSDK 2018.3, but it should be the same in all Eclipse based environments: Right click on your project and select "Properties". Then navigate to "C/C++ Build", "Settings", "MicroBlaze gcc compiler", "Optimization" (see screenshot). This dialog allows you to add additional optimization flags (like "-fno-peephole2"). Depending on your build settings, you might want to add the flag to all configurations (top of the window).

OptimizationSettings.PNG
213 Views
Registered: ‎10-25-2017

Re: "unrecognizable insn" when compiling Parsec Benchmarks

Jump to solution

Hi @amslinger 

Thanks for the clarification.

Hi @mbodapat 

You were saying that peephole2 is causing this "unrecognizable insn".

In my application, ISE 14.7, default  optimization level is set to None(-O0) and I am facing this issue.

If I set the optimazation to any other (-O1,-O2,-O3 & -Os) this problem in not there. What could be the reason?

0 Kudos
Xilinx Employee
Xilinx Employee
193 Views
Registered: ‎04-05-2017

Re: "unrecognizable insn" when compiling Parsec Benchmarks

Jump to solution

I am not seeing error with O0,O1,Os optimizations.

can you confirm once again and also provide the steps if you are seeing the error with O1,O0 ..

$ /proj/xbuilds/2018.3_daily_latest/installs/lin64/SDK/2018.3/gnu/microblaze/lin/bin/mb-gcc -c -mhard-float -mxl-float-convert peephole2.c -Os

$ /proj/xbuilds/2018.3_daily_latest/installs/lin64/SDK/2018.3/gnu/microblaze/lin/bin/mb-gcc -c -mhard-float -mxl-float-convert peephole2.c -O0

$ /proj/xbuilds/2018.3_daily_latest/installs/lin64/SDK/2018.3/gnu/microblaze/lin/bin/mb-gcc -c -mhard-float -mxl-float-convert peephole2.c -O1

$/proj/xbuilds/2018.3_daily_latest/installs/lin64/SDK/2018.3/gnu/microblaze/lin/bin/mb-gcc -c -mhard-float -mxl-float-convert peephole2.c -O2

;

12:1: internal compiler error: in extract_insn, at recog.c:2311

;

 

0 Kudos