Compile error: NVFORTRAN-S-0000-Internal compiler error. replace_ast_subtree: unexpected ID ast

Hi, I got an ICE when using CUBLAS and either OpenACC or OpenMP:

NVFORTRAN-S-0000-Internal compiler error. replace_ast_subtree: unexpected ID ast    7825  (fail.f90: 25)
NVFORTRAN-S-0000-Internal compiler error. replace_ast_subtree: unexpected ast type    7825  (fail.f90: 25)

Below is the OpenMP reproducer, tested with nvfortran 24.3:

program tests
use cublas
implicit none

integer, parameter :: dp = selected_real_kind(12,307) 

real(dp), dimension(32,2) :: B1
real(dp), dimension(2,32) :: B2
real(dp) :: C

B1=1
B2=1

!$omp target data map(B1)
!$omp target data use_device_ptr(B1)
C = cublasDasum(32,B1(:,1),1) !ok 
C = cublasDasum(32,B1(32,1),1) !ok 
!$omp end target data
!$omp end target data

!$omp target data map(B2)
!$omp target data use_device_ptr(B2)
C = cublasDasum(32,B2(1,32),1) !ok 
C = cublasDasum(32,B2(1,:),1) !error
!$omp end target data
!$omp end target data

end program

Hope you can help me understanding which would be the problem, thanks!

In my initial testing with this - I think it’s an error with the compiler. I’m going to play with it some more to verify further - but I’m very suspicious of the error message - as well as the behavior when I test some of the working cases in the 2d case vs. a 1d case. But I need to dig in some more to make sure before I report it.

Can you share with me the OpenACC version you’re trying to get working too? I’ll test it too and attach it to the bug, if it’s found to be a similar issue.

Also - your compile lines would be great, just to make sure nothing is missing there!

Cheers,

Seth.

Note - I went ahead and opened a bug report on this and I’ll update it as you share more. The pertinent number here is Bug Report #35738. If we decide that OpenACC is also having the same issue - we may open another bug report, or we may just attach it to the same issue, depending on how the compiler engineers want to handle it.

1 Like

Thanks for answering @scamp1, here is the OpenACC version:

program tests
use cublas
implicit none

integer, parameter :: dp = selected_real_kind(12,307)

real(dp), dimension(32,2) :: B1
real(dp), dimension(2,32) :: B2
real(dp) :: C
real(dp), dimension(32) :: D

B1=1
B2=1

!$acc data copy(B1)
!$acc host_data use_device(B1)
C = cublasDasum(32,B1(:,1),1) !ok
C = cublasDasum(32,B1(32,1),1) !ok
!$acc end host_data
!$acc end data

!$acc data copy(B2)
!$acc host_data use_device(B2)
C = cublasDasum(32,B2(1,32),1) !ok
C = cublasDasum(32,B2(1,:),1) !error
!$acc end host_data
!$acc end data
end program

and its corresponding compile line:

nvfortran -acc=gpu -cuda -L$NVHPC_ROOT/math_libs/lib64 -cudalib=cublas repro-acc.f90 -o repro-acc

Regards.

Perfect. I added it to the previous issue - if the compiler engineers want to separate it into two issues, I’ll forward you the new report number when that happens. Otherwise, I’ll update you when I hear something from engineering!

Cheers.

1 Like