aomp icon indicating copy to clipboard operation
aomp copied to clipboard

[Fortran] How aomp relates to amdflang and flang-classic?

Open dmikushin opened this issue 2 years ago • 1 comments

Hello,

My question is specifically about Fortran language, and about a huge variety of different LLVM-based releases, which is very puzzling. Could you please help me understand how aomp relates to amdflang and flang-classic? More specifically,

  1. Although Fortran support has been mentioned for some earlier versions, how aompcc supports Fortran, if it is a C/C++ compiler driver program?
  2. Is amdflang and aomp the same product, or are they two different products? If different, does amdflang lack the OpenMP offloading covered here by aomp?
  3. If aomp Fortran support still exists, is it based on LLVM's in-tree flang, or on the out-of-tree classic flang? If on in-tree flang, how do you release it for production, if flang README mentions it's not for production? If you base aomp on classic flang, how do you support LLVM 16, if classic flang sticks to a patched version of LLVM 10?

dmikushin avatar Jun 20 '23 22:06 dmikushin

Great questions. A lot is changing and your questions gives me a chance to explain things.

First aomp is an advanced feature development compiler. Most things in aomp eventually make it into the ROCm compiler. In the new 17.0-3, you will see that flang is a symbolic link to a new binary called flang-legacy. Before this, flang was a symbolic link to clang which uses the clang driver in the llvm-project respository. The llvm-project repository is under heavy development for the new llvm flang which will not use the clang driver. The legacy flang support by the clang driver was mostly in customizations of the llvm-project repository by AMD which are going away soon. So we created a new flang only driver called flang-legacy while development of llvm flang continues. Currently flang is a symbolic link to the flang-legacy binary. We did this to prepare for aomp to eventually support both flang-legacy and flang-new (llvm flang). aomp 17.0-3 does not have the flang-new binary. With that background let answer #3 clearly

Q: "If aomp Fortran support still exists, is it based on LLVM's in-tree flang, or on the out-of-tree classic flang? " A: Support still exists via the new symbolic link from flang to flang-legacy. It is based on sources found in the flang repo which now has a set of frozen ROCm 5.6 sources. See directory https://github.com/ROCm-Developer-Tools/flang/tree/aomp-dev/flang-legacy

Q: "If on in-tree flang, how do you release it for production, if flang README mentions it's not for production? " A: The legacy flang based on the PGI compiler has limited offloading support. So it is not considered production even though it is and has been distributed with ROCm. The production fortran will be the new llvm flang. We cannot discuss schedule here.

Q: "If you base aomp on classic flang, how do you support LLVM 16, if classic flang sticks to a patched version of LLVM 10?" A: aomp uses development LLVM 17 along with local modifications to the classic flang repo. This classic flang repo has had limited maintenance. And as you may see it now has a frozen LLVM 16 driver incorporated into the flang repo. How we get that flang-legacy driver binary to work with current llvm toolchain such as llc, lld, and even clang, is a bit of magic. Look carefully at the sources in the flang-legacy directory and README if you want to understand this magic.

Q2: Regarding amdflang, I really dont know what that is. When we changed the link for flang to flang-legacy, we deleted that binary in aomp.

Q1: aompcc is depricated. Please just use clang, clang++, or flang (symlink to flang-legacy). When llvm flang has the features and performance of flang-legacy, the symbolic link will change to a new binary flang-new.

gregrodgers avatar Jul 18 '23 04:07 gregrodgers