-
-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--dump-all-passes-fortran seems to be calling gfortran somehow #2744
Comments
Yup, I had the same concern with this. Lines 2111 to 2113 in a59bba5
|
I see. We'll have to fix it. The backend should be the same as selected by the other options. The |
Regarding the errors in the Fortran backend, I made some good progress there earlier today. I will push them tomorrow. |
The GFortran failure is caused by #2746, that's unrelated. |
Also, there is a slight difference between how the ASR to tree/json/viz and how the ASR to fortran flags work. For example, we use But for generating ASR as fortran code we have: I would ideally want to somehow unify these for example: Do you have any suggestions/ideas on this? |
@Thirumalai-Shaktivel do you mean you are working on this current issue? If that is the case, please assign it and I can tackle some other issue. |
Nope, go ahead work on it and submit a PR. |
There is also another bug/todo thing with the |
Yes. The Fortran backend should be treated like the C backend or LLVM backend. It applies some passes, then generates code. The C backend must compile with Clang/GCC, the Fortran backend must compile with GFortran/ifort, etc. We can make it configurable exactly the level of support, but in general (and the default) it should produce such C or Fortran code that compiles with all compilers. For example, the Fortran can't use any LFortran extensions such as templates/generics, dicts, lists, sets, unsigned integers, etc. Rather, it must apply ASR->ASR passes to rewrite these features into such ASR that can be understood by GFortran. Conclusion: backends apply ASR passes, then generate code for a subset of ASR. Now let's talk about visualizing ASR. Those ASR visualizers can visualize any ASR node directly, they do not need any ASR passes to be called. They support all of ASR in a straightforward (single pass) manner. Examples of such visualizes are the default (Clojure/LISP like) output, JSON, the text and binary serialization, etc. And Fortran, and later Python (LPython). In principle any high-level language backend (C, C++, Julia) can graduate to such "visualization" backend, where it can generate code for any ASR. Right now we are only focusing on Fortran. The Fortran "visualization" should work for any ASR, without applying any ASR passes, and it should produce code that LFortran can ingest back (eventually). Note: the Fortran visualizer will not be 100% round-trippable: some information is lost (such as details about physical types). However, if we wanted, probably in principle we can store even such information using some pragmas and teach LFortran to read it. |
For now, in #2749, I made
The I think using |
Thanks for fixing it! I will test this in the coming days and report back here if there are other high priority usability issues to fix. If not, I'll close this issue. |
Sure, Thanks for reporting the issue. I will be happy to update/improve the approach based on the feedback.
Please note that we just need to provide |
I have some doubts:
|
Answers:
|
For now, the
I think we should have the provision to apply the passes (for example using PS: The |
@Shaikh-Ubaid, do you want to work on the above answers by @certik? If you are busy with the other issues, let me know. I need them for the Fortran backend. |
I think we have to apply the passes by default for the Fortran backend, as we apply passes for both the C and LLVM backends.
@certik concluded it here. Also, I think the command |
Regarding configuring the Fortran backend compilers, what would be the best design?
|
I would be happy to. If you haven't noticed, I had already shared about working on the feedback.
I think we should test or experience the current approach for sometime (probably a week or two) and then based on experience/feedback work on further improving it. But if you need it early/immediately I am happy to fix it first. |
The Regarding |
Yes, |
Yup, both |
@Thirumalai-Shaktivel I would be focusing on this in the next or next-to-next week. Please feel free to make progress on this if you need this early. |
@Thirumalai-Shaktivel I am unassigning this for you. I would assign it back in the next or next-to-next week if this is still open. |
So I get the following errors:
Rather, I would expect that
--dump-all-passes-fortran
just dumps the ASR passes as Fortran code, but otherwise does whatever lfortran would do without this option, which in the case above would just compile and run the code:$ lfortran examples/expr2.f90 $
As a workaround, one can do:
$ lfortran examples/expr2.f90 --dump-all-passes-fortran --show-llvm
The text was updated successfully, but these errors were encountered: