From a0460e711648d6508d6cd628e511b726e4d38fb5 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Thu, 20 Mar 2025 12:05:40 +0000 Subject: [PATCH 01/11] [Flang] Add a Fortran Standards Support doc --- flang/docs/FortranStandardsSupport.md | 63 +++++++++++++++++++++++++++ flang/docs/index.md | 1 + 2 files changed, 64 insertions(+) create mode 100644 flang/docs/FortranStandardsSupport.md diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md new file mode 100644 index 0000000000000..5261633edc578 --- /dev/null +++ b/flang/docs/FortranStandardsSupport.md @@ -0,0 +1,63 @@ + + +# Flang's Fortran standards support + +```{contents} +--- +local: +--- +``` + +This document summarizes Flang's Fortran standards support. The information is only provided as a guideline. The compiler emits +TODOs/Not Yet Implemented messages for unimplemented features and that should be treated as the authoratative information. +Standards support is provided upto Fortran 2008 for now. It will be later extended for Fortran 2018 and Fortran 2023. + +The standards support information is provided as a table with three columns that are self explanatory. The Status column uses +the letters **P**, **Y**, **N** for the various implementation status. +- **P** : When the implementation is incomplete for a few cases +- **Y** : When the implementation is complete +- **N** : When the implementation is absent + +Note 1 : No distinction is made between the support in the Parser/Semantics and MLIR or Lowering support. +Note 2 : Besides the features listed below a few intrinsics like MIN/MAX are not supported for a few cases with CHARACTER type. + +## Fortran 77 +All features are supported. + +## Fortran 90 +All features are supported. + +## Fortran 95 +All features are supported. + +## Fortran 2003 +All features except those listed in the following table are supported. + +| Feature | Status | Comments | +|------------------------------------------------------------|--------|---------------------------------------------------------| +| Parameterized Derived Types | P | PDT with length type is not supported. See [Proposal](ParameterizedDerivedTypes.md) | +| Assignment to allocatable | P | Assignment to whole allocatable in FORALL is not implemented | +| Pointer Assignment | P | Polymorphic assignment in FORALL is not implemented | +| The VOLATILE attribute | P | Volatile in procedure interfaces is not implemented | +| Asynchronous input/output | P | IO will happen synchronously | + +## Fortran 2008 +All features except those listed in the following table are supported. + +| Feature | Status | Comments | +|------------------------------------------------------------|--------|---------------------------------------------------------| +| Coarrays | N | Lowering and runtime support is not implemented | +| do concurrent | P | Sequential execution works. Parallel support in progress| +| Internal procedure as an actual argument or pointer target | Y | Current implementation requires stack to be executable. See [Proposal](InternalProcedureTrampolines.md) | + +## Fortran 2018 +TBD + +## Fortran 2023 +TBD diff --git a/flang/docs/index.md b/flang/docs/index.md index 1de0ee2e6f0d6..0c92ea9cf7633 100644 --- a/flang/docs/index.md +++ b/flang/docs/index.md @@ -26,6 +26,7 @@ on how to get in touch with us and to learn more about the current status. C++style DesignGuideline FortranForCProgrammers + FortranStandardsSupport GettingInvolved GettingStarted ImplementingASemanticCheck From 8499992cc802c3f5a20b4ead7b401d0fa3f10613 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Fri, 21 Mar 2025 12:45:35 +0000 Subject: [PATCH 02/11] Address review comments --- flang/docs/FortranStandardsSupport.md | 57 +++++++++++++-------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md index 5261633edc578..5c960c8680686 100644 --- a/flang/docs/FortranStandardsSupport.md +++ b/flang/docs/FortranStandardsSupport.md @@ -1,12 +1,12 @@ - -# Flang's Fortran standards support +# Flang Fortran Standards Support ```{contents} --- @@ -14,12 +14,12 @@ local: --- ``` -This document summarizes Flang's Fortran standards support. The information is only provided as a guideline. The compiler emits -TODOs/Not Yet Implemented messages for unimplemented features and that should be treated as the authoratative information. -Standards support is provided upto Fortran 2008 for now. It will be later extended for Fortran 2018 and Fortran 2023. +This document summarizes Fortran standards support in Flang. The information is only provided as a guideline. The +TODOs/Not Yet Implemented messages emitted by the compiler for unimplemented features should be treated as authoritative. +Standards support is provided upto Fortran 2008 for now. It will be extended later for Fortran 2018 and Fortran 2023. The standards support information is provided as a table with three columns that are self explanatory. The Status column uses -the letters **P**, **Y**, **N** for the various implementation status. +the letters **P**, **Y**, **N** for the implementation status: - **P** : When the implementation is incomplete for a few cases - **Y** : When the implementation is complete - **N** : When the implementation is absent @@ -27,37 +27,36 @@ the letters **P**, **Y**, **N** for the various implementation status. Note 1 : No distinction is made between the support in the Parser/Semantics and MLIR or Lowering support. Note 2 : Besides the features listed below a few intrinsics like MIN/MAX are not supported for a few cases with CHARACTER type. -## Fortran 77 -All features are supported. - -## Fortran 90 -All features are supported. +## Fortran 2023 +TBD -## Fortran 95 -All features are supported. +## Fortran 2018 +TBD -## Fortran 2003 +## Fortran 2008 All features except those listed in the following table are supported. | Feature | Status | Comments | |------------------------------------------------------------|--------|---------------------------------------------------------| -| Parameterized Derived Types | P | PDT with length type is not supported. See [Proposal](ParameterizedDerivedTypes.md) | -| Assignment to allocatable | P | Assignment to whole allocatable in FORALL is not implemented | -| Pointer Assignment | P | Polymorphic assignment in FORALL is not implemented | -| The VOLATILE attribute | P | Volatile in procedure interfaces is not implemented | -| Asynchronous input/output | P | IO will happen synchronously | +| Coarrays | N | Lowering and runtime support is not implemented | +| do concurrent | P | Sequential execution works. Parallel support in progress| +| Internal procedure as an actual argument or pointer target | Y | Current implementation requires stack to be executable. See [Proposal](InternalProcedureTrampolines.md) | -## Fortran 2008 +## Fortran 2003 All features except those listed in the following table are supported. | Feature | Status | Comments | |------------------------------------------------------------|--------|---------------------------------------------------------| -| Coarrays | N | Lowering and runtime support is not implemented | -| do concurrent | P | Sequential execution works. Parallel support in progress| -| Internal procedure as an actual argument or pointer target | Y | Current implementation requires stack to be executable. See [Proposal](InternalProcedureTrampolines.md) | +| Parameterized Derived Types | P | PDT with length type parameters is not supported. See [Proposal](ParameterizedDerivedTypes.md) | +| Assignment to allocatable | P | Assignment to whole allocatable in FORALL is not implemented | +| The VOLATILE attribute | P | VOLATILE in procedure interfaces is not implemented | +| Asynchronous input/output | P | IO will happen synchronously | -## Fortran 2018 -TBD +## FORTRAN 77 +All features are supported. -## Fortran 2023 -TBD +## Fortran 90 +All features are supported. + +## Fortran 95 +All features are supported. From 6c4b380e9737f757c469b6d0881083bdc742a306 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Sun, 23 Mar 2025 02:39:21 +0000 Subject: [PATCH 03/11] Add support tables for Fortran 2023 and Fortran 2018 standards --- flang/docs/FortranStandardsSupport.md | 62 +++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md index 5c960c8680686..9dbc3096f42de 100644 --- a/flang/docs/FortranStandardsSupport.md +++ b/flang/docs/FortranStandardsSupport.md @@ -28,10 +28,64 @@ Note 1 : No distinction is made between the support in the Parser/Semantics and Note 2 : Besides the features listed below a few intrinsics like MIN/MAX are not supported for a few cases with CHARACTER type. ## Fortran 2023 -TBD +See [document](F202X.md) for a brief discussion about the new features in Fortran 2023. The following table summarizes the +status of all important Fortran 2023 features. + +| Feature | Status | Comments | +|------------------------------------------------------------|--------|---------------------------------------------------------| +| Allow longer statement lines and overall statement length | Y | | +| Automatic allocation of lengths of character variables | N | | +| The specifiers typeof and classof | N | | +| Conditional expressions and arguments | N | | +| More use of boz constants | P | All usages other than enum are supported | +| Intrinsics for extracting tokens from a string | N | | +| Intrinsics for Trig functions that work in degrees | N | | +| Intrinsics for Trig functions that work in half revolutions| N | | +| Changes to system_clock | N | | +| Changes for conformance with the new IEEE standard | Y | | +| Additional named constants to specify kinds | Y | | +| Extensions for c_f_pointer intrinsic | N | | +| Procedures for converting between fortran and c strings | N | | +| The at edit descriptor | N | | +| Control over leading zeros in output of real values | N | | +| Extensions for Namelist | N | | +| Allow an object of a type with a coarray ultimate component to be an array or allocatable | N | | +| Put with Notify | N | | +| Error conditions in collectives | N | | +| Simple procedures | N | | +| Using integer arrays to specify subscripts | N | | +| Using integer arrays to specify rank and bound of an array | N | | +| Using an integer constant to specify rank | N | | +| Reduction specifier for do concurrent | Y | | +| Enumerations | N | | ## Fortran 2018 -TBD +All features except those listed in the following table are supported. Almost all of the unsupported features are related to +coarrays. + +| Feature | Status | Comments | +|------------------------------------------------------------|--------|---------------------------------------------------------| +| Asynchronous communication | P | Syntax is accepted | +| Teams | N | | +| Image failure | P | stat_failed_image is added | +| Form team statement | N | | +| Change team construct | N | | +| Coarrays allocated in teams | N | | +| Critical construct | N | | +| Lock and unlock statements | N | | +| Events | N | | +| Sync team construct | N | | +| Image selectors | N | | +| Intrinsic functions get_team and team_number | N | | +| Intrinsic function image_index | N | | +| Intrinsic function num_images | N | | +| Intrinsic function this_image | N | | +| Intrinsic move_alloc extensions | P | | +| Detecting failed and stopped images | N | | +| Collective subroutines | N | | +| New and enhanced atomic subroutines | N | | +| Failed images and stat= specifiers | N | | +| Intrinsic function coshape | N | | ## Fortran 2008 All features except those listed in the following table are supported. @@ -52,11 +106,11 @@ All features except those listed in the following table are supported. | The VOLATILE attribute | P | VOLATILE in procedure interfaces is not implemented | | Asynchronous input/output | P | IO will happen synchronously | -## FORTRAN 77 +## Fortran 95 All features are supported. ## Fortran 90 All features are supported. -## Fortran 95 +## FORTRAN 77 All features are supported. From 84165a73fb4f68f6234525cddbf26ad4e0539829 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Sun, 23 Mar 2025 10:33:48 +0000 Subject: [PATCH 04/11] Move MIN MAX extension to Fortran 2003 table --- flang/docs/FortranStandardsSupport.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md index 9dbc3096f42de..df30f4b7ae493 100644 --- a/flang/docs/FortranStandardsSupport.md +++ b/flang/docs/FortranStandardsSupport.md @@ -24,8 +24,7 @@ the letters **P**, **Y**, **N** for the implementation status: - **Y** : When the implementation is complete - **N** : When the implementation is absent -Note 1 : No distinction is made between the support in the Parser/Semantics and MLIR or Lowering support. -Note 2 : Besides the features listed below a few intrinsics like MIN/MAX are not supported for a few cases with CHARACTER type. +Note : No distinction is made between the support in the Parser/Semantics and MLIR or Lowering support. ## Fortran 2023 See [document](F202X.md) for a brief discussion about the new features in Fortran 2023. The following table summarizes the @@ -105,6 +104,7 @@ All features except those listed in the following table are supported. | Assignment to allocatable | P | Assignment to whole allocatable in FORALL is not implemented | | The VOLATILE attribute | P | VOLATILE in procedure interfaces is not implemented | | Asynchronous input/output | P | IO will happen synchronously | +| MIN/MAX extensions for CHARACTER | P | Some variants are not supported | ## Fortran 95 All features are supported. From 8f9db848117821cbdda0e4138cce5d7ed2da9a03 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Mon, 24 Mar 2025 10:51:39 +0000 Subject: [PATCH 05/11] Remove line about extending support for Fortran 2018 and Fortran 2023 --- flang/docs/FortranStandardsSupport.md | 1 - 1 file changed, 1 deletion(-) diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md index df30f4b7ae493..dae7ec5482949 100644 --- a/flang/docs/FortranStandardsSupport.md +++ b/flang/docs/FortranStandardsSupport.md @@ -16,7 +16,6 @@ local: This document summarizes Fortran standards support in Flang. The information is only provided as a guideline. The TODOs/Not Yet Implemented messages emitted by the compiler for unimplemented features should be treated as authoritative. -Standards support is provided upto Fortran 2008 for now. It will be extended later for Fortran 2018 and Fortran 2023. The standards support information is provided as a table with three columns that are self explanatory. The Status column uses the letters **P**, **Y**, **N** for the implementation status: From 8eb16e412fc402eafe2e84630137d7f27b061de4 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Mon, 24 Mar 2025 15:53:33 +0000 Subject: [PATCH 06/11] Address review comments --- flang/docs/FortranStandardsSupport.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md index dae7ec5482949..324ebaca4e2d0 100644 --- a/flang/docs/FortranStandardsSupport.md +++ b/flang/docs/FortranStandardsSupport.md @@ -54,12 +54,12 @@ status of all important Fortran 2023 features. | Using integer arrays to specify subscripts | N | | | Using integer arrays to specify rank and bound of an array | N | | | Using an integer constant to specify rank | N | | -| Reduction specifier for do concurrent | Y | | +| Reduction specifier for do concurrent | P | Syntax is accepted | | Enumerations | N | | ## Fortran 2018 All features except those listed in the following table are supported. Almost all of the unsupported features are related to -coarrays. +the additional parallel features (coarrays/teams/collectives). | Feature | Status | Comments | |------------------------------------------------------------|--------|---------------------------------------------------------| From 6781534ca5bb4be7b8cf27ed8318f6bfdd0023b9 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Mon, 24 Mar 2025 23:50:49 +0000 Subject: [PATCH 07/11] Address review comment about multi-image execution --- flang/docs/FortranStandardsSupport.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md index 324ebaca4e2d0..65dc507398688 100644 --- a/flang/docs/FortranStandardsSupport.md +++ b/flang/docs/FortranStandardsSupport.md @@ -59,7 +59,7 @@ status of all important Fortran 2023 features. ## Fortran 2018 All features except those listed in the following table are supported. Almost all of the unsupported features are related to -the additional parallel features (coarrays/teams/collectives). +the multi-image execution. | Feature | Status | Comments | |------------------------------------------------------------|--------|---------------------------------------------------------| From 66199ad7e5b32b3b979ed8dd1261dcaaaf5c49db Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Sat, 19 Apr 2025 11:32:05 +0100 Subject: [PATCH 08/11] Partially address comments from Mark --- flang/docs/FortranStandardsSupport.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md index 65dc507398688..08e8a6e021321 100644 --- a/flang/docs/FortranStandardsSupport.md +++ b/flang/docs/FortranStandardsSupport.md @@ -27,7 +27,7 @@ Note : No distinction is made between the support in the Parser/Semantics and ML ## Fortran 2023 See [document](F202X.md) for a brief discussion about the new features in Fortran 2023. The following table summarizes the -status of all important Fortran 2023 features. +status of all important Fortran 2023 features. The table entries are based on the document [The new features in Fortran 2023](https://wg5-fortran.org/N2201-N2250/N2212.pdf). | Feature | Status | Comments | |------------------------------------------------------------|--------|---------------------------------------------------------| @@ -59,7 +59,7 @@ status of all important Fortran 2023 features. ## Fortran 2018 All features except those listed in the following table are supported. Almost all of the unsupported features are related to -the multi-image execution. +the multi-image execution. The table entries are based on the document [The new features in Fortran 2018](https://wg5-fortran.org/N2151-N2200/ISO-IECJTC1-SC22-WG5_N2161_The_New_Features_of_Fortran_2018.pdf). | Feature | Status | Comments | |------------------------------------------------------------|--------|---------------------------------------------------------| From 04fb498eaca2ff00688906ae5264d81704fe84f9 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Sun, 20 Apr 2025 17:39:32 +0100 Subject: [PATCH 09/11] Address Steve's comments --- flang/docs/FortranStandardsSupport.md | 48 +++++++++++++++------------ 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md index 08e8a6e021321..c913edc7a5eec 100644 --- a/flang/docs/FortranStandardsSupport.md +++ b/flang/docs/FortranStandardsSupport.md @@ -17,13 +17,17 @@ local: This document summarizes Fortran standards support in Flang. The information is only provided as a guideline. The TODOs/Not Yet Implemented messages emitted by the compiler for unimplemented features should be treated as authoritative. -The standards support information is provided as a table with three columns that are self explanatory. The Status column uses +The standards support information is provided as a table with three columns that are self explanatory. No distinction is +made between the support in the Parser/Semantics and MLIR or Lowering support. The Status column uses the letters **P**, **Y**, **N** for the implementation status: - **P** : When the implementation is incomplete for a few cases - **Y** : When the implementation is complete - **N** : When the implementation is absent -Note : No distinction is made between the support in the Parser/Semantics and MLIR or Lowering support. +There is no distinction made between support in the Parser/Semantics and the MLIR or Lowering stages. + +Note: The two major missing features in Flang at present are coarrays and parameterized derived types (PDTs) with length type parameters. + ## Fortran 2023 See [document](F202X.md) for a brief discussion about the new features in Fortran 2023. The following table summarizes the @@ -64,26 +68,26 @@ the multi-image execution. The table entries are based on the document [The new | Feature | Status | Comments | |------------------------------------------------------------|--------|---------------------------------------------------------| | Asynchronous communication | P | Syntax is accepted | -| Teams | N | | -| Image failure | P | stat_failed_image is added | -| Form team statement | N | | -| Change team construct | N | | -| Coarrays allocated in teams | N | | -| Critical construct | N | | -| Lock and unlock statements | N | | -| Events | N | | -| Sync team construct | N | | -| Image selectors | N | | -| Intrinsic functions get_team and team_number | N | | -| Intrinsic function image_index | N | | -| Intrinsic function num_images | N | | -| Intrinsic function this_image | N | | -| Intrinsic move_alloc extensions | P | | -| Detecting failed and stopped images | N | | -| Collective subroutines | N | | -| New and enhanced atomic subroutines | N | | -| Failed images and stat= specifiers | N | | -| Intrinsic function coshape | N | | +| Teams | N | Multi-image/Coarray feature | +| Image failure | P | Multi-image/Coarray feature. stat_failed_image is added | +| Form team statement | N | Multi-image/Coarray feature | +| Change team construct | N | Multi-image/Coarray feature | +| Coarrays allocated in teams | N | Multi-image/Coarray feature | +| Critical construct | N | Multi-image/Coarray feature | +| Lock and unlock statements | N | Multi-image/Coarray feature | +| Events | N | Multi-image/Coarray feature | +| Sync team construct | N | Multi-image/Coarray feature | +| Image selectors | N | Multi-image/Coarray feature | +| Intrinsic functions get_team and team_number | N | Multi-image/Coarray feature | +| Intrinsic function image_index | N | Multi-image/Coarray feature | +| Intrinsic function num_images | N | Multi-image/Coarray feature | +| Intrinsic function this_image | N | Multi-image/Coarray feature | +| Intrinsic move_alloc extensions | P | Multi-image/Coarray feature | +| Detecting failed and stopped images | N | Multi-image/Coarray feature | +| Collective subroutines | N | Multi-image/Coarray feature | +| New and enhanced atomic subroutines | N | Multi-image/Coarray feature | +| Failed images and stat= specifiers | N | Multi-image/Coarray feature | +| Intrinsic function coshape | N | Multi-image/Coarray feature | ## Fortran 2008 All features except those listed in the following table are supported. From 27260b6c05b46aee7a3086dba60ba93def034af9 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Mon, 21 Apr 2025 08:58:56 +0100 Subject: [PATCH 10/11] Remove duplicate sentence --- flang/docs/FortranStandardsSupport.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md index c913edc7a5eec..e16863cf2cce4 100644 --- a/flang/docs/FortranStandardsSupport.md +++ b/flang/docs/FortranStandardsSupport.md @@ -17,9 +17,8 @@ local: This document summarizes Fortran standards support in Flang. The information is only provided as a guideline. The TODOs/Not Yet Implemented messages emitted by the compiler for unimplemented features should be treated as authoritative. -The standards support information is provided as a table with three columns that are self explanatory. No distinction is -made between the support in the Parser/Semantics and MLIR or Lowering support. The Status column uses -the letters **P**, **Y**, **N** for the implementation status: +The standards support information is provided as a table with three columns that are self explanatory. +The Status column uses the letters **P**, **Y**, **N** for the implementation status: - **P** : When the implementation is incomplete for a few cases - **Y** : When the implementation is complete - **N** : When the implementation is absent From c36aebcef2d187aba61f8a5606b8e22555b01239 Mon Sep 17 00:00:00 2001 From: Kiran Chandramohan Date: Tue, 22 Apr 2025 22:06:15 +0100 Subject: [PATCH 11/11] Address comment from h.vetinari --- flang/docs/FortranStandardsSupport.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md index e16863cf2cce4..78f5aa4f5dd8d 100644 --- a/flang/docs/FortranStandardsSupport.md +++ b/flang/docs/FortranStandardsSupport.md @@ -18,10 +18,10 @@ This document summarizes Fortran standards support in Flang. The information is TODOs/Not Yet Implemented messages emitted by the compiler for unimplemented features should be treated as authoritative. The standards support information is provided as a table with three columns that are self explanatory. -The Status column uses the letters **P**, **Y**, **N** for the implementation status: -- **P** : When the implementation is incomplete for a few cases -- **Y** : When the implementation is complete -- **N** : When the implementation is absent +The Status column uses the letters **Y**, **P**, **N** for the implementation status: +- **Y** : Yes. When the implementation is complete +- **P** : Partial. When the implementation is incomplete for a few cases +- **N** : No. When the implementation is absent There is no distinction made between support in the Parser/Semantics and the MLIR or Lowering stages.