Skip to content

[Flang] Pointer assignments for scalar pointers are slower than GFortran #121133

Closed as not planned
@yus3710-fj

Description

@yus3710-fj

The execution of the following codes is slower than GFortran.

  • test.f90
subroutine pisnnn116(lhs,rhs)
  integer, target :: rhs
  integer, pointer :: lhs
  lhs => rhs
end subroutine
  • main.f90
implicit none

integer, parameter :: count = 40000
integer, target :: i,j,k
integer, pointer :: pi
real :: start_t, end_t
interface
  subroutine pisnnn116(lhs,rhs)
    integer, target :: rhs
    integer, pointer :: lhs
  end subroutine
end interface

call cpu_time(start_t)
do i=1,count
  do j=1,count
    call pisnnn116(pi,k)
  end do
end do
call cpu_time(end_t)

print *, end_t - start_t
end
  • commands
$ flang -Ofast -mcpu=native test.f90 main.f90 && ./a.out # for A64FX/Grace
$ flang -Ofast -march=native test.f90 main.f90 && ./a.out # for Xeon
Flang [s] GFortran [s]
A64FX 4.1902985 2.45159817
Grace 0.9753552 0.975116968
Xeon 1.5322586 1.52703595

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions