Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28543 Discussions

Internal Compiler Error with OpenMP Offloading and loop tiling


Heyho everyone,

when compiling a simple Matrix Multiplication with OpenMP Target Offloading using the OpenMP "tile construct" an "Internal compiler error" is generated. I use ifx for the Fortran code.

ifx (IFX) 2024.1.2 20240508

The variables used in the code have the following types. Variable n describes the size (n x n) of the matrices a,b,c and will be read from the command line. The matrices a,b are randomized and c is zeroed.

integer :: n, i, j, k
integer :: ii, jj, i_max, j_max
double precision, dimension(:,:), allocatable :: a, b, c

To compile the code I use the following arguments and tested the results on a system with an "Intel Xeon Platinum 8480+" and a "Data Center GPU Max 1100" and in addition without a GPU as a fallback check.

ifx -g -warn -O3 -march=native -qopenmp -fopenmp-targets=spir64 tile.F90 -o tile

To perform the tiled Matrix Multiplication the following code is used. According to the implemented features list the OpenMP "tile" is supported.

!$omp target teams loop collapse(2) map(to:a,b) map(tofrom:c)
!$omp tile sizes(32,32)
  do j = 1, n
    do i = 1, n
      do k = 1, n
        c(i, j) = c(i, j) + a(i, k)*b(k, j)
      end do
    end do
  end do
!$omp end tile
!$omp end target teams loop

The compilation fails with:

libc++abi: terminating due to uncaught exception of type std::bad_alloc: std::bad_alloc
 #0 0x00000000023f5ac7 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x23f5ac7)
 #1 0x00000000023f5bf0 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x23f5bf0)
 #2 0x00007faced99e520 (/lib/x86_64-linux-gnu/
 #3 0x00007faced9f29fc __pthread_kill_implementation pthread_kill.c:44
 #4 0x00007faced9f29fc __pthread_kill_internal pthread_kill.c:78
 #5 0x00007faced9f29fc pthread_kill pthread_kill.c:89
 #6 0x00007faced99e476 gsignal raise.c:27
 #7 0x00007faced9847f3 abort abort.c:81
 #8 0x0000000004723c16 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x4723c16)
 #9 0x000000000470c8eb (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x470c8eb)
#10 0x0000000004723883 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x4723883)
#11 0x00000000047252e6 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x47252e6)
#12 0x000000000472527f (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x472527f)
#13 0x0000000004724fd8 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x4724fd8)
#14 0x0000000002340154 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x2340154)
#15 0x00000000026eafaa (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x26eafaa)
#16 0x00000000026deb9c (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x26deb9c)
#17 0x00000000026deb6b (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x26deb6b)
#18 0x00000000043043fc (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x43043fc)
#19 0x00000000043032b9 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x43032b9)
#20 0x00000000043025e9 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x43025e9)
#21 0x0000000004301e8e (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x4301e8e)
#22 0x00000000042d50f5 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x42d50f5)
#23 0x00000000042aa2d8 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x42aa2d8)
#24 0x00000000042aa180 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x42aa180)
#25 0x00000000033a1c3d (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x33a1c3d)
#26 0x000000000272fbc5 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x272fbc5)
#27 0x00000000023451ed (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x23451ed)
#28 0x0000000002736cad (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x2736cad)
#29 0x0000000002344f5d (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x2344f5d)
#30 0x000000000272e91a (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x272e91a)
#31 0x000000000232e9cf (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x232e9cf)
#32 0x000000000232ce52 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x232ce52)
#33 0x00000000022d9601 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x22d9601)
#34 0x00000000024b161c (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x24b161c)
#35 0x00007faced985d90 __libc_start_call_main libc_start_call_main.h:58
#36 0x00007faced985e40 call_init libc-start.c:128
#37 0x00007faced985e40 __libc_start_main libc-start.c:379
#38 0x00000000021133e9 (/opt/intel/oneapi/compiler/2024.1/bin/compiler/xfortcom+0x21133e9)

/tmp/ifx0698450603dQfruC/ifxT36Gnd.bc: error #5629: **Internal compiler error: abort signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be explicit cause of this error.
compilation aborted for /tmp/ifx0698450603dQfruC/ifxT36Gnd.bc (code 3)

To resolve the problem temporarily I wrote the tiling myself using the following code:

!$omp target teams loop collapse(2) map(to:a,b) map(tofrom:c)
  do jj = 1, n, 32
    do ii = 1, n, 32
      j_max = min(jj + 32 - 1, n)
      i_max = min(ii + 32 - 1, n)

!$omp loop collapse(2)
      do j = jj, j_max
        do i = ii, i_max
          do k = 1, n
            c(i, j) = c(i, j) + a(i, k)*b(k, j)
          end do
        end do
      end do
    end do
  end do

To optimize the computation I included a nested collapse on line 7, but it seems, that the result of the computation is incorrect. When debugging the code I noticed, that the "i-loop" on line 9 has only one iteration with "i=0". Testing the code with other compilers (e.g. nvfortan), changing the part to "collapse(1)" or removing it the result was correct. Is nested "collapse" not supported in ifx?


Thanks in advance, if I missed any useful information let me know.

Labels (3)
0 Kudos
2 Replies

A compiler bug report has been filed for it.

0 Kudos

Hey Marc,


It sounds like you're encountering an internal compiler error with the OpenMP tile construct in ifx. Here are a few steps you can try to address the issue:

First, make sure you are using the latest version of the Intel Fortran compiler. Sometimes, these errors are fixed in newer releases.

Since the error involves memory allocation (std::bad_alloc), ensure your system has enough memory and that no other intensive processes are running.

As a workaround, you've already implemented manual tiling, which is a good approach. However, the issue with the "i-loop" could be due to incorrect handling of loop boundaries. Verify that your loop indices are correctly set and ensure that the min function is properly calculating i_max and j_max.

The nested collapse construct might not be fully supported or may have bugs in the current version of ifx. You could try reducing the complexity by manually unrolling some of the loops or simplifying the nested constructs.

If these steps don't resolve the problem, consider submitting a detailed bug report to Intel with your code and error logs. This will help their development team identify and fix the issue in future updates.

I hope this helps!

0 Kudos