ROCm / gpufort

GPUFORT: S2S translation tool for CUDA Fortran and Fortran+X in the spirit of hipify

Home Page:https://rocmsoftwareplatform.github.io/gpufort/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CUF/ACC: Translate `size(<array>[,<dim>])` and `lbound(...)` and `ubound(...)`

domcharrier opened this issue · comments

  • In extracted kernels / device subroutines, we sometimes need to translate size(<array>[,<dim>]), lbound(<array>,<dim>)
    and ubound(<array>,<dim>) intrinsic calls,

Implementation status for different types of <array> and <dim>:

  • <array> is identifier and <dim> is integer literal:
    • size(<array>,<dim>) -> <array>_n<dim>
    • lbound(<array>,<dim>) -> <array>_lb<dim>
    • ubound(<array>,<dim>) -> <array>_lb<dim> + <array>_n<dim>

NOTE: Above, the <array>_lb<dim> and <array>_n<dim> are already arguments of
the extracted routines.

  • <array> is identifier and <dim> is identifier | arithmetic expression

    • In this case, we need to generate a query function that is parameterized by array rank.
  • Other cases where <array> is not an identifier and / or <dim> is identifier are not supported