aomp icon indicating copy to clipboard operation
aomp copied to clipboard

[Issue]: Flang OpenMP Offload - declare target (with custom types)

Open FilipVaverka opened this issue 1 year ago • 0 comments
trafficstars

Problem Description

Compiling following Fortran module with OpenMP Offload support enabled causes invalid LLVM IR to be generated.

module test
    type :: Float2
        real :: x
        real :: y
    end type
contains
    type(Float2) function AddFloat2(a, b)
        implicit none
        type(Float2), intent(in) :: a, b
        !$omp declare target
        
        AddFloat2 = Float2(a%x + b%x, a%y + b%y)
    end function
end module
flang -fopenmp --offload-arch=gfx906 test.f90 -o test
/tmp/test-0c920e.ll:21:63: error: redefinition of argument '%b'
   21 | define i64 @test_addfloat2_(i64* noalias %a, i64* noalias %b, i64* noalias %b) !dbg !18 {
      |                                                               ^
1 error generated.

The issue seems to be caused by returning custom type from the function.

Operating System

openSUSE Tumbleweed

CPU

AMD Ryzen 9 7950X 16-Core Processor

GPU

AMD Radeon RX 7900 XTX, AMD Radeon VII

ROCm Version

ROCm 6.0.0

ROCm Component

aomp, flang

Steps to Reproduce

No response

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

FilipVaverka avatar Feb 29 '24 12:02 FilipVaverka