[flang-commits] [PATCH] D150159: [flang] CUDA Fortran - part 1/5: parsing

Steve Scalpone via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue May 16 09:56:36 PDT 2023


sscalpone added a comment.

In D150159#4344598 <https://reviews.llvm.org/D150159#4344598>, @MehdiChinoune wrote:

> Could you at least make CUDA-Fortran support behind a CMake option.
> As a package maintainer on a platform where CUDA is not supported (I am sure I am not alone), I don't want to fix code that will never benefit my platform.
> You know this a community project, CUDA is not supported everywhere.

Hi Mehdi,

It's a good idea to guard CUDA Fortran dependencies on CUDA in a similar way to how clang's CUDA C++ dependencies on CUDA are guarded.

This patch is front end work; because there's no lowering yet, there's no need to add such CMake options yet.   The feature is gated from Fortran users by way of a special required file extension (.cuf).

CUDA can work with Fortran using modules, interfaces, and libraries similarly to how CUDA can work with C++ using headers and libraries.  But both CUDA C++ and CUDA Fortran are language extensions, e.g. chevron syntax.

Generally regarding extensions, the Flang policy is spelled out in https://github.com/llvm/llvm-project/blob/48c3ae5cc3d4612283018ea597db3f7214aabfd9/flang/docs/Extensions.md.

> As a general principle, this compiler will accept by default and without complaint many legacy features, extensions to the standard language, and features that have been deleted from the standard, so long as the recognition of those features would not cause a standard-conforming program to be rejected or misinterpreted.

Adding support for CUDA Fortran follows both this spirit and intent as did the addition of OpenMP and OpenACC.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150159/new/

https://reviews.llvm.org/D150159



More information about the flang-commits mailing list