Add -fopenmp flag to the bbc tool.
This patch is part of the upstreaming effort from fir-dev branch.
Differential D121118
[flang] Add OpenMP flag to bbc clementval on Mar 7 2022, 7:28 AM. Authored by
Details Add -fopenmp flag to the bbc tool. This patch is part of the upstreaming effort from fir-dev branch.
Diff Detail
Event TimelineComment Actions I'm not sure what the long-term direction is here, but AFAIK this change could be avoided and flang-new could be used for OpenMP tests instead. Comment Actions +1 on this. As long as we are keeping bbc in the tree, I think it makes sense to have it. (Long term - maybe not - does flang-new use bbc internally or is there some code duplication?)
Comment Actions I'm primarily concerned that we are diverging here from what was discussed extensively in https://reviews.llvm.org/D117781. In particular, this patch introduces extra redundancy that could be avoided (i.e. this functionality is already available in flang-new). I would really prefer to avoid this, but I also appreciate that the key goal right now is to reduce the delta between fir-dev and main. If this is to be merged, than @shraiysh's suggestion makes a lot of sense to me. In general, I would like us to get into a habit of testing with all drivers that support a particular functionality. This way the redundancy is obvious and we have a mechanism to prevent the drivers getting out-of-sync. @clementval I see that you are using -pft-test here. AFAIK, there are no other OpenMP tests using PFT and in general dumping PFT has never been requested/required in the context of flang-new. I've decided to add it (see https://reviews.llvm.org/D121198) so that we can focus on the overall design rather than the fine detail.
bbc and flang-new are completely separate. We've been trying to reduce the code duplication, but upstreaming is higher priority :) Also, apart from code duplication there's overlap in functionality (AFAIK, bbc could already be replaced with flang-new). Comment Actions
I like the idea of replacing bbc with flang-new. Once this is done, I don't think we need any other tool (except maybe fir-opt). flang-new handles F90 to FIR. mlir-opt handles FIR to LLVM IR Dialect. mlir-translate handles LLVM IR Dialect to LLVM IR and the rest is handled by opt and other LLVM tools. All these could be exposed by flang-new so that a user only needs to use flang-new. (Not too sure about fir-opt but if we can make flang-new plug flang optimizations to mlir-opt and run them, I don't think we need this either). We just have to expose these tools using flang-new properly. (We need to have a definitive discussion about this on discourse someday).
Ofcourse. Honestly, as long as the functionality is exposed, it doesn't matter to me where it is exposed from, given that we are heavily inclined towards retiring bbc and tco anyways. My intention behind supporting this patch was that until we make the decision about keeping/retiring bbc, we can keep improving it by treating it as a regular tool (without the bias that it is dying 😄). Comment Actions To be fair this was not the case until your recent patch which was uploaded after this one. Comment Actions IIUC, fir-opt and mlir-opt are here to stay. These tools are used for testing specific passes in Flang and MLIR, respectively. We won't be able to merge them because that would require MLIR becoming aware of MLIR passes in Flang (i.e. making MLIR depend on Flang). And compiler driver, e.g. flang-new, doesn't require such granularity. Users are more concerned about e.g. -O0 vs -O1. So, it makes sense for flang-new and fir-opt to remain separate. Both flang-new and bbc consume Fortran source files and generate MLIR files. That's the functionality that I had in mind. IMO, https://reviews.llvm.org/D121198 doesn't change much in the grand scheme of things. Comment Actions Maybe a solution would be to push these options in the CLOptions.inc so they are not duplicated? Comment Actions Sorry, I digressed a bit. Sadly, that wouldn't help. Options for flang-new are defined in Options.td (e.g. -fopenmp). Also, bbc uses the llvm::cl API, which registers options globally. This can lead to some annoying behavior (e.g. Error: Option 'some-option' registered more than once!). Personally, I feel that landing https://reviews.llvm.org/D121198 and then adding an extra RUN line here (with flang-new) would put us in a much better position. The redundancy would be both documented and tested at the same time. Comment Actions Right! I forgot they do not use the same mechanism. Having two run lines for now is a good solution and it makes the test ready for future moves. |
[Suggestion] Maybe keep both for time being?