Scope of changes:
- Extract common code between Clang and Flang for parsing AMDGPU features
- Add function which adds implicit target features for AMDGPU as Clang does
- Add AMDGPU target as one of valid targets for Flang
Paths
| Differential D145579
[Clang][Flang][AMDGPU] Add support for AMDGPU to Flang driver ClosedPublic Authored by domada on Mar 8 2023, 4:57 AM.
Details Summary Scope of changes:
Diff Detail
Unit TestsFailed Event TimelineHerald added subscribers: llvm-commits, cfe-commits, sstefan1 and 4 others. · View Herald Transcript domada retitled this revision from [Flang][AMDGPU][OpenMP] Save target features in OpenMP MLIR dialect to [WIP][Flang][AMDGPU][OpenMP] Save target features in OpenMP MLIR dialect.Mar 16 2023, 5:41 AM domada retitled this revision from [WIP][Flang][AMDGPU][OpenMP] Save target features in OpenMP MLIR dialect to [Flang][AMDGPU][OpenMP] Save target features in OpenMP MLIR dialect. Comment ActionsPatch rebased domada added a child revision: D146612: [Flang][OpenMP][MLIR] Lower OpenMP target attributes.Mar 22 2023, 2:28 AM Comment Actions Really nice to see some shared code being elevated out of Clang into LLVM, thanks! I've only reviewed on the Flang driver changes. I will let the OpenMP experts to review the remaining bits. All in all looks good, I've only made some small suggestions. Thanks for working on this!
domada retitled this revision from [Flang][AMDGPU][OpenMP] Save target features in OpenMP MLIR dialect to [Flang][AMDGPU] Add support for AMDGPU to Flang driver. Comment ActionsApplied remarks. Comment Actions A few more comments, but mostly nits. Btw, is this patch sufficient to generate code for AMDGPU? Or, put differently, what's the level of support atm?
domada added inline comments.
domada retitled this revision from [Flang][AMDGPU] Add support for AMDGPU to Flang driver to [Clang][Flang][AMDGPU] Add support for AMDGPU to Flang driver. Comment ActionsRebase & applied review remarks
Comment Actions Do you want to move the AMDGPU changes into AMDGPU.cpp next to AMD.cpp? From the conversation, there seems to be more target specific behaviours. Comment Actions
I prefer to defer further refactoring to the future, so that downstream branches have time to digest this change first. Comment Actions Thanks for the updates, mostly looks good. Just a couple of extra questions about the test coverage.
Comment Actions
@tschuett No. I don't plan to further refactor AMDGPU::TargeTInfo Clang class. My current goal is to add function attributes to the LLVM IR for Fortran OpenMP code and I don't need to make more changes in Clang to finish my goal. Comment Actions I wanted to ask whether you want to put an AMDGPU.cpp and AMD.cpp file in the flang/lib/Frontend directory. Comment Actions Patch rebased and added new test for checking incorrect wavefront sizes AMDGPU target features. domada added inline comments.
Comment Actions
@tschuett No, I don't plan to modify further flang/lib/Frontend. This revision is now accepted and ready to land.Mar 28 2023, 6:21 AM Closed by commit rGe43247dd329c: [Clang][Flang][AMDGPU] Add support for AMDGPU to Flang driver (authored by domada). · Explain WhyMar 29 2023, 12:30 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 507269 clang/lib/Basic/Targets/AMDGPU.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/Flang.cpp
flang/include/flang/Frontend/FrontendActions.h
flang/lib/Frontend/FrontendActions.cpp
flang/test/Driver/target-cpu-features.f90
flang/test/Lower/OpenMP/target_cpu_features.f90
llvm/include/llvm/TargetParser/TargetParser.h
llvm/lib/TargetParser/TargetParser.cpp
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
|
Should there be a test for this triple as well?