IntelLabs / ParallelAccelerator.jl

The ParallelAccelerator package, part of the High Performance Scripting project at Intel Labs
BSD 2-Clause "Simplified" License
294 stars 32 forks source link

harris vectorization-related error with icc 16.0.3 #124

Closed lkuper closed 7 years ago

lkuper commented 7 years ago

It looks like some of our examples fail to compile under icc 16.0.3.

Here's what happens with harris running under icc 15.0.2, using the input image that we usually benchmark with, and using the usual benchmarking settings (e.g.,vectorizationlevel=2):

input file = 618486main_earth_full_gray.jpg
output file = 618486main_earth_full_gray-corners.jpg

libgomp: Invalid value for environment variable OMP_NESTED
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
in typeToStr at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/cgen.jl
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
in typeToStr at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/cgen.jl
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
in typeToStr at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/cgen.jl
 /home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(266): (col. 17) warning #13379: loop was not vectorized with "simd"
 /home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(454): (col. 17) warning #13379: loop was not vectorized with "simd"
SELFPRIMED 5.761541118
checksum: 9.193732e6
SELFTIMED 0.116213422

Notice we get a couple of warnings about loops not being vectorized, but no errors.

Here's under icc 16.0.3:

input file = 618486main_earth_full_gray.jpg
output file = 618486main_earth_full_gray-corners.jpg

libgomp: Invalid value for environment variable OMP_NESTED
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
in typeToStr at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/cgen.jl
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
in typeToStr at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/cgen.jl
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
in typeToStr at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/cgen.jl
/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(269): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((2) <= (i27pp6))) goto label1;
                                              ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(270): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((2) <= (i28pp7))) goto label1;
                                              ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(271): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((i27pp6) <= ((GenSym38) - (1)))) goto label1;
                                                             ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(272): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((i28pp7) <= ((GenSym39) - (1)))) goto label1;
                                                             ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(274): error #2593: goto statement is not supported in vector function or in simd loop
                      goto label2;
                      ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(342): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((2) <= (i27pp11))) goto label3;
                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(343): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((2) <= (i28pp12))) goto label3;
                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(344): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((i27pp11) <= ((GenSym73) - (1)))) goto label3;
                                                              ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(345): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((i28pp12) <= ((GenSym74) - (1)))) goto label3;
                                                              ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(347): error #2593: goto statement is not supported in vector function or in simd loop
                      goto label4;
                      ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(457): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((2) <= (i26pp16))) goto label11;
                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(458): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((2) <= (i27pp17))) goto label11;
                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(459): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((i26pp16) <= ((GenSym114) - (1)))) goto label11;
                                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(460): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((i27pp17) <= ((GenSym115) - (1)))) goto label11;
                                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(462): error #2593: goto statement is not supported in vector function or in simd loop
                      goto label12;
                      ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(529): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((2) <= (i26pp21))) goto label13;
                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(530): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((2) <= (i27pp22))) goto label13;
                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(531): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((i26pp21) <= ((GenSym148) - (1)))) goto label13;
                                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(532): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((i27pp22) <= ((GenSym149) - (1)))) goto label13;
                                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(534): error #2593: goto statement is not supported in vector function or in simd loop
                      goto label14;
                      ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(601): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((2) <= (i26pp26))) goto label15;
                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(602): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((2) <= (i27pp27))) goto label15;
                                               ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(603): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((i26pp26) <= ((GenSym12) - (1)))) goto label15;
                                                              ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(604): error #2593: goto statement is not supported in vector function or in simd loop
                      if (!((i27pp27) <= ((GenSym13) - (1)))) goto label15;
                                                              ^

/home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp(606): error #2593: goto statement is not supported in vector function or in simd loop
                      goto label16;
                      ^

compilation aborted for /home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp (code 2)
ERROR: LoadError: failed process: Process(`icpc -O3 -qopenmp -mkl -std=c++11 -g -fpic -c -o /home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.o /home/lkuper/.julia/v0.4/ParallelAccelerator/src/../deps/generated/cgen_output1.cpp`, ProcessExited(2)) [2]
 in run at ./process.jl:531
 in __compile#518__ at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/cgen.jl:3321
 in toCGen at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/driver.jl:268
 in processFuncCall at /home/lkuper/.julia/v0.4/CompilerTools/src/OptFramework.jl:442
 in harrisCornerDetect at /home/lkuper/.julia/v0.4/CompilerTools/src/OptFramework.jl:557
 in harris at /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:98
 in main at /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:110
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:320
 in process_options at ./client.jl:257
 in _start at ./client.jl:378
while loading /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl, in expression starting on line 114

There may be others that don't work; this is just the first I encountered. I'm going to go back to 15.0.2 for now.

ehsantn commented 7 years ago

The behavior of ICC 16 is more reasonable I think. If there are gotos in the program, you cannot force it to vectorize the code.

lkuper commented 7 years ago

Yeah, I don't mean to say that ICC's behavior is unreasonable. The issue is that we're generating code that ICC fails to compile.

Actually, since ICC 15 produces "by the way, I don't vectorize this" warnings, I wonder if there's a flag or setting we can pass to ICC 16 to tell it to warn in the same way instead of just failing.

lkuper commented 7 years ago

We discussed this issue today and decided to just stick with ICC 15 for benchmarking. The issue is unlikely to affect many people anyway because vectorizationlevel=2 (which means "always vectorize") is not the default; the default is vectorizationlevel=0. We only use vectorizationlevel=2 in order to more accurately measure the effect of vectorization. The code runs fine with vectorizationlevel=0:

[lkuper@PSEPHI07 benchmarking]$ vectorizationlevel=0 ./runjulia-pse-acc.sh 
Starting benchmark run
Starting benchmark run
input file = 618486main_earth_full_gray.jpg
output file = 618486main_earth_full_gray-corners.jpg

libgomp: Invalid value for environment variable OMP_NESTED
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
in typeToStr at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/cgen.jl
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
in typeToStr at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/cgen.jl
WARNING: Base.String is deprecated, use AbstractString instead.
  likely near /home/lkuper/.julia/v0.4/ParallelAccelerator/examples/harris/harris.jl:114
in typeToStr at /home/lkuper/.julia/v0.4/ParallelAccelerator/src/cgen.jl
SELFPRIMED 5.931299378
checksum: 9.193732e6
SELFTIMED 0.140085279
Ending benchmark run
Ending benchmark run
[lkuper@PSEPHI07 benchmarking]$ icc -v
icc version 16.0.3 (gcc version 5.2.1 compatibility)

So this issue is likely only to affect users of the latest ICC who also turn on vectorizationlevel=2, in which case, buyer beware. :)