
Flang: The Fortran frontend of LLVM [video] - pjmlp
https://fosdem.org/2020/schedule/event/llvm_flang/
======
tikej
On one hand this is a great news and as Fortran user pretty happy about it.

On the other I’m a bit worried that once LLVM backend will take off for real,
so much focus will concentrate on it, that other compilers (PGI, gfortran,
Intel Fortran) development will finally stall or even get dropped and we will
wake up in future where LLVM behemoth swallowed all the competition.

This concern is not only limited to Fortran, but also other languages to be
clear. Of course I’m very grateful for LLVM project, it’s absolutely great. I
think that the idea to focus talent pool from many languages is brilliant and
beneficial for everyone. The only problem is when it becomes so focused that
it becomes only option. I am very happy for variety and options for compilers
and backends we have now.

~~~
Ididntdothis
I am not a compiler expert but I wonder if FORTRAN will lose its speed
advantages it still supposedly has if it goes through LLVM.

~~~
Fronzie
As far as I know, the main speed advantage is that Fortran supports arrays,
which are known to not alias.

C/C++ does not have alias-annotations built-in. Although with template
constructs like done in e.g. the Eigen library, alias-optimal code can be
generated.

~~~
galangalalgol
There are bugs in llvm mostly found by rust that are related to this. This
will be another source of pressure to fix these bugs, which is good.

~~~
hsivonen
My main hope for flang is that it motivates LLVM to fix the Rust-relevant non-
aliasing bugs. However, is it actually known that flang/f18 emits IR with the
same patterns that exposed the Rust-relevant LLVM bugs?

------
srean
This reminded me of the Fortress language after a long time.

It was a MODERN Fortran like language that Guy Steele and all were developing
at Sun
[https://en.wikipedia.org/wiki/Fortress_(programming_language...](https://en.wikipedia.org/wiki/Fortress_\(programming_language\))

It did not stand much of a chance once Oracle took over.

~~~
stephencanon
Fortress never got any real traction and was effectively dead well before
Oracle purchased Sun.

~~~
riffraff
IIRC the point of fortress was to win DARPA's high productivity computing
challenge, having failed at that it just remained a random research language.

Which is a pity, because it had some very interesting ideas, imvho.

------
gumby
Mods, please add a [video] warning to the title.

~~~
gumby
Why should this be downvoted; it’s a standard thing to do on HN.

(Complaining about downvoting is not typically an acceptable thing on HN but I
think this case is meta-respectable, though I appreciate the irony).

------
coldcode
I had to laugh a little at F18, given my first job in the early 80's was in
F78 I think, doing text processing no less.

------
kyrra
Aside: this is one thing I found interesting about go. They maintain one
compiler and two front ends:

llvm:
[https://go.googlesource.com/gollvm/](https://go.googlesource.com/gollvm/)

gcc:
[https://github.com/golang/gofrontend](https://github.com/golang/gofrontend)

Go:
[https://github.com/golang/go/tree/master/src/cmd/compile](https://github.com/golang/go/tree/master/src/cmd/compile)

And I believe all three are maintained by the go team. It should be noted that
the LLVM implementation is used by tinygo:
[https://tinygo.org/](https://tinygo.org/)

------
user_1234
Looks like there is a Fortran compiler which is already emitting MLIR IR with
few OpenMP constructs support and 2 SPEC CPU 2017 benchmarks running:
[https://github.com/compiler-tree-
technologies/fc](https://github.com/compiler-tree-technologies/fc)

Phoronix article: [https://www.phoronix.com/scan.php?page=news_item&px=FC-
LLVM-...](https://www.phoronix.com/scan.php?page=news_item&px=FC-LLVM-MLIR-
Opened-Up)

------
arh68
So when coarrays land in Flang in late 2021, will it be missing anything in
gfortran? What will the X-vs-Y look like at that point, I wonder?

I'm new to the Fortran scene, btw. I probably can't do more than fix typos,
but the Good First Issues on the github are:

[https://github.com/flang-
compiler/f18/labels/good%20first%20...](https://github.com/flang-
compiler/f18/labels/good%20first%20issue)

------
zengid
I'm excited to see more front ends embracing MLIR.

A lot of new interesting languages (Julia, Rust, etc) were empowered by being
able to take advantage of LLVM as a backend, so I can't imagine what new
languages might spring up around the heterogenous capabilities of MLIR, not to
mention existing languages targeting it as well.

------
chrisseaton
I'm thrilled about a Fortran front-end so I can run Fortran on the JVM via
Sulong.

------
fctorial
I've never seen a fortram codebase in my life. Is it still alive? What
advantages does it offer over C/C++?

~~~
ufov2
Fortran has language-level support for things important for numerical
scientific computing (complex numbers, multidimensional arrays, etc.), and it
has had them since the beginning in the 1950-60s.

The convenience is not really matched by C or C++, where similar features have
been added much later by language extensions or 3rd party libraries, resulting
to more complicated usage, fragmentation, and interoperability problems. Newer
languages also have similar issues, so for the user base that uses Fortran,
there's a lack of viable competitors.

~~~
PaulHoule
Also numerical codes can be trickier to write than you think. Rounding errors
and other treacheries of the floating point approximation to the 'real'
numbers can eat you alive.

If you want to do common numeric operations they might be a FORTRAN code that
is battle tested and performance tuned and it usually not hard to call from C,
Java, Python or some other language.

~~~
stephencanon
Fortran’s numerics model is actually somewhat weaker than C’s; if precise
rounding behavior is your main concern C (while still not ideal) is a better
option.

~~~
gnufx
For those of us not expert on the standards, could you explain in what way
Fortran is weaker, and its rounding control deficient?

------
ofrzeta
I would call it "Jortran". It's much less generic and with a little luck even
convey what kind of language it is.

