Go compiler - Loop transformations

859 views
Skip to first unread message

xift

unread,
Feb 2, 2011, 10:35:55 AM2/2/11
to golang-nuts
Hi,
I am currently looking for a topic for my master thesis (Master of
Software Engineering at Dublin City University in Ireland).

Stumbling across go one question came to my mind.
Does it feature loop optimizations? Like loop unrolling, interchange
or parallization?

I got some experience with cache optimization using loop
transformation on IA32 processors. And if it did not exist yet, I'd be
glad to write a plugin that provides these additional features.

Regards,
Michael

Ian Lance Taylor

unread,
Feb 2, 2011, 11:32:17 AM2/2/11
to xift, golang-nuts
xift <mpur...@gmail.com> writes:

There are two Go compilers.

The gc compiler (6g/8g) does not do any loop optimizations. One of the
major goals of that compiler is to compile quickly. While improved
optimization is always useful, it has to fit within that goal. Loop
unrolling could perhaps be done, but it's hard for me to imagine that
loop interchange or parallelization would be compatible with the goal of
a fast compiler. There may be some scope for Go-specific optimizations
when handling for loops with a range clause; I'm not sure.

The gccgo compiler is based on gcc which does a fairly extensive set of
loop optimizations, though it is not up to par with the very best
compilers. The gcc community is always interested in improving the loop
optimizations, but that work would be quite different from working on Go
itself. If you are interested in pursuing that, a good place to start
would be http://gcc.gnu.org/wiki/Graphite .

Ian

ptolomy23

unread,
Feb 2, 2011, 12:31:40 PM2/2/11
to Ian Lance Taylor, xift, golang-nuts
Have you (or anyone else) done benchmarks comparing gc and gccgo? Perhaps with the shootout benchmarks?
I checked the Go Dashboard benchmarks page, but it is just a python stack trace.

Michael Purwins

unread,
Feb 2, 2011, 12:47:26 PM2/2/11
to golang-nuts
Thanks,
I'm gonna have a look at it. 

Ian Lance Taylor

unread,
Feb 2, 2011, 1:51:49 PM2/2/11
to ptolomy23, xift, golang-nuts
ptolomy23 <ptol...@gmail.com> writes:

> Have you (or anyone else) done benchmarks comparing gc and gccgo? Perhaps
> with the shootout benchmarks?

http://golang.org/test/bench/timing.log

I've made some speedups to gccgo since the last runs, though, which are
fairly significant for some test cases.

Ian

shka...@gmail.com

unread,
Dec 11, 2013, 4:34:27 PM12/11/13
to golan...@googlegroups.com, ptolomy23, xift
Hi,
I know this an old post, but is the statement about "gc" still valid?
Thank you,
Serge

Aram Hăvărneanu

unread,
Dec 11, 2013, 4:35:11 PM12/11/13
to shka...@gmail.com, golang-nuts, ptolomy23, xift

shka...@gmail.com

unread,
Dec 11, 2013, 4:49:52 PM12/11/13
to golan...@googlegroups.com, shka...@gmail.com, ptolomy23, xift
Thank you Aram, I actually mean "loop unrolling" specifically. I'd be interested to know when if and when "loop unrolling" happens.
Reply all
Reply to author
Forward
0 new messages