GAP Message - remark #30533: (LOOP) Compile with the "-Qopt-subscript-in-range" option to vectorize and/or parallelize the loop


Message

Compile with the "-Qopt-subscript-in-range" option to vectorize and/or parallelize the loop at line 123. [VERIFY] Make sure that no loop in the program contains or generates very large integers (typically very large integers >= 2^30).

Description

This message advises you to use the option /Qopt-subscript-in-range for the specified file during compilation.

This option helps the compiler vectorize and parallelize the loop at the specified line. You must verify that the loops in the file do not contain very large integers and are not likely to generate very large integers in intermediate computations. A very large integer is loosely defined as follows: On an n-bit machine, a very large integer is typically >= 2^(n-2). For example, on a 32-bit machine, a very large integer would be >= 2^30.

Example (in C language)

int f(int* A, int upper1, int upper2){
  long extra = 100.0;
  int return_val = 0;
  int val;
  for(int j=0; j < upper1; j++){
    for(int i = 0; i < upper2; i++){
      val = A[i*extra];
      return_val += val;
    }
  }
  return return_val;
}

In this case, the compiler is unable to vectorize the innermost loop at -O2 and -O3. Adding the /Qguide option produces the following advice:

id30533.cpp(9): remark #30533: (LOOP) Compile with the "-Qopt-subscript-in-range" option to vectorize and/or parallelize the loop at line 9. [VERIFY] Make sure that no loop in the program contains or generates very large integers (typically very large integers >= 2^30).

If you determine it is safe to do so, compiling this example with option /Qopt-subscript-in-range results in vectorization of the innermost loop.

 

Optimization Notice in English

For more complete information about compiler optimizations, see our Optimization Notice.